supabase-community / postgrest-csharp

A C# Client library for Postgrest
https://supabase-community.github.io/postgrest-csharp/api/Postgrest.html
MIT License
114 stars 22 forks source link

Feat : Add stored procedure #28

Closed elrhomariyounes closed 3 years ago

elrhomariyounes commented 3 years ago

What kind of change does this PR introduce?

Hello, I implemented a method to make stored procedure call

What is the current behavior?

26

What is the new behavior?

Usage

            var parameters = new Dictionary<string, object>()
            {
                { "p1", "v1" },
                { "p2", "v2" }
            };
            var response = await client.Rpc("procedure_name", parameters);
acupofjose commented 3 years ago

@elrhomariyounes succinct! I think to keep things DRY we should refactor and move PrepareRequestHeaders to a Static function on Helpers

class Table {
  public Dictionary<string, string>PrepareRequestHeaders(Dictionary<string, string> headers = null) {
     // ...
  }
}

to

class Helpers {
   public static Dictionary<string, string> PrepareRequestHeaders(Dictionary<string, string> headers = null, ClientAuthorization authorization = null, ClientOptions options = null) {
    // ...
  }
}

Then use the new function there to setup the Authentication call that Rpc is doing.

Thoughts?

elrhomariyounes commented 3 years ago

@acupofjose Yes, I couldn't agree more