supabase-community / gotrue-csharp

C# implementation of Supabase's GoTrue
https://supabase-community.github.io/gotrue-csharp/api/Supabase.Gotrue.Client.html
MIT License
39 stars 27 forks source link

Split into admin and regular client. Minor doc fixes. Lock lang to 9.0 #66

Closed wiverson closed 1 year ago

wiverson commented 1 year ago

What kind of change does this PR introduce?

Splits the stateful client into two classes. The methods requiring the service_key have been moved to a new AdminClient class.

Also some minor documentation tweaks/fixes, and also sets the language level to 9.0 instead of latest to help keep language level compatibility (useful e.g. if using the sources in Unity).

What is the current behavior?

Right now the stateful client includes service_key methods. This doesn't really make a lot of sense, as the stateful client includes several features that don't make sense in a server environment (e.g. background refresh threads).

What is the new behavior?

The only state the AdminClient really includes is the ServiceKey. It's a bit higher level than just using the StatelessClient directly.

This is a breaking change, as the interfaces and implementation have changed. The AdminClient methods do not take the service key JWT as parameters - typically that would be set in the constructor.

I suspect this doesn't really affect the top-level client all that much, as I hope that most, say, Xamarin users are not compiling in their service keys into their client apps. A user can use the AdminClient directly in their server-side code - this is probably more of a documentation thing.

acupofjose commented 1 year ago

Fantastic work as per usual. Thanks @wiverson!