C# Client Library
supabaseView on GitHubThis reference documents every object and method available in Supabase's C# library, supabase-csharp. You can use Supabase
to interact with your Postgres database, listen to database changes, invoke Deno Edge Functions, build login and user management functionality, and manage large files.
The C# client library is created and maintained by the Supabase community, and is not an official library. Please be tolerant of areas where the library is still being developed, and — as with all the libraries — feel free to contribute wherever you find issues.
Huge thanks to official maintainer, Joseph Schultz. As well as Will Iverson, Ben Randall, and Rhuan Barros for their help.
Installing
Install from NuGet
You can install Supabase package from nuget.org
Initializing
Initializing a new client is pretty straightforward. Find your project url and public key from the admin panel and pass it into your client initialization function.
Supabase
is heavily dependent on Models deriving from BaseModel
. To interact with the API, one must have the associated model (see example) specified.
Leverage Table
, PrimaryKey
, and Column
attributes to specify names of classes/properties that are different from their C# Versions.
_10var url = Environment.GetEnvironmentVariable("SUPABASE_URL");_10var key = Environment.GetEnvironmentVariable("SUPABASE_KEY");_10_10var options = new Supabase.SupabaseOptions_10{_10 AutoConnectRealtime = true_10};_10_10var supabase = new Supabase.Client(url, key, options);_10await supabase.InitializeAsync();
Fetch data
Performs vertical filtering with SELECT.
- LINQ expressions do not currently support parsing embedded resource columns. For these cases,
string
will need to be used. - When using string Column Names to select, they must match names in database, not names specified on model properties.
- Additional information on modeling + querying Joins and Inner Joins can be found in the
postgrest-csharp README
- By default, Supabase projects will return a maximum of 1,000 rows. This setting can be changed in Project API Settings. It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use
range()
queries to paginate through your data. From()
can be combined with ModifiersFrom()
can be combined with Filters- If using the Supabase hosted platform
apikey
is technically a reserved keyword, since the API gateway will pluck it out for authentication. It should be avoided as a column name.
_19// Given the following Model (City.cs)_19[Table("cities")]_19class City : BaseModel_19{_19 [PrimaryKey("id")]_19 public int Id { get; set; }_19_19 [Column("name")]_19 public string Name { get; set; }_19_19 [Column("country_id")]_19 public int CountryId { get; set; }_19_19 //... etc._19}_19_19// A result can be fetched like so._19var result = await supabase.From<City>().Get();_19var cities = result.Models
Insert data
Performs an INSERT into the table.
_20[Table("cities")]_20class City : BaseModel_20{_20 [PrimaryKey("id", false)]_20 public int Id { get; set; }_20_20 [Column("name")]_20 public string Name { get; set; }_20_20 [Column("country_id")]_20 public int CountryId { get; set; }_20}_20_20var model = new City_20{_20 Name = "The Shire",_20 CountryId = 554_20};_20_20await supabase.From<City>().Insert(model);
Update data
Performs an UPDATE on the table.
Update()
is typically called using a model as an argument or from a hydrated model.
_10var update = await supabase_10 .From<City>()_10 .Where(x => x.Name == "Auckland")_10 .Set(x => x.Name, "Middle Earth")_10 .Update();
Upsert data
Performs an UPSERT into the table.
- Primary keys should be included in the data payload in order for an update to work correctly.
- Primary keys must be natural, not surrogate. There are however, workarounds for surrogate primary keys.
_10var model = new City_10{_10 Id = 554,_10 Name = "Middle Earth"_10};_10_10await supabase.From<City>().Upsert(model);
Delete data
Performs a DELETE on the table.
Delete()
should always be combined with Filters to target the item(s) you wish to delete.
_10await supabase_10 .From<City>()_10 .Where(x => x.Id == 342)_10 .Delete();
Call a Postgres function
You can call stored procedures as a "Remote Procedure Call".
That's a fancy way of saying that you can put some logic into your database then call it from anywhere. It's especially useful when the logic rarely changes - like password resets and updates.
_10await supabase.Rpc("hello_world", null);
Using filters
Filters allow you to only return rows that match certain conditions.
Filters can be used on Select()
, Update()
, and Delete()
queries.
Note: LINQ expressions do not currently support parsing embedded resource columns. For these cases, string
will need to be used.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Where(x => x.Name == "The Shire")_10 .Single();
Column is equal to a value
Finds all rows whose value on the stated column
exactly matches the specified value
.
_10var result = await supabase.From<City>()_10 .Where(x => x.Name == "Bali")_10 .Get();
Column is not equal to a value
Finds all rows whose value on the stated column
doesn't match the specified value
.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Where(x => x.Name != "Bali")_10 .Get();
Column is greater than a value
Finds all rows whose value on the stated column
is greater than the specified value
.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Where(x => x.CountryId > 250)_10 .Get();
Column is greater than or equal to a value
Finds all rows whose value on the stated column
is greater than or equal to the specified value
.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Where(x => x.CountryId >= 250)_10 .Get();
Column is less than a value
Finds all rows whose value on the stated column
is less than the specified value
.
_10var result = await supabase.From<City>()_10 .Select("name, country_id")_10 .Where(x => x.CountryId < 250)_10 .Get();
Column is less than or equal to a value
Finds all rows whose value on the stated column
is less than or equal to the specified value
.
_10var result = await supabase.From<City>()_10 .Where(x => x.CountryId <= 250)_10 .Get();
Column matches a pattern
Finds all rows whose value in the stated column
matches the supplied pattern
(case sensitive).
_10var result = await supabase.From<City>()_10 .Filter(x => x.Name, Operator.Like, "%la%")_10 .Get();
Column matches a case-insensitive pattern
Finds all rows whose value in the stated column
matches the supplied pattern
(case insensitive).
_10await supabase.From<City>()_10 .Filter(x => x.Name, Operator.ILike, "%la%")_10 .Get();
Column is a value
A check for exact equality (null, true, false), finds all rows whose value on the stated column
exactly match the specified value
.
_10var result = await supabase.From<City>()_10 .Where(x => x.Name == null_10 .Get();
Column is in an array
Finds all rows whose value on the stated column
is found on the specified values
.
_10var result = await supabase.From<City>()_10 .Filter(x => x.Name, Operator.In, new List<object> { "Rio de Janiero", "San Francisco" })_10 .Get();
Column contains every element in a value
_10var result = await supabase.From<City>()_10 .Filter(x => x.MainExports, Operator.Contains, new List<object> { "oil", "fish" })_10 .Get();
Contained by value
_10var result = await supabase.From<City>()_10 .Filter(x => x.MainExports, Operator.ContainedIn, new List<object> { "oil", "fish" })_10 .Get();
Match a string
Finds all rows whose tsvector value on the stated column
matches to_tsquery(query).
_10var result = await supabase.From<Quote>()_10 .Select(x => x.Catchphrase)_10 .Filter(x => x.Catchphrase, Operator.FTS, new FullTextSearchConfig("'fat' & 'cat", "english"))_10 .Get();
Match an associated value
- Finds a model given a class (useful when hydrating models and correlating with database)
- Finds all rows whose columns match the specified
Dictionary<string, string>
object.
_10var city = new City_10{_10 Id = 224,_10 Name = "Atlanta"_10};_10_10var model = supabase.From<City>().Match(city).Single();
Don't match the filter
Finds all rows which doesn't satisfy the filter.
_10var result = await supabase.From<Country>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Where(x => x.Name != "Paris")_10 .Get();
Match at least one filter
Finds all rows satisfying at least one of the filters.
_10var result = await supabase.From<Country>()_10 .Where(x => x.Id == 20 || x.Id == 30)_10 .Get();
Using modifiers
Filters work on the row level—they allow you to return rows that only match certain conditions without changing the shape of the rows. Modifiers are everything that don't fit that definition—allowing you to change the format of the response (e.g., setting a limit or offset).
Order the results
Orders the result with the specified column.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Order(x => x.Id, Ordering.Descending)_10 .Get();
Limit the number of rows returned
Limits the result with the specified count.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Limit(10)_10 .Get();
Limit the query to a range
Limits the result to rows within the specified range, inclusive.
_10var result = await supabase.From<City>()_10 .Select("name, country_id")_10 .Range(0, 3)_10 .Get();
Retrieve one row of data
Retrieves only one row from the result. Result must be one row (e.g. using limit), otherwise this will result in an error.
_10var result = await supabase.From<City>()_10 .Select(x => new object[] { x.Name, x.CountryId })_10 .Single();
Create a new user
Creates a new user.
- By default, the user needs to verify their email address before logging in. To turn this off, disable Confirm email in your project.
- Confirm email determines if users need to confirm their email address after signing up.
- If Confirm email is enabled, a
user
is returned butsession
is null. - If Confirm email is disabled, both a
user
and asession
are returned.
- If Confirm email is enabled, a
- When the user confirms their email address, they are redirected to the
SITE_URL
by default. You can modify yourSITE_URL
or add additional redirect URLs in your project. - If SignUp() is called for an existing confirmed user:
- When both Confirm email and Confirm phone (even when phone provider is disabled) are enabled in your project, an obfuscated/fake user object is returned.
- When either Confirm email or Confirm phone (even when phone provider is disabled) is disabled, the error message,
User already registered
is returned.
_10var session = await supabase.Auth.SignUp(email, password);
Listen to auth events
Receive a notification every time an auth event happens.
- Types of auth events:
AuthState.SignedIn
,AuthState.SignedOut
,AuthState.UserUpdated
,AuthState.PasswordRecovery
,AuthState.TokenRefreshed
_16supabase.Auth.AddStateChangedListener((sender, changed) =>_16{_16 switch (changed)_16 {_16 case AuthState.SignedIn:_16 break;_16 case AuthState.SignedOut:_16 break;_16 case AuthState.UserUpdated:_16 break;_16 case AuthState.PasswordRecovery:_16 break;_16 case AuthState.TokenRefreshed:_16 break;_16 }_16});
Sign in a user
Log in an existing user using email or phone number with password.
- Requires either an email and password or a phone number and password.
_10var session = await supabase.Auth.SignIn(email, password);
Sign in a user through OTP
- Requires either an email or phone number.
- This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number.
- If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP.
- If you're using phone, you can configure whether you want the user to receive a OTP.
- The magic link's destination URL is determined by the
SITE_URL
. You can modify theSITE_URL
or add additional redirect urls in your project.
_10var options = new SignInOptions { RedirectTo = "http://myredirect.example" };_10var didSendMagicLink = await supabase.Auth.SendMagicLink("joseph@supabase.io", options);
Sign in a user through OAuth
Signs the user in using third party OAuth providers.
- This method is used for signing in using a third-party provider.
- Supabase supports many different third-party providers.
_10var signInUrl = supabase.Auth.SignIn(Provider.Github);
Sign out a user
Signs out the current user, if there is a logged in user.
- In order to use the
SignOut()
method, the user needs to be signed in first.
_10await supabase.Auth.SignOut();
Verify and log in through OTP
- The
VerifyOtp
method takes in different verification types. If a phone number is used, the type can either besms
orphone_change
. If an email address is used, the type can be one of the following:signup
,magiclink
,recovery
,invite
oremail_change
. - The verification type used should be determined based on the corresponding auth method called before
VerifyOtp
to sign up / sign-in a user.
_10var session = await supabase.Auth.VerifyOTP("+13334445555", TOKEN, MobileOtpType.SMS);
Retrieve a session
Returns the session data, if there is an active session.
_10var session = supabase.Auth.CurrentSession;
Retrieve a user
Returns the user data, if there is a logged in user.
_10var user = supabase.Auth.CurrentUser;
Update a user
Updates user data, if there is a logged in user.
- In order to use the
UpdateUser()
method, the user needs to be signed in first. - By Default, email updates sends a confirmation link to both the user's current and new email. To only send a confirmation link to the user's new email, disable Secure email change in your project's email auth provider settings.
_10var attrs = new UserAttributes { Email = "new-email@example.com" };_10var response = await supabase.Auth.Update(attrs);
Invokes a Supabase Edge Function.
_10var options = new InvokeFunctionOptions_10{_10 Headers = new Dictionary<string, string> {{ "Authorization", "Bearer 1234" }},_10 Body = new Dictionary<string, object> { { "foo", "bar" } }_10};_10_10await supabase.Functions.Invoke("hello", options: options);
Subscribe to channel
Subscribe to realtime changes in your database.
- Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by managing replication.
- If you want to receive the "previous" data for updates and deletes, you will need to set
REPLICA IDENTITY
toFULL
, like this:ALTER TABLE your_table REPLICA IDENTITY FULL;
_20class CursorBroadcast : BaseBroadcast_20{_20 [JsonProperty("cursorX")]_20 public int CursorX {get; set;}_20_20 [JsonProperty("cursorY")]_20 public int CursorY {get; set;}_20}_20_20var channel = supabase.Realtime.Channel("any");_20var broadcast = channel.Register<CursorBroadcast>();_20broadcast.AddBroadcastEventHandler((sender, baseBroadcast) =>_20{_20 var response = broadcast.Current();_20});_20_20await channel.Subscribe();_20_20// Send a broadcast_20await broadcast.Send("cursor", new CursorBroadcast { CursorX = 123, CursorY = 456 });
Unsubscribe from a channel
Unsubscribes and removes Realtime channel from Realtime client.
- Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.
_10var channel = await supabase.From<City>().On(ChannelEventType.All, (sender, change) => { });_10channel.Unsubscribe();_10_10// OR_10_10var channel = supabase.Realtime.Channel("realtime", "public", "*");_10channel.Unsubscribe()
Retrieve all channels
Returns all Realtime channels.
_10var channels = supabase.Realtime.Subscriptions;
Create a bucket
Creates a new Storage bucket
- Policy permissions required:
buckets
permissions:insert
objects
permissions: none
_10var bucket = await supabase.Storage.CreateBucket("avatars");
Retrieve a bucket
Retrieves the details of an existing Storage bucket.
- Policy permissions required:
buckets
permissions:select
objects
permissions: none
_10var bucket = await supabase.Storage.GetBucket("avatars");
List all buckets
Retrieves the details of all Storage buckets within an existing product.
- Policy permissions required:
buckets
permissions:select
objects
permissions: none
_10var buckets = await supabase.Storage.ListBuckets();
Update a bucket
Updates a new Storage bucket
- Policy permissions required:
buckets
permissions:update
objects
permissions: none
_10var bucket = await supabase.Storage.UpdateBucket("avatars", new BucketUpsertOptions { Public = false });
Delete a bucket
Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first empty()
the bucket.
- Policy permissions required:
buckets
permissions:select
anddelete
objects
permissions: none
_10var result = await supabase.Storage.DeleteBucket("avatars");
Empty a bucket
Removes all objects inside a single bucket.
- Policy permissions required:
buckets
permissions:select
objects
permissions:select
anddelete
_10var bucket = await supabase.Storage.EmptyBucket("avatars");
Upload a file
Uploads a file to an existing bucket.
- Policy permissions required:
buckets
permissions: noneobjects
permissions:insert
_10var imagePath = Path.Combine("Assets", "fancy-avatar.png");_10_10await supabase.Storage_10 .From("avatars")_10 .Upload(imagePath, "fancy-avatar.png", new FileOptions { CacheControl = "3600", Upsert = false });
Download a file
Downloads a file.
- Policy permissions required:
buckets
permissions: noneobjects
permissions:select
_10var bytes = await supabase.Storage.From("avatars").Download("public/fancy-avatar.png");
List all files in a bucket
Lists all the files within a bucket.
- Policy permissions required:
buckets
permissions: noneobjects
permissions:select
_10var objects = await supabase.Storage.From("avatars").List();
Replace an existing file
Replaces an existing file at the specified path with a new one.
- Policy permissions required:
buckets
permissions: noneobjects
permissions:update
andselect
_10var imagePath = Path.Combine("Assets", "fancy-avatar.png");_10await supabase.Storage.From("avatars").Update(imagePath, "fancy-avatar.png");
Move an existing file
Moves an existing file, optionally renaming it at the same time.
- Policy permissions required:
buckets
permissions: noneobjects
permissions:update
andselect
_10await supabase.Storage.From("avatars")_10 .Move("public/fancy-avatar.png", "private/fancy-avatar.png");
Delete files in a bucket
Deletes files within the same bucket
- Policy permissions required:
buckets
permissions: noneobjects
permissions:delete
andselect
_10await supabase.Storage.From("avatars").Remove(new List<string> { "public/fancy-avatar.png" });
Create a signed URL
Create signed url to download file without requiring permissions. This URL can be valid for a set number of seconds.
- Policy permissions required:
buckets
permissions: noneobjects
permissions:select
_10var url = await supabase.Storage.From("avatars").CreateSignedUrl("public/fancy-avatar.png", 60);
Retrieve public URL
Retrieve URLs for assets in public buckets
- The bucket needs to be set to public, either via UpdateBucket() or by going to Storage on supabase.com/dashboard, clicking the overflow menu on a bucket and choosing "Make public"
- Policy permissions required:
buckets
permissions: noneobjects
permissions: none
_10var publicUrl = supabase.Storage.From("avatars").GetPublicUrl("public/fancy-avatar.png");
Release Notes
0.16.2 - 2024-04-02
- Update dependency:
gotrue-csharp@4.2.7
- #88 Implement
signInAnonymously
from the JS client - Include additional 3rd party providers in constants.
- #88 Implement
0.16.1 - 2024-03-15
- Update dependency:
postgrest-csharp@3.5.1
- Re: #147 - Supports
Rpc
specifying a generic type for its return.
- Re: #147 - Supports
0.16.0 - 2024-03-12
- Update dependency:
postgrest-csharp@3.5.0
- Re: #78, Generalize query filtering creation
in
Table
so that it matches new generic signatures. - Move from
QueryFilter
parameters to a more genericIPosgrestQueryFilter
to support constructing new QueryFilters from a LINQ expression.- Note: Lists of
QueryFilter
s will now need to be defined as:new List<IPostgrestQueryFilter> { new QueryFilter(), ... }
- Note: Lists of
- Adjust serialization of timestamps within a
QueryFilter
to supportDateTime
andDateTimeOffset
using the ISO-8601 (https://stackoverflow.com/a/115002)
- Re: #78, Generalize query filtering creation
in
- Update dependency:
functions-csharp@1.3.2
- Re: #5 Add support for specifying Http Timeout
on a function call by adding
HttpTimeout
toInvokeFunctionOptions
- Re: #5 Add support for specifying Http Timeout
on a function call by adding
0.15.0 - 2024-01-08
- Update Dependency:
gotrue-csharp@4.2.6
- #83 Replaces JWTDecoder package with System.IdentityModel.Tokens.Jwt. Thanks @FantasyTeddy!
- Update Dependency:
postgrest-csharp@3.4.1
- Re: #85 Fixes problem when using multiple .Order() methods by merging #86. Thanks @hunsra!
- Re: #81
- [Minor] Removes
IgnoreOnInsert
andIgnoreOnUpdate
fromReferenceAttribute
as changing these properties tofalse
does not currently provide the expected functionality. - Fixes
Insert
andUpdate
not working on models that haveReference
specified on a property with a non-null value.
- [Minor] Removes
0.14.0 - 2023-12-15
- Update Dependency:
gotrue-csharp@4.2.5
- Update Dependency:
postgrest-csharp@3.3.0
- Re: #78 Updates signatures for
Not
andFilter
to include generic types for a better development experience. - Updates internal generic type names to be more descriptive.
- Add support for LINQ predicates on
Table<TModel>.Not()
signatures
- Re: #78 Updates signatures for
0.13.7 - 2023-11-13
- Update Dependency:
postgrest-csharp@3.2.10
- Re: #76 Removes the
incorrect
ToUniversalTime
conversion in the LINQWhere
parser.
- Re: #76 Removes the
incorrect
0.13.6 - 2023-10-12
- Update Dependency:
gotrue-csharp@4.2.3
0.13.5 - 2023-10-09
- Update Dependency:
postgrest-csharp@3.2.9
- Re: supabase-csharp#115 Additional support for a model referencing another model with multiple foreign keys.
- Re: supabase-csharp#115 Adds support for multiple references attached to the same model (foreign keys) on a single C# Model.
0.13.4 - 2023-10-08
- Update Dependency:
gotrue-csharp@4.2.2
- Re: #78 - Implements PKCE flow support
for
ResetPasswordForEmail
.
- Re: #78 - Implements PKCE flow support
for
0.13.3 - 2023-09-15
- Re: #107 - removes Realtime socket being disconnected on a User sign-out - only the subscriptions should be removed.
0.13.2 - 2023-09-15
- Update dependency:
postgrest-csharp@3.2.7
- Implements a
TableWithCache
forGet
requests that can pull reactive Models from cache before making a remote request. - Re: supabase-csharp#85 Includes sourcelink support.
- Re: #75 Fix issue with marshalling of stored procedure arguments. Big thank you to @corrideat!
- Implements a
0.13.1 - 2023-08-26
- Update dependency:
supabase-storage-csharp@1.4.0
- Fixes #11 - Which implements
missing
SupabaseStorageException
on failure status codes forUpload
,Download
,Move
,CreateSignedUrl
andCreateSignedUrls
.
- Fixes #11 - Which implements
missing
0.13.0 - 2023-08-26
- Update dependency:
gotrue-csharp@4.2.1
- #74 - Fixes bug where token refresh interval was not honored by client. Thanks @slater1!
- Minor Breaking changes: #72 - Fixes
Calling
SetAuth
does not actually set Authorization Headers for subsequent requests by implementingSetSession
- Removes
RefreshToken(string refreshToken)
andSetAuth(string accessToken
in favor ofSetSession(string accessToken, string refreshToken)
- Makes
RefreshAccessToken
requireaccessToken
andrefreshToken
as parameters - overrides the authorization headers to use the supplied token - Migrates project internal times to use
DateTime.UtcNow
overDateTime.Now
.
- Removes
0.12.2 - 2023-07-28
- Update dependency:
realtime-csharp@6.0.4
- Fixes #29 Where the Realtime client could
disconnect from channels after a few hours and fail to reconnect by removing the case where the
IsSubscribe
flag is flipped when encountering a channel error.
- Fixes #29 Where the Realtime client could
disconnect from channels after a few hours and fail to reconnect by removing the case where the
- Update dependency:
postgrest-csharp@3.2.5
- Re: supabase-community/supabase-csharp#81:
Clarifies
ReferenceAttribute
by changingshouldFilterTopLevel
touseInnerJoin
and adds an additional constructor forReferenceAttribute
with a shortcut for specifying theJoinType
- Re: supabase-community/supabase-csharp#81:
Clarifies
0.12.1 - 2023-06-29
- Update dependency:
gotrue-csharp@4.1.1
- #68 Changes Network Status to use the interface instead of client
- Update dependency:
postgrest-csharp@3.2.4
- #70 Minor Unity related fixes
0.12.0 - 2023-06-25
- Update dependency:
gotrue-csharp@4.1.0
- Update dependency:
postgrest-csharp@3.2.3
Thanks @wiverson for the work in this release!
0.11.1 - 2023-06-10
- Update dependencies:
functions-csharp@1.3.1
,gotrue-csharp@4.0.4
,postgrest-csharp@3.2.2
,realtime-csharp@6.0.3
,supabase-storage-csharp@1.3.2
,supabase-core@0.0.3
- Namespaces assembly names to make them unique among other dependencies, i.e:
Core.dll
becomesSupabase.Core.dll
which will hopefully prevent future collisions.
- Namespaces assembly names to make them unique among other dependencies, i.e:
0.11.0 - 2023-05-24
- Update dependency: postgrest-csharp@3.2.0
- General codebase and QOL improvements. Exceptions are generally thrown through
PostgrestException
now instead ofException
. AFailureHint.Reason
is provided with failures if possible to parse. AddDebugListener
is now available on the client to help with debugging- Merges #65 Cleanup + Add better exception handling
- Merges #66 Local test Fixes
- Fixes #67 Postgrest Reference attribute is producing StackOverflow for circular references
- General codebase and QOL improvements. Exceptions are generally thrown through
- Update dependency: gotrue-csharp@4.0.2
- #58 - Add support for the
reauthentication
endpoint which allows for secure password changes.
- #58 - Add support for the
- Update dependency: realtime-csharp@6.0.1
- Updates publishing action for future packages, includes README and icon.
- Merges #28 and #30
- The realtime client now takes a "fail-fast" approach. On establishing an initial connection, client will throw
a
RealtimeException
inConnectAsync()
if the socket server is unreachable. After an initial connection has been established, the client will continue attempting reconnections indefinitely until disconnected. - [Major, New] C#
EventHandlers
have been changed todelegates
. This should allow for cleaner event data access over the previous subclassedEventArgs
setup. Events are scoped accordingly. For example, theRealtimeSocket
error handlers will receive events regarding socket connectivity; whereas theRealtimeChannel
error handlers will receive events according toChannel
joining/leaving/etc. This is implemented with the following methods prefixed by ( Add/Remove/Clear):RealtimeBroadcast.AddBroadcastEventHandler
RealtimePresence.AddPresenceEventHandler
RealtimeSocket.AddStateChangedHandler
RealtimeSocket.AddMessageReceivedHandler
RealtimeSocket.AddHeartbeatHandler
RealtimeSocket.AddErrorHandler
RealtimeClient.AddDebugHandler
RealtimeClient.AddStateChangedHandler
RealtimeChannel.AddPostgresChangeHandler
RealtimeChannel.AddMessageReceivedHandler
RealtimeChannel.AddErrorHandler
Push.AddMessageReceivedHandler
- [Major, new]
ClientOptions.Logger
has been removed in favor ofClient.AddDebugHandler()
which allows for implementing custom logging solutions if desired.- A simple logger can be set up with the following:
_10client.AddDebugHandler((sender, message, exception) => Debug.WriteLine(message)); - [Major]
Connect()
has been markedObsolete
in favor ofConnectAsync()
- Custom reconnection logic has been removed in favor of using the built-in logic from
Websocket.Client@4.6.1
. - Exceptions that are handled within this library have been marked as
RealtimeException
s. - The local, docker-composed test suite has been brought back (as opposed to remotely testing on live supabase servers) to test against.
- Comments have been added throughout the entire codebase and an
XML
file is now generated on build.
0.10.0 - 2023-05-14
- Changes options to require
Supabase.SupabaseOptions.SessionPersistor
from usingISupabaseSessionHandler
toIGotrueSessionPersistance<Session>
(these are now synchronous operations). - Update dependency: gotrue-csharp@4.0.1
- #60 - Add interfaces, bug fixes, additional error reason detection. Thanks @wiverson!
- #57 Refactor exceptions, code cleanup, and move to
delegate auth state changes
- Huge thank you to @wiverson for his help on this refactor and release!
- Changes
- Exceptions have been simplified to a single
GotrueException
. AReason
field has been added toGotrueException
to clarify what happened. This should also be easier to manage as the Gotrue server API & messages evolve. - The session delegates for
Save
/Load
/Destroy
have been simplified to no longer requireasync
. - Console logging in a few places (most notable the background refresh thread) has been removed
in favor of a notification method. See
Client.AddDebugListener()
and the test cases for examples. This will allow you to implement your own logging strategy (write to temp file, console, user visible err console, etc). - The client now more reliably emits AuthState changes.
- There is now a single source of truth for headers in the stateful Client - the
Options
headers.
- Exceptions have been simplified to a single
- New feature:
- Added a
Settings
request to the stateless API only - you can now query the server instance to determine if it's got the settings you need. This might allow for things like a visual component in a tool to verify the GoTrue settings are working correctly, or tests that run differently depending on the server configuration.
- Added a
- Implementation notes:
- Test cases have been added to help ensure reliability of auth state change notifications and persistence.
- Persistence is now managed via the same notifications as auth state change
0.9.1 - 2023-04-28
- Update dependency: gotrue-csharp@3.1.1
- Implements
SignInWithIdToken
for Apple/Google signing from LW7. A HUGE thank you to @wiverson!
- Implements
- Update dependency: realtime-csharp@5.0.5
- Re: #27
PostgresChangesOptions
was not settinglistenType
in constructor. Thanks @Kuffs2205
- Re: #27
- Update dependency: supabase-storage-csharp@1.2.10
- Re: #7 Implements a
DownloadPublicFile
method.
- Re: #7 Implements a
0.9.0 - 2023-04-12
-
Update dependency: gotrue-csharp@3.1.0
- [Minor] Implements PKCE auth flow. SignIn using a provider now returns an instance of
ProviderAuthState
rather than astring
.
- [Minor] Implements PKCE auth flow. SignIn using a provider now returns an instance of
-
Update dependency: supabase-storage-csharp@1.2.9
- Implements storage features from LW7:
- feat: custom file size limit and mime types at bucket level supabase/storage-js#151 file size and mime type limits per bucket
- feat: quality option, image transformation supabase/storage-js#145 quality option for image transformations
- feat: format option for webp support supabase/storage-js#142 format option for image transformation
- Implements storage features from LW7:
0.8.8 - 2023-03-29
- Update dependency: gotrue-csharp@3.0.6
- Supports adding
SignInOptions
(i.e.RedirectTo
) onOAuth Provider
SignIn requests.
- Supports adding
0.8.7 - 2023-03-23
- Update dependency: realtime-csharp@5.0.4
- Re: #26 - Fixes Connect() not returning callback result when the socket isn't null. Thanks @BlueWaterCrystal!
0.8.6 - 2023-03-23
- Update dependency: supabase-storage-csharp@1.2.8
- Merge #5 Added search string as an optional search parameter. Thanks @ElectroKnight22!
0.8.5 - 2023-03-10
- Update dependency: realtime-csharp@5.0.3
- Re: #25 - Support Channel being resubscribed
after having been unsubscribed, fixes rejoin timer being erroneously called on channel
Unsubscribe
. Thanks @Kuffs2205!
- Re: #25 - Support Channel being resubscribed
after having been unsubscribed, fixes rejoin timer being erroneously called on channel
0.8.4 - 2023-03-03
- Update dependency: supabase-storage-csharp@1.2.7
- Re: #4 Implementation for
ClientOptions
which supports specifying Upload, Download, and Request timeouts.
- Re: #4 Implementation for
- Update dependency: realtime-csharp@5.0.2
- Re: #24 - Fixes join failing until reconnect happened + adds access token push on channel join. Big thank you to @Honeyhead for the help debugging and identifying!
0.8.3 - 2023-02-26
- Update dependency: supabase-storage-csharp@1.2.5
- Provides fix for supabase-community/supabase-csharp#54 - Dynamic headers were always being overwritten by initialized token headers, so the storage client would not receive user's access token as expected.
- Provides fix for upload progress not reporting in supabase-community/storage-csharp#3
- Update dependency: gotrue-csharp@3.0.5
- Fixes #44 - refresh timer should automatically
reattempt (interval of 5s) for HTTP exceptions - gracefully exits on invalid refresh and triggers
an
AuthState.Changed
event
- Fixes #44 - refresh timer should automatically
reattempt (interval of 5s) for HTTP exceptions - gracefully exits on invalid refresh and triggers
an
0.8.2 - 2023-02-26
- Update dependency: supabase-storage-csharp@1.2.4
UploadOrUpdate
now appropriately throws request exceptions
0.8.1 - 2023-02-06
- Update dependency: realtime-csharp@5.0.1
0.8.0 - 2023-01-31
- Update dependency: realtime-csharp@5.0.0
- Re: #21 Provide API for
presence
,broadcast
andpostgres_changes
- [Major, New]
Channel.PostgresChanges
event will receive the wildcard*
changes event, notChannel.OnMessage
. - [Major]
Channel.OnInsert
,Channel.OnUpdate
, andChannel.OnDelete
now conform to the server's payload ofResponse.Payload.**Data**
- [Major]
Channel.OnInsert
,Channel.OnUpdate
, andChannel.OnDelete
now returnPostgresChangesEventArgs
- [Minor] Rename
Channel
toRealtimeChannel
- Supports better handling of disconnects in
RealtimeSocket
and adds aClient.OnReconnect
event. - [Minor] Moves
ChannelOptions
toChannel.ChannelOptions
- [Minor] Moves
ChannelStateChangedEventArgs
toChannel.ChannelStateChangedEventArgs
- [Minor] Moves
Push
toChannel.Push
- [Minor] Moves
Channel.ChannelState
toConstants.ChannelState
- [Minor] Moves
SocketResponse
,SocketRequest
,SocketResponsePayload
,SocketResponseEventArgs
, andSocketStateChangedEventArgs
toSocket
namespace. - [New] Adds
RealtimeBroadcast
- [New] Adds
RealtimePresence
- [Improvement] Better handling of disconnection/reconnection
- [Major, New]
- Re: #21 Provide API for
- Update dependency: postgrest-csharp@3.1.3
- Another fix for #61 which futher typechecks nullable values.
0.7.2 - 2023-01-27
- Update dependency: gotrue-csharp@3.0.4
- Makes
Session.CreatedAt
a publicly settable property, which should fix incorrect dates on retrievedSession
s.
- Makes
- Update dependency: postgrest-csharp@3.1.2
- Fix #61 which did not correctly parse
Linq
Where
when encountering a nullable type. - Add missing support for transforming for
== null
and!= null
- Fix #61 which did not correctly parse
Linq
0.7.1 - 2023-01-17
- Update dependency: postgrest-csharp@3.1.1
- Fix issue from supabase-community/supabase-csharp#48 where boolean model properties would not be evaluated in predicate expressions
0.7.0 - 2023-01-16
- Update dependency: postgrest-csharp@3.1.0
- [Minor] Breaking API Change:
PrimaryKey
attribute defaults toshouldInsert: false
as most uses will have the Database generate the primary key. - Merged #60 which Added linq support
for
Select
,Where
,OnConflict
,Columns
,Order
,Update
,Set
, andDelete
- [Minor] Breaking API Change:
0.6.2 - 2022-11-22
- Update dependency: postgrest-csharp@3.0.4
GetHeaders
is now passed toModeledResponse
andBaseModel
so that the defaultUpdate
andDelete
methods use the latest credentialsGetHeaders
is used inRpc
calls (re: #39)
0.6.1 - 2022-11-12
- [Hotfix]
GetHeaders
was not passing properly toSupabaseTable
andGotrue.Api
0.6.0 - 2022-11-12
[BREAKING CHANGES]
Client
is no longer a singleton, singleton interactions (if desired) are left to the developer to implement.Client
supports injection of dependent clients after initialization via property:Auth
Functions
Realtime
Postgrest
Storage
SupabaseModel
contains no logic but remains for backwards compatibility. (MarkedObsolete
)ClientOptions.ShouldInitializeRealtime
was removed (no longer auto initialized)ClientOptions
now references anISupabaseSessionHandler
which specifies expected functionality for session persistence on Gotrue (replacesClientOptions.SessionPersistor
,ClientOptions.SessionRetriever
, andClientOptions.SessionDestroyer
).supabase-csharp
and all child libraries now have supportnullity
Other Changes:
- Update dependency: functions-csharp@1.2.1
- Update dependency: gotrue-csharp@3.0.2
- Update dependency: postgrest-csharp@3.0.2
- Update dependency: realtime-csharp@4.0.1
- Update dependency: supabase-storage-csharp@1.2.3
- Update dependency: supabase-core@0.0.2
Big thank you to @veleek for his insight into these changes.
0.5.3 - 2022-10-11
- Update dependency: postgrest-csharp@2.1.0
0.5.2 - 2022-9-13
- Update dependency: postgrest-csharp@2.0.12
- Merged #47 which added cancellation token
support to
Table<T>
methods. Thanks @devpikachu!
- Merged #47 which added cancellation token
support to
0.5.1 - 2022-8-1
- Update dependency: postgrest-csharp@2.0.11
- Update dependency: supabase-storage-csharp@1.1.1
0.5.0 - 2022-7-17
- Update dependency: postgrest-csharp@2.0.9
- Update dependency: realtime-csharp@3.0.1
- Update dependency: supabase-storage-csharp@1.1.0
- API Change [Breaking/Minor] Library no longer uses
WebClient
and instead leveragesHttpClient
. Progress events onUpload
andDownload
are now handled withEventHandler<float>
instead ofWebClient
EventHandlers.
- API Change [Breaking/Minor] Library no longer uses
0.4.4 - 2022-5-24
- Update dependency: gotrue-csharp@2.4.5
- Update dependency: postgrest-csharp@2.0.8
0.4.3 - 2022-5-13
- Update dependency: gotrue-csharp@2.4.4
0.4.2 - 2022-4-30
- Update dependency: gotrue-csharp@2.4.3
0.4.1 - 2022-4-23
- Update dependency: gotrue-csharp@2.4.2
0.4.0 - 2022-4-12
- Add support for functions-csharp@1.0.1, giving access to invoking Supabase's edge functions.
- Update dependency: gotrue-csharp@2.4.1
0.3.5 - 2022-4-11
- Update dependency: postgres-csharp@2.0.7
0.3.4 - 2022-03-28
- Update dependency: gotrue-csharp@2.4.0
0.3.3 - 2022-02-27
- Update dependency: gotrue-csharp@2.3.6
- Update dependency: supabase-storage-csharp@1.0.2
0.3.2 - 2022-02-18
- Update dependency: realtime-csharp@3.0.0
- Exchange existing websocket client: WebSocketSharp for Marfusios/websocket-client which adds support for Blazor WASM apps. Ref: #14
0.3.1 - 2022-01-20
- Update dependency: gotrue-csharp@2.3.5
- #23 Added
redirect_url
option for MagicLink sign in (Thanks @MisterJimson) - #21 Added SignOut method to Stateless Client ( Thanks @fplaras)
- #23 Added
0.3.0 - 2021-12-30
- Update dependency: postgrest-csharp@2.0.6
- Add support for
NullValueHandling
to be specified on aColumn
Attribute and for it to be honored on Inserts and Updates. Defaults to:NullValueHandling.Include
.- Implements #38
- Add support for
- Update dependency: realtime-csharp@2.0.8
- Implement Upstream Realtime RLS Error Broadcast Handler
- Implements #12
SocketResponse
now exposes a method:OldModel
, that hydrates theOldRecord
property into a model.
- Implement Upstream Realtime RLS Error Broadcast Handler
0.2.12 - 2021-12-29
- Update dependency: gotrue-csharp@2.3.3
SignUp
will return aSession
with a populatedUser
object on an unconfirmed signup.- Fixes #19
- Developers who were using a
null
check onSession.User
will need to adjust accordingly.
- Update dependency: postgrest-csharp@2.0.5
0.2.11 - 2021-12-24
- Update dependency: gotrue-csharp@2.3.2 (changes CreateUser parameters to conform to
AdminUserAttributes
) - Update dependency: realtime-csharp@2.0.7
- See #13
0.2.10 - 2021-12-23
- Update dependency: gotrue-csharp@2.3.0 (adds metadata support for user signup, see #14)
0.2.9 - 2021-12-9
- Separate Storage client from Supabase repo and into
storage-csharp
,supabase-csharp
now references new repo.
0.2.8 - 2021-12-4
- Update gotrue-csharp to 2.2.4
- Adds support for
ListUsers
(paginate, sort, filter),GetUserById
,CreateUser
, andUpdateById
- Adds support for
0.2.7 - 2021-12-2
- Update gotrue-csharp to 2.2.3
- Adds support for sending password resets to users.