Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure Project to Support DI and Nullity #36

Merged
merged 9 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
<img src="https://img.shields.io/nuget/vpre/supabase-csharp"/>
</a>
</p>
<h3 align="center">Stage: Beta</h3>

---

Integrate your [Supabase](https://supabase.io) projects with C#.
Expand Down Expand Up @@ -42,40 +40,35 @@ public async void Main()
var url = Environment.GetEnvironmentVariable("SUPABASE_URL");
var key = Environment.GetEnvironmentVariable("SUPABASE_KEY");

await Supabase.Client.InitializeAsync(url, key);
var client = new Supabase.Client(url, key);
await client.InitializeAsync();
// That's it - forreal. Crazy right?

// The Supabase Instance can be accessed at any time using:
// Supabase.Client.Instance {.Realtime|.Auth|etc.}
// For ease of readability we'll use this:
var instance = Supabase.Client.Instance;

// Access Postgrest using:
var channels = await instance.From<Channel>().Get();
var channels = await client.From<Channel>().Get();

// Access Auth using:
await instance.Auth.SignIn(email, password);
Debug.WriteLine(instance.Auth.CurrentUser.Id);
await client.Auth.SignIn(email, password);
Debug.WriteLine(client.Auth.CurrentUser.Id);

// Interested in Realtime Events?
var table = await instance.From<Channel>();
var table = await client.From<Channel>();
table.On(ChannelEventType.Insert, Channel_Inserted);
table.On(ChannelEventType.Delete, Channel_Deleted);
table.On(ChannelEventType.Update, Channel_Updated);

// Invoke an Edge Function
var result = await instance.Functions.Invoke("hello", new Dictionary<string, object> {
var result = await client.Functions.Invoke("hello", new Dictionary<string, object> {
{ "name", "Ronald" }
});

// Run a Remote Stored Procedure:
await instance.Rpc("my_cool_procedure", params);
await client.Rpc("my_cool_procedure", params);

// Interact with Supabase Storage
var storage = Supabase.Client.Instance.Storage
await storage.CreateBucket("testing")
await client.Storage.CreateBucket("testing")

var bucket = storage.From("testing");
var bucket = client.Storage.From("testing");

var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:", "");
var imagePath = Path.Combine(basePath, "Assets", "supabase-csharp.png");
Expand Down
Loading