From 67c3754539ec1482f943e3de67a3dc12fa032862 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 30 Aug 2023 11:14:04 +0200 Subject: [PATCH 1/3] feat: release 1.4.x --- README.md | 4 +- docs/examples/account/delete-identity.md | 13 ++ docs/examples/account/list-identities.md | 12 + docs/examples/functions/create-deployment.md | 1 - .../examples/functions/download-deployment.md | 14 ++ docs/examples/functions/update.md | 3 +- docs/examples/health/get-pub-sub.md | 12 + docs/examples/health/get-queue.md | 12 + docs/examples/locale/list-codes.md | 12 + docs/examples/project/create-variable.md | 14 ++ docs/examples/project/delete-variable.md | 13 ++ docs/examples/project/get-variable.md | 13 ++ docs/examples/project/list-variables.md | 12 + docs/examples/project/update-variable.md | 14 ++ docs/examples/proxy/create-rule.md | 14 ++ docs/examples/proxy/delete-rule.md | 13 ++ docs/examples/proxy/get-rule.md | 13 ++ docs/examples/proxy/list-rules.md | 12 + .../proxy/update-rule-verification.md | 13 ++ ...mbership-roles.md => update-membership.md} | 2 +- docs/examples/users/delete-identity.md | 13 ++ docs/examples/users/list-identities.md | 12 + docs/examples/users/update-labels.md | 14 ++ src/Appwrite/Client.cs | 2 +- src/Appwrite/Models/AttributeBoolean.cs | 7 + src/Appwrite/Models/AttributeDatetime.cs | 7 + src/Appwrite/Models/AttributeEmail.cs | 7 + src/Appwrite/Models/AttributeEnum.cs | 7 + src/Appwrite/Models/AttributeFloat.cs | 7 + src/Appwrite/Models/AttributeInteger.cs | 7 + src/Appwrite/Models/AttributeIp.cs | 7 + src/Appwrite/Models/AttributeRelationship.cs | 7 + src/Appwrite/Models/AttributeString.cs | 7 + src/Appwrite/Models/AttributeUrl.cs | 7 + src/Appwrite/Models/Database.cs | 13 +- src/Appwrite/Models/Deployment.cs | 102 +++++++-- src/Appwrite/Models/Execution.cs | 76 +++++-- src/Appwrite/Models/Function.cs | 90 ++++++-- src/Appwrite/Models/Headers.cs | 38 ++++ src/Appwrite/Models/HealthStatus.cs | 7 + src/Appwrite/Models/Identity.cs | 94 ++++++++ src/Appwrite/Models/IdentityList.cs | 38 ++++ src/Appwrite/Models/Index.cs | 7 + src/Appwrite/Models/LocaleCode.cs | 38 ++++ src/Appwrite/Models/LocaleCodeList.cs | 38 ++++ src/Appwrite/Models/ProxyRule.cs | 87 ++++++++ src/Appwrite/Models/ProxyRuleList.cs | 38 ++++ src/Appwrite/Models/User.cs | 20 +- src/Appwrite/Models/Variable.cs | 19 +- src/Appwrite/Services/Account.cs | 167 +++++++++----- src/Appwrite/Services/Avatars.cs | 28 +-- src/Appwrite/Services/Databases.cs | 194 ++++++++-------- src/Appwrite/Services/Functions.cs | 159 ++++++++----- src/Appwrite/Services/Graphql.cs | 8 +- src/Appwrite/Services/Health.cs | 113 ++++++++-- src/Appwrite/Services/Locale.cs | 63 ++++-- src/Appwrite/Services/Project.cs | 194 ++++++++++++++++ src/Appwrite/Services/Proxy.cs | 190 ++++++++++++++++ src/Appwrite/Services/Storage.cs | 55 ++--- src/Appwrite/Services/Teams.cs | 57 ++--- src/Appwrite/Services/Users.cs | 209 +++++++++++++----- 61 files changed, 2039 insertions(+), 430 deletions(-) create mode 100644 docs/examples/account/delete-identity.md create mode 100644 docs/examples/account/list-identities.md create mode 100644 docs/examples/functions/download-deployment.md create mode 100644 docs/examples/health/get-pub-sub.md create mode 100644 docs/examples/health/get-queue.md create mode 100644 docs/examples/locale/list-codes.md create mode 100644 docs/examples/project/create-variable.md create mode 100644 docs/examples/project/delete-variable.md create mode 100644 docs/examples/project/get-variable.md create mode 100644 docs/examples/project/list-variables.md create mode 100644 docs/examples/project/update-variable.md create mode 100644 docs/examples/proxy/create-rule.md create mode 100644 docs/examples/proxy/delete-rule.md create mode 100644 docs/examples/proxy/get-rule.md create mode 100644 docs/examples/proxy/list-rules.md create mode 100644 docs/examples/proxy/update-rule-verification.md rename docs/examples/teams/{update-membership-roles.md => update-membership.md} (88%) create mode 100644 docs/examples/users/delete-identity.md create mode 100644 docs/examples/users/list-identities.md create mode 100644 docs/examples/users/update-labels.md create mode 100644 src/Appwrite/Models/Headers.cs create mode 100644 src/Appwrite/Models/Identity.cs create mode 100644 src/Appwrite/Models/IdentityList.cs create mode 100644 src/Appwrite/Models/LocaleCode.cs create mode 100644 src/Appwrite/Models/LocaleCodeList.cs create mode 100644 src/Appwrite/Models/ProxyRule.cs create mode 100644 src/Appwrite/Models/ProxyRuleList.cs create mode 100644 src/Appwrite/Services/Project.cs create mode 100644 src/Appwrite/Services/Proxy.cs diff --git a/README.md b/README.md index b07a8d8..2b2f2b9 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Appwrite .NET SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-dotnet.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.3.7-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.4.0-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.3.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dotnet/releases).** +**This SDK is compatible with Appwrite server version 1.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dotnet/releases).** Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the .NET SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md new file mode 100644 index 0000000..c5ff987 --- /dev/null +++ b/docs/examples/account/delete-identity.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + +var account = new Account(client); + +await account.DeleteIdentity( + identityId: "[IDENTITY_ID]"); \ No newline at end of file diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md new file mode 100644 index 0000000..3a25342 --- /dev/null +++ b/docs/examples/account/list-identities.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetJWT("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ..."); // Your secret JSON Web Token + +var account = new Account(client); + +IdentityList result = await account.ListIdentities(); \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index c58d1ef..9bbcc65 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -11,6 +11,5 @@ var functions = new Functions(client); Deployment result = await functions.CreateDeployment( functionId: "[FUNCTION_ID]", - entrypoint: "[ENTRYPOINT]", code: InputFile.FromPath("./path-to-files/image.jpg"), activate: false); \ No newline at end of file diff --git a/docs/examples/functions/download-deployment.md b/docs/examples/functions/download-deployment.md new file mode 100644 index 0000000..d167c7d --- /dev/null +++ b/docs/examples/functions/download-deployment.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var functions = new Functions(client); + +byte[] result = await functions.DownloadDeployment( + functionId: "[FUNCTION_ID]", + deploymentId: "[DEPLOYMENT_ID]"); \ No newline at end of file diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index d9b29e6..1192ceb 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -11,4 +11,5 @@ var functions = new Functions(client); Function result = await functions.Update( functionId: "[FUNCTION_ID]", - name: "[NAME]"); \ No newline at end of file + name: "[NAME]", + runtime: "node-14.5"); \ No newline at end of file diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 0000000..7850a75 --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var health = new Health(client); + +HealthStatus result = await health.GetPubSub(); \ No newline at end of file diff --git a/docs/examples/health/get-queue.md b/docs/examples/health/get-queue.md new file mode 100644 index 0000000..1087bc1 --- /dev/null +++ b/docs/examples/health/get-queue.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var health = new Health(client); + +HealthStatus result = await health.GetQueue(); \ No newline at end of file diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md new file mode 100644 index 0000000..9eaab83 --- /dev/null +++ b/docs/examples/locale/list-codes.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var locale = new Locale(client); + +LocaleCodeList result = await locale.ListCodes(); \ No newline at end of file diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md new file mode 100644 index 0000000..3134c9b --- /dev/null +++ b/docs/examples/project/create-variable.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var project = new Project(client); + +Variable result = await project.CreateVariable( + key: "[KEY]", + value: "[VALUE]"); \ No newline at end of file diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md new file mode 100644 index 0000000..5d075ef --- /dev/null +++ b/docs/examples/project/delete-variable.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var project = new Project(client); + +await project.DeleteVariable( + variableId: "[VARIABLE_ID]"); \ No newline at end of file diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md new file mode 100644 index 0000000..e2214dc --- /dev/null +++ b/docs/examples/project/get-variable.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var project = new Project(client); + +Variable result = await project.GetVariable( + variableId: "[VARIABLE_ID]"); \ No newline at end of file diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md new file mode 100644 index 0000000..4ab2a38 --- /dev/null +++ b/docs/examples/project/list-variables.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var project = new Project(client); + +VariableList result = await project.ListVariables(); \ No newline at end of file diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md new file mode 100644 index 0000000..a0011c4 --- /dev/null +++ b/docs/examples/project/update-variable.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var project = new Project(client); + +Variable result = await project.UpdateVariable( + variableId: "[VARIABLE_ID]", + key: "[KEY]"); \ No newline at end of file diff --git a/docs/examples/proxy/create-rule.md b/docs/examples/proxy/create-rule.md new file mode 100644 index 0000000..be0d116 --- /dev/null +++ b/docs/examples/proxy/create-rule.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var proxy = new Proxy(client); + +ProxyRule result = await proxy.CreateRule( + domain: "", + resourceType: "api"); \ No newline at end of file diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 0000000..20e9151 --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var proxy = new Proxy(client); + +await proxy.DeleteRule( + ruleId: "[RULE_ID]"); \ No newline at end of file diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 0000000..29c97a6 --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var proxy = new Proxy(client); + +ProxyRule result = await proxy.GetRule( + ruleId: "[RULE_ID]"); \ No newline at end of file diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 0000000..227f334 --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var proxy = new Proxy(client); + +ProxyRuleList result = await proxy.ListRules(); \ No newline at end of file diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-verification.md new file mode 100644 index 0000000..459a00d --- /dev/null +++ b/docs/examples/proxy/update-rule-verification.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var proxy = new Proxy(client); + +ProxyRule result = await proxy.UpdateRuleVerification( + ruleId: "[RULE_ID]"); \ No newline at end of file diff --git a/docs/examples/teams/update-membership-roles.md b/docs/examples/teams/update-membership.md similarity index 88% rename from docs/examples/teams/update-membership-roles.md rename to docs/examples/teams/update-membership.md index 5f9db44..70ad79f 100644 --- a/docs/examples/teams/update-membership-roles.md +++ b/docs/examples/teams/update-membership.md @@ -9,7 +9,7 @@ var client = new Client() var teams = new Teams(client); -Membership result = await teams.UpdateMembershipRoles( +Membership result = await teams.UpdateMembership( teamId: "[TEAM_ID]", membershipId: "[MEMBERSHIP_ID]", roles: new List {}); \ No newline at end of file diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 0000000..f1425a9 --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,13 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var users = new Users(client); + +await users.DeleteIdentity( + identityId: "[IDENTITY_ID]"); \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 0000000..af8f996 --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var users = new Users(client); + +IdentityList result = await users.ListIdentities(); \ No newline at end of file diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 0000000..97d5db3 --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Services; +using Appwrite.Models; + +var client = new Client() + .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("5df5acd0d48c2") // Your project ID + .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + +var users = new Users(client); + +User result = await users.UpdateLabels( + userId: "[USER_ID]", + labels: new List {}); \ No newline at end of file diff --git a/src/Appwrite/Client.cs b/src/Appwrite/Client.cs index 900fe2f..20b1f60 100644 --- a/src/Appwrite/Client.cs +++ b/src/Appwrite/Client.cs @@ -62,7 +62,7 @@ public Client( { "x-sdk-name", ".NET" }, { "x-sdk-platform", "server" }, { "x-sdk-language", "dotnet" }, - { "x-sdk-version", "0.4.2"}, { "X-Appwrite-Response-Format", "1.0.0" } + { "x-sdk-version", "0.4.2"}, { "X-Appwrite-Response-Format", "1.4.0" } }; _config = new Dictionary(); diff --git a/src/Appwrite/Models/AttributeBoolean.cs b/src/Appwrite/Models/AttributeBoolean.cs index 3f8b453..1c1d8aa 100644 --- a/src/Appwrite/Models/AttributeBoolean.cs +++ b/src/Appwrite/Models/AttributeBoolean.cs @@ -19,6 +19,9 @@ public class AttributeBoolean [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -32,6 +35,7 @@ public AttributeBoolean( string key, string type, string status, + string error, bool required, bool? array, bool? xdefault @@ -39,6 +43,7 @@ public AttributeBoolean( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Default = xdefault; @@ -48,6 +53,7 @@ public AttributeBoolean( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], xdefault: (bool?)map["default"] @@ -58,6 +64,7 @@ public AttributeBoolean( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "default", Default } diff --git a/src/Appwrite/Models/AttributeDatetime.cs b/src/Appwrite/Models/AttributeDatetime.cs index 3f35543..9a65b83 100644 --- a/src/Appwrite/Models/AttributeDatetime.cs +++ b/src/Appwrite/Models/AttributeDatetime.cs @@ -19,6 +19,9 @@ public class AttributeDatetime [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -35,6 +38,7 @@ public AttributeDatetime( string key, string type, string status, + string error, bool required, bool? array, string format, @@ -43,6 +47,7 @@ public AttributeDatetime( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Format = format; @@ -53,6 +58,7 @@ public AttributeDatetime( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], format: map["format"].ToString(), @@ -64,6 +70,7 @@ public AttributeDatetime( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "format", Format }, diff --git a/src/Appwrite/Models/AttributeEmail.cs b/src/Appwrite/Models/AttributeEmail.cs index 5c90811..da27d5b 100644 --- a/src/Appwrite/Models/AttributeEmail.cs +++ b/src/Appwrite/Models/AttributeEmail.cs @@ -19,6 +19,9 @@ public class AttributeEmail [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -35,6 +38,7 @@ public AttributeEmail( string key, string type, string status, + string error, bool required, bool? array, string format, @@ -43,6 +47,7 @@ public AttributeEmail( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Format = format; @@ -53,6 +58,7 @@ public AttributeEmail( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], format: map["format"].ToString(), @@ -64,6 +70,7 @@ public AttributeEmail( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "format", Format }, diff --git a/src/Appwrite/Models/AttributeEnum.cs b/src/Appwrite/Models/AttributeEnum.cs index a57cd18..628cd23 100644 --- a/src/Appwrite/Models/AttributeEnum.cs +++ b/src/Appwrite/Models/AttributeEnum.cs @@ -19,6 +19,9 @@ public class AttributeEnum [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -38,6 +41,7 @@ public AttributeEnum( string key, string type, string status, + string error, bool required, bool? array, List elements, @@ -47,6 +51,7 @@ public AttributeEnum( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Elements = elements; @@ -58,6 +63,7 @@ public AttributeEnum( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], elements: ((JArray)map["elements"]).ToObject>(), @@ -70,6 +76,7 @@ public AttributeEnum( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "elements", Elements }, diff --git a/src/Appwrite/Models/AttributeFloat.cs b/src/Appwrite/Models/AttributeFloat.cs index 90d1199..f53990c 100644 --- a/src/Appwrite/Models/AttributeFloat.cs +++ b/src/Appwrite/Models/AttributeFloat.cs @@ -19,6 +19,9 @@ public class AttributeFloat [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -38,6 +41,7 @@ public AttributeFloat( string key, string type, string status, + string error, bool required, bool? array, double? min, @@ -47,6 +51,7 @@ public AttributeFloat( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Min = min; @@ -58,6 +63,7 @@ public AttributeFloat( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], min: map["min"] == null ? null : Convert.ToDouble(map["min"]), @@ -70,6 +76,7 @@ public AttributeFloat( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "min", Min }, diff --git a/src/Appwrite/Models/AttributeInteger.cs b/src/Appwrite/Models/AttributeInteger.cs index f0f57f8..9030f3f 100644 --- a/src/Appwrite/Models/AttributeInteger.cs +++ b/src/Appwrite/Models/AttributeInteger.cs @@ -19,6 +19,9 @@ public class AttributeInteger [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -38,6 +41,7 @@ public AttributeInteger( string key, string type, string status, + string error, bool required, bool? array, long? min, @@ -47,6 +51,7 @@ public AttributeInteger( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Min = min; @@ -58,6 +63,7 @@ public AttributeInteger( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], min: map["min"] == null ? null : Convert.ToInt64(map["min"]), @@ -70,6 +76,7 @@ public AttributeInteger( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "min", Min }, diff --git a/src/Appwrite/Models/AttributeIp.cs b/src/Appwrite/Models/AttributeIp.cs index 5c97834..b205e88 100644 --- a/src/Appwrite/Models/AttributeIp.cs +++ b/src/Appwrite/Models/AttributeIp.cs @@ -19,6 +19,9 @@ public class AttributeIp [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -35,6 +38,7 @@ public AttributeIp( string key, string type, string status, + string error, bool required, bool? array, string format, @@ -43,6 +47,7 @@ public AttributeIp( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Format = format; @@ -53,6 +58,7 @@ public AttributeIp( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], format: map["format"].ToString(), @@ -64,6 +70,7 @@ public AttributeIp( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "format", Format }, diff --git a/src/Appwrite/Models/AttributeRelationship.cs b/src/Appwrite/Models/AttributeRelationship.cs index bc34f4e..8ae93fc 100644 --- a/src/Appwrite/Models/AttributeRelationship.cs +++ b/src/Appwrite/Models/AttributeRelationship.cs @@ -19,6 +19,9 @@ public class AttributeRelationship [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -47,6 +50,7 @@ public AttributeRelationship( string key, string type, string status, + string error, bool required, bool? array, string relatedCollection, @@ -59,6 +63,7 @@ string side Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; RelatedCollection = relatedCollection; @@ -73,6 +78,7 @@ string side key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], relatedCollection: map["relatedCollection"].ToString(), @@ -88,6 +94,7 @@ string side { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "relatedCollection", RelatedCollection }, diff --git a/src/Appwrite/Models/AttributeString.cs b/src/Appwrite/Models/AttributeString.cs index 7aa7ea8..789b3e3 100644 --- a/src/Appwrite/Models/AttributeString.cs +++ b/src/Appwrite/Models/AttributeString.cs @@ -19,6 +19,9 @@ public class AttributeString [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -35,6 +38,7 @@ public AttributeString( string key, string type, string status, + string error, bool required, bool? array, long size, @@ -43,6 +47,7 @@ public AttributeString( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Size = size; @@ -53,6 +58,7 @@ public AttributeString( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], size: Convert.ToInt64(map["size"]), @@ -64,6 +70,7 @@ public AttributeString( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "size", Size }, diff --git a/src/Appwrite/Models/AttributeUrl.cs b/src/Appwrite/Models/AttributeUrl.cs index 436d08e..9999929 100644 --- a/src/Appwrite/Models/AttributeUrl.cs +++ b/src/Appwrite/Models/AttributeUrl.cs @@ -19,6 +19,9 @@ public class AttributeUrl [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("required")] public bool Required { get; private set; } @@ -35,6 +38,7 @@ public AttributeUrl( string key, string type, string status, + string error, bool required, bool? array, string format, @@ -43,6 +47,7 @@ public AttributeUrl( Key = key; Type = type; Status = status; + Error = error; Required = required; Array = array; Format = format; @@ -53,6 +58,7 @@ public AttributeUrl( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), required: (bool)map["required"], array: (bool?)map["array"], format: map["format"].ToString(), @@ -64,6 +70,7 @@ public AttributeUrl( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "required", Required }, { "array", Array }, { "format", Format }, diff --git a/src/Appwrite/Models/Database.cs b/src/Appwrite/Models/Database.cs index f632f4e..8058040 100644 --- a/src/Appwrite/Models/Database.cs +++ b/src/Appwrite/Models/Database.cs @@ -22,23 +22,29 @@ public class Database [JsonProperty("$updatedAt")] public string UpdatedAt { get; private set; } + [JsonProperty("enabled")] + public bool Enabled { get; private set; } + public Database( string id, string name, string createdAt, - string updatedAt + string updatedAt, + bool enabled ) { Id = id; Name = name; CreatedAt = createdAt; UpdatedAt = updatedAt; + Enabled = enabled; } public static Database From(Dictionary map) => new Database( id: map["$id"].ToString(), name: map["name"].ToString(), createdAt: map["$createdAt"].ToString(), - updatedAt: map["$updatedAt"].ToString() + updatedAt: map["$updatedAt"].ToString(), + enabled: (bool)map["enabled"] ); public Dictionary ToMap() => new Dictionary() @@ -46,7 +52,8 @@ string updatedAt { "$id", Id }, { "name", Name }, { "$createdAt", CreatedAt }, - { "$updatedAt", UpdatedAt } + { "$updatedAt", UpdatedAt }, + { "enabled", Enabled } }; } } \ No newline at end of file diff --git a/src/Appwrite/Models/Deployment.cs b/src/Appwrite/Models/Deployment.cs index 85cc649..df5b692 100644 --- a/src/Appwrite/Models/Deployment.cs +++ b/src/Appwrite/Models/Deployment.cs @@ -19,6 +19,9 @@ public class Deployment [JsonProperty("$updatedAt")] public string UpdatedAt { get; private set; } + [JsonProperty("type")] + public string Type { get; private set; } + [JsonProperty("resourceId")] public string ResourceId { get; private set; } @@ -40,19 +43,47 @@ public class Deployment [JsonProperty("status")] public string Status { get; private set; } - [JsonProperty("buildStdout")] - public string BuildStdout { get; private set; } - - [JsonProperty("buildStderr")] - public string BuildStderr { get; private set; } + [JsonProperty("buildLogs")] + public string BuildLogs { get; private set; } [JsonProperty("buildTime")] public long BuildTime { get; private set; } + [JsonProperty("providerRepositoryName")] + public string ProviderRepositoryName { get; private set; } + + [JsonProperty("providerRepositoryOwner")] + public string ProviderRepositoryOwner { get; private set; } + + [JsonProperty("providerRepositoryUrl")] + public string ProviderRepositoryUrl { get; private set; } + + [JsonProperty("providerBranch")] + public string ProviderBranch { get; private set; } + + [JsonProperty("providerCommitHash")] + public string ProviderCommitHash { get; private set; } + + [JsonProperty("providerCommitAuthorUrl")] + public string ProviderCommitAuthorUrl { get; private set; } + + [JsonProperty("providerCommitAuthor")] + public string ProviderCommitAuthor { get; private set; } + + [JsonProperty("providerCommitMessage")] + public string ProviderCommitMessage { get; private set; } + + [JsonProperty("providerCommitUrl")] + public string ProviderCommitUrl { get; private set; } + + [JsonProperty("providerBranchUrl")] + public string ProviderBranchUrl { get; private set; } + public Deployment( string id, string createdAt, string updatedAt, + string type, string resourceId, string resourceType, string entrypoint, @@ -60,13 +91,23 @@ public Deployment( string buildId, bool activate, string status, - string buildStdout, - string buildStderr, - long buildTime + string buildLogs, + long buildTime, + string providerRepositoryName, + string providerRepositoryOwner, + string providerRepositoryUrl, + string providerBranch, + string providerCommitHash, + string providerCommitAuthorUrl, + string providerCommitAuthor, + string providerCommitMessage, + string providerCommitUrl, + string providerBranchUrl ) { Id = id; CreatedAt = createdAt; UpdatedAt = updatedAt; + Type = type; ResourceId = resourceId; ResourceType = resourceType; Entrypoint = entrypoint; @@ -74,15 +115,25 @@ long buildTime BuildId = buildId; Activate = activate; Status = status; - BuildStdout = buildStdout; - BuildStderr = buildStderr; + BuildLogs = buildLogs; BuildTime = buildTime; + ProviderRepositoryName = providerRepositoryName; + ProviderRepositoryOwner = providerRepositoryOwner; + ProviderRepositoryUrl = providerRepositoryUrl; + ProviderBranch = providerBranch; + ProviderCommitHash = providerCommitHash; + ProviderCommitAuthorUrl = providerCommitAuthorUrl; + ProviderCommitAuthor = providerCommitAuthor; + ProviderCommitMessage = providerCommitMessage; + ProviderCommitUrl = providerCommitUrl; + ProviderBranchUrl = providerBranchUrl; } public static Deployment From(Dictionary map) => new Deployment( id: map["$id"].ToString(), createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), + type: map["type"].ToString(), resourceId: map["resourceId"].ToString(), resourceType: map["resourceType"].ToString(), entrypoint: map["entrypoint"].ToString(), @@ -90,9 +141,18 @@ long buildTime buildId: map["buildId"].ToString(), activate: (bool)map["activate"], status: map["status"].ToString(), - buildStdout: map["buildStdout"].ToString(), - buildStderr: map["buildStderr"].ToString(), - buildTime: Convert.ToInt64(map["buildTime"]) + buildLogs: map["buildLogs"].ToString(), + buildTime: Convert.ToInt64(map["buildTime"]), + providerRepositoryName: map["providerRepositoryName"].ToString(), + providerRepositoryOwner: map["providerRepositoryOwner"].ToString(), + providerRepositoryUrl: map["providerRepositoryUrl"].ToString(), + providerBranch: map["providerBranch"].ToString(), + providerCommitHash: map["providerCommitHash"].ToString(), + providerCommitAuthorUrl: map["providerCommitAuthorUrl"].ToString(), + providerCommitAuthor: map["providerCommitAuthor"].ToString(), + providerCommitMessage: map["providerCommitMessage"].ToString(), + providerCommitUrl: map["providerCommitUrl"].ToString(), + providerBranchUrl: map["providerBranchUrl"].ToString() ); public Dictionary ToMap() => new Dictionary() @@ -100,6 +160,7 @@ long buildTime { "$id", Id }, { "$createdAt", CreatedAt }, { "$updatedAt", UpdatedAt }, + { "type", Type }, { "resourceId", ResourceId }, { "resourceType", ResourceType }, { "entrypoint", Entrypoint }, @@ -107,9 +168,18 @@ long buildTime { "buildId", BuildId }, { "activate", Activate }, { "status", Status }, - { "buildStdout", BuildStdout }, - { "buildStderr", BuildStderr }, - { "buildTime", BuildTime } + { "buildLogs", BuildLogs }, + { "buildTime", BuildTime }, + { "providerRepositoryName", ProviderRepositoryName }, + { "providerRepositoryOwner", ProviderRepositoryOwner }, + { "providerRepositoryUrl", ProviderRepositoryUrl }, + { "providerBranch", ProviderBranch }, + { "providerCommitHash", ProviderCommitHash }, + { "providerCommitAuthorUrl", ProviderCommitAuthorUrl }, + { "providerCommitAuthor", ProviderCommitAuthor }, + { "providerCommitMessage", ProviderCommitMessage }, + { "providerCommitUrl", ProviderCommitUrl }, + { "providerBranchUrl", ProviderBranchUrl } }; } } \ No newline at end of file diff --git a/src/Appwrite/Models/Execution.cs b/src/Appwrite/Models/Execution.cs index e04fd90..eace2a9 100644 --- a/src/Appwrite/Models/Execution.cs +++ b/src/Appwrite/Models/Execution.cs @@ -31,17 +31,29 @@ public class Execution [JsonProperty("status")] public string Status { get; private set; } - [JsonProperty("statusCode")] - public long StatusCode { get; private set; } + [JsonProperty("requestMethod")] + public string RequestMethod { get; private set; } - [JsonProperty("response")] - public string Response { get; private set; } + [JsonProperty("requestPath")] + public string RequestPath { get; private set; } - [JsonProperty("stdout")] - public string Stdout { get; private set; } + [JsonProperty("requestHeaders")] + public List RequestHeaders { get; private set; } - [JsonProperty("stderr")] - public string Stderr { get; private set; } + [JsonProperty("responseStatusCode")] + public long ResponseStatusCode { get; private set; } + + [JsonProperty("responseBody")] + public string ResponseBody { get; private set; } + + [JsonProperty("responseHeaders")] + public List ResponseHeaders { get; private set; } + + [JsonProperty("logs")] + public string Logs { get; private set; } + + [JsonProperty("errors")] + public string Errors { get; private set; } [JsonProperty("duration")] public double Duration { get; private set; } @@ -54,10 +66,14 @@ public Execution( string functionId, string trigger, string status, - long statusCode, - string response, - string stdout, - string stderr, + string requestMethod, + string requestPath, + List requestHeaders, + long responseStatusCode, + string responseBody, + List responseHeaders, + string logs, + string errors, double duration ) { Id = id; @@ -67,10 +83,14 @@ double duration FunctionId = functionId; Trigger = trigger; Status = status; - StatusCode = statusCode; - Response = response; - Stdout = stdout; - Stderr = stderr; + RequestMethod = requestMethod; + RequestPath = requestPath; + RequestHeaders = requestHeaders; + ResponseStatusCode = responseStatusCode; + ResponseBody = responseBody; + ResponseHeaders = responseHeaders; + Logs = logs; + Errors = errors; Duration = duration; } @@ -82,10 +102,14 @@ double duration functionId: map["functionId"].ToString(), trigger: map["trigger"].ToString(), status: map["status"].ToString(), - statusCode: Convert.ToInt64(map["statusCode"]), - response: map["response"].ToString(), - stdout: map["stdout"].ToString(), - stderr: map["stderr"].ToString(), + requestMethod: map["requestMethod"].ToString(), + requestPath: map["requestPath"].ToString(), + requestHeaders: ((JArray)map["requestHeaders"]).ToObject>>().Select(it => Headers.From(map: it)).ToList(), + responseStatusCode: Convert.ToInt64(map["responseStatusCode"]), + responseBody: map["responseBody"].ToString(), + responseHeaders: ((JArray)map["responseHeaders"]).ToObject>>().Select(it => Headers.From(map: it)).ToList(), + logs: map["logs"].ToString(), + errors: map["errors"].ToString(), duration: Convert.ToDouble(map["duration"]) ); @@ -98,10 +122,14 @@ double duration { "functionId", FunctionId }, { "trigger", Trigger }, { "status", Status }, - { "statusCode", StatusCode }, - { "response", Response }, - { "stdout", Stdout }, - { "stderr", Stderr }, + { "requestMethod", RequestMethod }, + { "requestPath", RequestPath }, + { "requestHeaders", RequestHeaders.Select(it => it.ToMap()) }, + { "responseStatusCode", ResponseStatusCode }, + { "responseBody", ResponseBody }, + { "responseHeaders", ResponseHeaders.Select(it => it.ToMap()) }, + { "logs", Logs }, + { "errors", Errors }, { "duration", Duration } }; } diff --git a/src/Appwrite/Models/Function.cs b/src/Appwrite/Models/Function.cs index d5f9af2..c2cf235 100644 --- a/src/Appwrite/Models/Function.cs +++ b/src/Appwrite/Models/Function.cs @@ -28,6 +28,12 @@ public class Function [JsonProperty("enabled")] public bool Enabled { get; private set; } + [JsonProperty("live")] + public bool Live { get; private set; } + + [JsonProperty("logging")] + public bool Logging { get; private set; } + [JsonProperty("runtime")] public string Runtime { get; private set; } @@ -43,15 +49,33 @@ public class Function [JsonProperty("schedule")] public string Schedule { get; private set; } - [JsonProperty("scheduleNext")] - public string ScheduleNext { get; private set; } - - [JsonProperty("schedulePrevious")] - public string SchedulePrevious { get; private set; } - [JsonProperty("timeout")] public long Timeout { get; private set; } + [JsonProperty("entrypoint")] + public string Entrypoint { get; private set; } + + [JsonProperty("commands")] + public string Commands { get; private set; } + + [JsonProperty("version")] + public string Version { get; private set; } + + [JsonProperty("installationId")] + public string InstallationId { get; private set; } + + [JsonProperty("providerRepositoryId")] + public string ProviderRepositoryId { get; private set; } + + [JsonProperty("providerBranch")] + public string ProviderBranch { get; private set; } + + [JsonProperty("providerRootDirectory")] + public string ProviderRootDirectory { get; private set; } + + [JsonProperty("providerSilentMode")] + public bool ProviderSilentMode { get; private set; } + public Function( string id, string createdAt, @@ -59,14 +83,22 @@ public Function( List execute, string name, bool enabled, + bool live, + bool logging, string runtime, string deployment, List vars, List events, string schedule, - string scheduleNext, - string schedulePrevious, - long timeout + long timeout, + string entrypoint, + string commands, + string version, + string installationId, + string providerRepositoryId, + string providerBranch, + string providerRootDirectory, + bool providerSilentMode ) { Id = id; CreatedAt = createdAt; @@ -74,14 +106,22 @@ long timeout Execute = execute; Name = name; Enabled = enabled; + Live = live; + Logging = logging; Runtime = runtime; Deployment = deployment; Vars = vars; Events = events; Schedule = schedule; - ScheduleNext = scheduleNext; - SchedulePrevious = schedulePrevious; Timeout = timeout; + Entrypoint = entrypoint; + Commands = commands; + Version = version; + InstallationId = installationId; + ProviderRepositoryId = providerRepositoryId; + ProviderBranch = providerBranch; + ProviderRootDirectory = providerRootDirectory; + ProviderSilentMode = providerSilentMode; } public static Function From(Dictionary map) => new Function( @@ -91,14 +131,22 @@ long timeout execute: ((JArray)map["execute"]).ToObject>(), name: map["name"].ToString(), enabled: (bool)map["enabled"], + live: (bool)map["live"], + logging: (bool)map["logging"], runtime: map["runtime"].ToString(), deployment: map["deployment"].ToString(), vars: ((JArray)map["vars"]).ToObject>>().Select(it => Variable.From(map: it)).ToList(), events: ((JArray)map["events"]).ToObject>(), schedule: map["schedule"].ToString(), - scheduleNext: map["scheduleNext"].ToString(), - schedulePrevious: map["schedulePrevious"].ToString(), - timeout: Convert.ToInt64(map["timeout"]) + timeout: Convert.ToInt64(map["timeout"]), + entrypoint: map["entrypoint"].ToString(), + commands: map["commands"].ToString(), + version: map["version"].ToString(), + installationId: map["installationId"].ToString(), + providerRepositoryId: map["providerRepositoryId"].ToString(), + providerBranch: map["providerBranch"].ToString(), + providerRootDirectory: map["providerRootDirectory"].ToString(), + providerSilentMode: (bool)map["providerSilentMode"] ); public Dictionary ToMap() => new Dictionary() @@ -109,14 +157,22 @@ long timeout { "execute", Execute }, { "name", Name }, { "enabled", Enabled }, + { "live", Live }, + { "logging", Logging }, { "runtime", Runtime }, { "deployment", Deployment }, { "vars", Vars.Select(it => it.ToMap()) }, { "events", Events }, { "schedule", Schedule }, - { "scheduleNext", ScheduleNext }, - { "schedulePrevious", SchedulePrevious }, - { "timeout", Timeout } + { "timeout", Timeout }, + { "entrypoint", Entrypoint }, + { "commands", Commands }, + { "version", Version }, + { "installationId", InstallationId }, + { "providerRepositoryId", ProviderRepositoryId }, + { "providerBranch", ProviderBranch }, + { "providerRootDirectory", ProviderRootDirectory }, + { "providerSilentMode", ProviderSilentMode } }; } } \ No newline at end of file diff --git a/src/Appwrite/Models/Headers.cs b/src/Appwrite/Models/Headers.cs new file mode 100644 index 0000000..6963177 --- /dev/null +++ b/src/Appwrite/Models/Headers.cs @@ -0,0 +1,38 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class Headers + { + [JsonProperty("name")] + public string Name { get; private set; } + + [JsonProperty("value")] + public string Value { get; private set; } + + public Headers( + string name, + string xvalue + ) { + Name = name; + Value = xvalue; + } + + public static Headers From(Dictionary map) => new Headers( + name: map["name"].ToString(), + xvalue: map["value"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "name", Name }, + { "value", Value } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/HealthStatus.cs b/src/Appwrite/Models/HealthStatus.cs index 6923b24..0aeb7ad 100644 --- a/src/Appwrite/Models/HealthStatus.cs +++ b/src/Appwrite/Models/HealthStatus.cs @@ -10,6 +10,9 @@ namespace Appwrite.Models { public class HealthStatus { + [JsonProperty("name")] + public string Name { get; private set; } + [JsonProperty("ping")] public long Ping { get; private set; } @@ -17,20 +20,24 @@ public class HealthStatus public string Status { get; private set; } public HealthStatus( + string name, long ping, string status ) { + Name = name; Ping = ping; Status = status; } public static HealthStatus From(Dictionary map) => new HealthStatus( + name: map["name"].ToString(), ping: Convert.ToInt64(map["ping"]), status: map["status"].ToString() ); public Dictionary ToMap() => new Dictionary() { + { "name", Name }, { "ping", Ping }, { "status", Status } }; diff --git a/src/Appwrite/Models/Identity.cs b/src/Appwrite/Models/Identity.cs new file mode 100644 index 0000000..fbfb967 --- /dev/null +++ b/src/Appwrite/Models/Identity.cs @@ -0,0 +1,94 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class Identity + { + [JsonProperty("$id")] + public string Id { get; private set; } + + [JsonProperty("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonProperty("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonProperty("userId")] + public string UserId { get; private set; } + + [JsonProperty("provider")] + public string Provider { get; private set; } + + [JsonProperty("providerUid")] + public string ProviderUid { get; private set; } + + [JsonProperty("providerEmail")] + public string ProviderEmail { get; private set; } + + [JsonProperty("providerAccessToken")] + public string ProviderAccessToken { get; private set; } + + [JsonProperty("providerAccessTokenExpiry")] + public string ProviderAccessTokenExpiry { get; private set; } + + [JsonProperty("providerRefreshToken")] + public string ProviderRefreshToken { get; private set; } + + public Identity( + string id, + string createdAt, + string updatedAt, + string userId, + string provider, + string providerUid, + string providerEmail, + string providerAccessToken, + string providerAccessTokenExpiry, + string providerRefreshToken + ) { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + UserId = userId; + Provider = provider; + ProviderUid = providerUid; + ProviderEmail = providerEmail; + ProviderAccessToken = providerAccessToken; + ProviderAccessTokenExpiry = providerAccessTokenExpiry; + ProviderRefreshToken = providerRefreshToken; + } + + public static Identity From(Dictionary map) => new Identity( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + userId: map["userId"].ToString(), + provider: map["provider"].ToString(), + providerUid: map["providerUid"].ToString(), + providerEmail: map["providerEmail"].ToString(), + providerAccessToken: map["providerAccessToken"].ToString(), + providerAccessTokenExpiry: map["providerAccessTokenExpiry"].ToString(), + providerRefreshToken: map["providerRefreshToken"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "userId", UserId }, + { "provider", Provider }, + { "providerUid", ProviderUid }, + { "providerEmail", ProviderEmail }, + { "providerAccessToken", ProviderAccessToken }, + { "providerAccessTokenExpiry", ProviderAccessTokenExpiry }, + { "providerRefreshToken", ProviderRefreshToken } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/IdentityList.cs b/src/Appwrite/Models/IdentityList.cs new file mode 100644 index 0000000..ae6ac61 --- /dev/null +++ b/src/Appwrite/Models/IdentityList.cs @@ -0,0 +1,38 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class IdentityList + { + [JsonProperty("total")] + public long Total { get; private set; } + + [JsonProperty("identities")] + public List Identities { get; private set; } + + public IdentityList( + long total, + List identities + ) { + Total = total; + Identities = identities; + } + + public static IdentityList From(Dictionary map) => new IdentityList( + total: Convert.ToInt64(map["total"]), + identities: ((JArray)map["identities"]).ToObject>>().Select(it => Identity.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "identities", Identities.Select(it => it.ToMap()) } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/Index.cs b/src/Appwrite/Models/Index.cs index 19ce2d3..7700e24 100644 --- a/src/Appwrite/Models/Index.cs +++ b/src/Appwrite/Models/Index.cs @@ -19,6 +19,9 @@ public class Index [JsonProperty("status")] public string Status { get; private set; } + [JsonProperty("error")] + public string Error { get; private set; } + [JsonProperty("attributes")] public List Attributes { get; private set; } @@ -29,12 +32,14 @@ public Index( string key, string type, string status, + string error, List attributes, List? orders ) { Key = key; Type = type; Status = status; + Error = error; Attributes = attributes; Orders = orders; } @@ -43,6 +48,7 @@ public Index( key: map["key"].ToString(), type: map["type"].ToString(), status: map["status"].ToString(), + error: map["error"].ToString(), attributes: ((JArray)map["attributes"]).ToObject>(), orders: ((JArray)map["orders"]).ToObject>() ); @@ -52,6 +58,7 @@ public Index( { "key", Key }, { "type", Type }, { "status", Status }, + { "error", Error }, { "attributes", Attributes }, { "orders", Orders } }; diff --git a/src/Appwrite/Models/LocaleCode.cs b/src/Appwrite/Models/LocaleCode.cs new file mode 100644 index 0000000..3656766 --- /dev/null +++ b/src/Appwrite/Models/LocaleCode.cs @@ -0,0 +1,38 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class LocaleCode + { + [JsonProperty("code")] + public string Code { get; private set; } + + [JsonProperty("name")] + public string Name { get; private set; } + + public LocaleCode( + string code, + string name + ) { + Code = code; + Name = name; + } + + public static LocaleCode From(Dictionary map) => new LocaleCode( + code: map["code"].ToString(), + name: map["name"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "code", Code }, + { "name", Name } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/LocaleCodeList.cs b/src/Appwrite/Models/LocaleCodeList.cs new file mode 100644 index 0000000..19e6bfd --- /dev/null +++ b/src/Appwrite/Models/LocaleCodeList.cs @@ -0,0 +1,38 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class LocaleCodeList + { + [JsonProperty("total")] + public long Total { get; private set; } + + [JsonProperty("localeCodes")] + public List LocaleCodes { get; private set; } + + public LocaleCodeList( + long total, + List localeCodes + ) { + Total = total; + LocaleCodes = localeCodes; + } + + public static LocaleCodeList From(Dictionary map) => new LocaleCodeList( + total: Convert.ToInt64(map["total"]), + localeCodes: ((JArray)map["localeCodes"]).ToObject>>().Select(it => LocaleCode.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "localeCodes", LocaleCodes.Select(it => it.ToMap()) } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/ProxyRule.cs b/src/Appwrite/Models/ProxyRule.cs new file mode 100644 index 0000000..c708949 --- /dev/null +++ b/src/Appwrite/Models/ProxyRule.cs @@ -0,0 +1,87 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class ProxyRule + { + [JsonProperty("$id")] + public string Id { get; private set; } + + [JsonProperty("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonProperty("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonProperty("domain")] + public string Domain { get; private set; } + + [JsonProperty("resourceType")] + public string ResourceType { get; private set; } + + [JsonProperty("resourceId")] + public string ResourceId { get; private set; } + + [JsonProperty("status")] + public string Status { get; private set; } + + [JsonProperty("logs")] + public string Logs { get; private set; } + + [JsonProperty("renewAt")] + public string RenewAt { get; private set; } + + public ProxyRule( + string id, + string createdAt, + string updatedAt, + string domain, + string resourceType, + string resourceId, + string status, + string logs, + string renewAt + ) { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Domain = domain; + ResourceType = resourceType; + ResourceId = resourceId; + Status = status; + Logs = logs; + RenewAt = renewAt; + } + + public static ProxyRule From(Dictionary map) => new ProxyRule( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + domain: map["domain"].ToString(), + resourceType: map["resourceType"].ToString(), + resourceId: map["resourceId"].ToString(), + status: map["status"].ToString(), + logs: map["logs"].ToString(), + renewAt: map["renewAt"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "domain", Domain }, + { "resourceType", ResourceType }, + { "resourceId", ResourceId }, + { "status", Status }, + { "logs", Logs }, + { "renewAt", RenewAt } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/ProxyRuleList.cs b/src/Appwrite/Models/ProxyRuleList.cs new file mode 100644 index 0000000..465c237 --- /dev/null +++ b/src/Appwrite/Models/ProxyRuleList.cs @@ -0,0 +1,38 @@ + +using System; +using System.Linq; +using System.Collections.Generic; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Appwrite.Models +{ + public class ProxyRuleList + { + [JsonProperty("total")] + public long Total { get; private set; } + + [JsonProperty("rules")] + public List Rules { get; private set; } + + public ProxyRuleList( + long total, + List rules + ) { + Total = total; + Rules = rules; + } + + public static ProxyRuleList From(Dictionary map) => new ProxyRuleList( + total: Convert.ToInt64(map["total"]), + rules: ((JArray)map["rules"]).ToObject>>().Select(it => ProxyRule.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "rules", Rules.Select(it => it.ToMap()) } + }; + } +} \ No newline at end of file diff --git a/src/Appwrite/Models/User.cs b/src/Appwrite/Models/User.cs index 3e9dc39..c23b72c 100644 --- a/src/Appwrite/Models/User.cs +++ b/src/Appwrite/Models/User.cs @@ -37,6 +37,9 @@ public class User [JsonProperty("status")] public bool Status { get; private set; } + [JsonProperty("labels")] + public List Labels { get; private set; } + [JsonProperty("passwordUpdate")] public string PasswordUpdate { get; private set; } @@ -55,6 +58,9 @@ public class User [JsonProperty("prefs")] public Preferences Prefs { get; private set; } + [JsonProperty("accessedAt")] + public string AccessedAt { get; private set; } + public User( string id, string createdAt, @@ -65,12 +71,14 @@ public User( object? hashOptions, string registration, bool status, + List labels, string passwordUpdate, string email, string phone, bool emailVerification, bool phoneVerification, - Preferences prefs + Preferences prefs, + string accessedAt ) { Id = id; CreatedAt = createdAt; @@ -81,12 +89,14 @@ Preferences prefs HashOptions = hashOptions; Registration = registration; Status = status; + Labels = labels; PasswordUpdate = passwordUpdate; Email = email; Phone = phone; EmailVerification = emailVerification; PhoneVerification = phoneVerification; Prefs = prefs; + AccessedAt = accessedAt; } public static User From(Dictionary map) => new User( @@ -99,12 +109,14 @@ Preferences prefs hashOptions: map["hashOptions"]?.ToString(), registration: map["registration"].ToString(), status: (bool)map["status"], + labels: ((JArray)map["labels"]).ToObject>(), passwordUpdate: map["passwordUpdate"].ToString(), email: map["email"].ToString(), phone: map["phone"].ToString(), emailVerification: (bool)map["emailVerification"], phoneVerification: (bool)map["phoneVerification"], - prefs: Preferences.From(map: ((JObject)map["prefs"]).ToObject>()!) + prefs: Preferences.From(map: ((JObject)map["prefs"]).ToObject>()!), + accessedAt: map["accessedAt"].ToString() ); public Dictionary ToMap() => new Dictionary() @@ -118,12 +130,14 @@ Preferences prefs { "hashOptions", HashOptions }, { "registration", Registration }, { "status", Status }, + { "labels", Labels }, { "passwordUpdate", PasswordUpdate }, { "email", Email }, { "phone", Phone }, { "emailVerification", EmailVerification }, { "phoneVerification", PhoneVerification }, - { "prefs", Prefs.ToMap() } + { "prefs", Prefs.ToMap() }, + { "accessedAt", AccessedAt } }; } } \ No newline at end of file diff --git a/src/Appwrite/Models/Variable.cs b/src/Appwrite/Models/Variable.cs index 2697167..ab0bfe8 100644 --- a/src/Appwrite/Models/Variable.cs +++ b/src/Appwrite/Models/Variable.cs @@ -25,8 +25,11 @@ public class Variable [JsonProperty("value")] public string Value { get; private set; } - [JsonProperty("functionId")] - public string FunctionId { get; private set; } + [JsonProperty("resourceType")] + public string ResourceType { get; private set; } + + [JsonProperty("resourceId")] + public string ResourceId { get; private set; } public Variable( string id, @@ -34,14 +37,16 @@ public Variable( string updatedAt, string key, string xvalue, - string functionId + string resourceType, + string resourceId ) { Id = id; CreatedAt = createdAt; UpdatedAt = updatedAt; Key = key; Value = xvalue; - FunctionId = functionId; + ResourceType = resourceType; + ResourceId = resourceId; } public static Variable From(Dictionary map) => new Variable( @@ -50,7 +55,8 @@ string functionId updatedAt: map["$updatedAt"].ToString(), key: map["key"].ToString(), xvalue: map["value"].ToString(), - functionId: map["functionId"].ToString() + resourceType: map["resourceType"].ToString(), + resourceId: map["resourceId"].ToString() ); public Dictionary ToMap() => new Dictionary() @@ -60,7 +66,8 @@ string functionId { "$updatedAt", UpdatedAt }, { "key", Key }, { "value", Value }, - { "functionId", FunctionId } + { "resourceType", ResourceType }, + { "resourceId", ResourceId } }; } } \ No newline at end of file diff --git a/src/Appwrite/Services/Account.cs b/src/Appwrite/Services/Account.cs index c918102..e188be7 100644 --- a/src/Appwrite/Services/Account.cs +++ b/src/Appwrite/Services/Account.cs @@ -16,12 +16,12 @@ public Account(Client client) : base(client) /// /// Get Account /// - /// Get currently logged in user data as JSON object. + /// Get the currently logged in user. /// /// public Task Get() { - var path = "/account"; + var apiPath = "/account"; var parameters = new Dictionary() { @@ -40,7 +40,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -62,7 +62,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdateEmail(string email, string password) { - var path = "/account/email"; + var apiPath = "/account/email"; var parameters = new Dictionary() { @@ -83,23 +83,90 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } + /// + /// List Identities + /// + /// Get the list of identities for the currently logged in user. + /// + /// + public Task ListIdentities(string? queries = null) + { + var apiPath = "/account/identities"; + + var parameters = new Dictionary() + { + { "queries", queries } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.IdentityList Convert(Dictionary it) => + Models.IdentityList.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete Identity + /// + /// Delete an identity by its unique ID. + /// + /// + public Task DeleteIdentity(string identityId) + { + var apiPath = "/account/identities/{identityId}" + .Replace("{identityId}", identityId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + /// /// List Logs /// - /// Get currently logged in user list of latest security activity logs. Each - /// log returns user IP address, location and date and time of log. + /// Get the list of latest security activity logs for the currently logged in + /// user. Each log returns user IP address, location and date and time of log. /// /// public Task ListLogs(List? queries = null) { - var path = "/account/logs"; + var apiPath = "/account/logs"; var parameters = new Dictionary() { @@ -119,7 +186,7 @@ static Models.LogList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -134,7 +201,7 @@ static Models.LogList Convert(Dictionary it) => /// public Task UpdateName(string name) { - var path = "/account/name"; + var apiPath = "/account/name"; var parameters = new Dictionary() { @@ -154,7 +221,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -171,7 +238,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdatePassword(string password, string? oldPassword = null) { - var path = "/account/password"; + var apiPath = "/account/password"; var parameters = new Dictionary() { @@ -192,7 +259,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -211,7 +278,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdatePhone(string phone, string password) { - var path = "/account/phone"; + var apiPath = "/account/phone"; var parameters = new Dictionary() { @@ -232,7 +299,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -242,12 +309,12 @@ static Models.User Convert(Dictionary it) => /// /// Get Account Preferences /// - /// Get currently logged in user preferences as a key-value object. + /// Get the preferences as a key-value object for the currently logged in user. /// /// public Task GetPrefs() { - var path = "/account/prefs"; + var apiPath = "/account/prefs"; var parameters = new Dictionary() { @@ -266,7 +333,7 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -283,7 +350,7 @@ static Models.Preferences Convert(Dictionary it) => /// public Task UpdatePrefs(object prefs) { - var path = "/account/prefs"; + var apiPath = "/account/prefs"; var parameters = new Dictionary() { @@ -303,7 +370,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -325,7 +392,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateRecovery(string email, string url) { - var path = "/account/recovery"; + var apiPath = "/account/recovery"; var parameters = new Dictionary() { @@ -346,7 +413,7 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -369,7 +436,7 @@ static Models.Token Convert(Dictionary it) => /// public Task UpdateRecovery(string userId, string secret, string password, string passwordAgain) { - var path = "/account/recovery"; + var apiPath = "/account/recovery"; var parameters = new Dictionary() { @@ -392,7 +459,7 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -402,13 +469,13 @@ static Models.Token Convert(Dictionary it) => /// /// List Sessions /// - /// Get currently logged in user list of active sessions across different - /// devices. + /// Get the list of active sessions across different devices for the currently + /// logged in user. /// /// public Task ListSessions() { - var path = "/account/sessions"; + var apiPath = "/account/sessions"; var parameters = new Dictionary() { @@ -427,7 +494,7 @@ static Models.SessionList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -443,7 +510,7 @@ static Models.SessionList Convert(Dictionary it) => /// public Task DeleteSessions() { - var path = "/account/sessions"; + var apiPath = "/account/sessions"; var parameters = new Dictionary() { @@ -460,7 +527,7 @@ public Task DeleteSessions() return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -475,7 +542,7 @@ public Task DeleteSessions() /// public Task GetSession(string sessionId) { - var path = "/account/sessions/{sessionId}" + var apiPath = "/account/sessions/{sessionId}" .Replace("{sessionId}", sessionId); var parameters = new Dictionary() @@ -495,7 +562,7 @@ static Models.Session Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -512,7 +579,7 @@ static Models.Session Convert(Dictionary it) => /// public Task UpdateSession(string sessionId) { - var path = "/account/sessions/{sessionId}" + var apiPath = "/account/sessions/{sessionId}" .Replace("{sessionId}", sessionId); var parameters = new Dictionary() @@ -532,7 +599,7 @@ static Models.Session Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -542,15 +609,15 @@ static Models.Session Convert(Dictionary it) => /// /// Delete Session /// - /// Use this endpoint to log out the currently logged in user from all their - /// account sessions across all of their different devices. When using the - /// Session ID argument, only the unique session ID provided is deleted. - /// + /// Logout the user. Use 'current' as the session ID to logout on this device, + /// use a session ID to logout on another device. If you're looking to logout + /// the user on all devices, use [Delete + /// Sessions](/docs/client/account#accountDeleteSessions) instead. /// /// public Task DeleteSession(string sessionId) { - var path = "/account/sessions/{sessionId}" + var apiPath = "/account/sessions/{sessionId}" .Replace("{sessionId}", sessionId); var parameters = new Dictionary() @@ -568,7 +635,7 @@ public Task DeleteSession(string sessionId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -584,7 +651,7 @@ public Task DeleteSession(string sessionId) /// public Task UpdateStatus() { - var path = "/account/status"; + var apiPath = "/account/status"; var parameters = new Dictionary() { @@ -603,7 +670,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -632,7 +699,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateVerification(string url) { - var path = "/account/verification"; + var apiPath = "/account/verification"; var parameters = new Dictionary() { @@ -652,7 +719,7 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -670,7 +737,7 @@ static Models.Token Convert(Dictionary it) => /// public Task UpdateVerification(string userId, string secret) { - var path = "/account/verification"; + var apiPath = "/account/verification"; var parameters = new Dictionary() { @@ -691,7 +758,7 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -711,7 +778,7 @@ static Models.Token Convert(Dictionary it) => /// public Task CreatePhoneVerification() { - var path = "/account/verification/phone"; + var apiPath = "/account/verification/phone"; var parameters = new Dictionary() { @@ -730,7 +797,7 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -748,7 +815,7 @@ static Models.Token Convert(Dictionary it) => /// public Task UpdatePhoneVerification(string userId, string secret) { - var path = "/account/verification/phone"; + var apiPath = "/account/verification/phone"; var parameters = new Dictionary() { @@ -769,7 +836,7 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); diff --git a/src/Appwrite/Services/Avatars.cs b/src/Appwrite/Services/Avatars.cs index d08528f..3274ac5 100644 --- a/src/Appwrite/Services/Avatars.cs +++ b/src/Appwrite/Services/Avatars.cs @@ -29,7 +29,7 @@ public Avatars(Client client) : base(client) /// public Task GetBrowser(string code, long? width = null, long? height = null, long? quality = null) { - var path = "/avatars/browsers/{code}" + var apiPath = "/avatars/browsers/{code}" .Replace("{code}", code); var parameters = new Dictionary() @@ -47,7 +47,7 @@ public Task GetBrowser(string code, long? width = null, long? height = n return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -68,7 +68,7 @@ public Task GetBrowser(string code, long? width = null, long? height = n /// public Task GetCreditCard(string code, long? width = null, long? height = null, long? quality = null) { - var path = "/avatars/credit-cards/{code}" + var apiPath = "/avatars/credit-cards/{code}" .Replace("{code}", code); var parameters = new Dictionary() @@ -86,7 +86,7 @@ public Task GetCreditCard(string code, long? width = null, long? height return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -101,7 +101,7 @@ public Task GetCreditCard(string code, long? width = null, long? height /// public Task GetFavicon(string url) { - var path = "/avatars/favicon"; + var apiPath = "/avatars/favicon"; var parameters = new Dictionary() { @@ -116,7 +116,7 @@ public Task GetFavicon(string url) return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -138,7 +138,7 @@ public Task GetFavicon(string url) /// public Task GetFlag(string code, long? width = null, long? height = null, long? quality = null) { - var path = "/avatars/flags/{code}" + var apiPath = "/avatars/flags/{code}" .Replace("{code}", code); var parameters = new Dictionary() @@ -156,7 +156,7 @@ public Task GetFlag(string code, long? width = null, long? height = null return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -178,7 +178,7 @@ public Task GetFlag(string code, long? width = null, long? height = null /// public Task GetImage(string url, long? width = null, long? height = null) { - var path = "/avatars/image"; + var apiPath = "/avatars/image"; var parameters = new Dictionary() { @@ -195,7 +195,7 @@ public Task GetImage(string url, long? width = null, long? height = null return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -223,7 +223,7 @@ public Task GetImage(string url, long? width = null, long? height = null /// public Task GetInitials(string? name = null, long? width = null, long? height = null, string? background = null) { - var path = "/avatars/initials"; + var apiPath = "/avatars/initials"; var parameters = new Dictionary() { @@ -241,7 +241,7 @@ public Task GetInitials(string? name = null, long? width = null, long? h return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -256,7 +256,7 @@ public Task GetInitials(string? name = null, long? width = null, long? h /// public Task GetQR(string text, long? size = null, long? margin = null, bool? download = null) { - var path = "/avatars/qr"; + var apiPath = "/avatars/qr"; var parameters = new Dictionary() { @@ -274,7 +274,7 @@ public Task GetQR(string text, long? size = null, long? margin = null, b return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } diff --git a/src/Appwrite/Services/Databases.cs b/src/Appwrite/Services/Databases.cs index f036c71..97cf45e 100644 --- a/src/Appwrite/Services/Databases.cs +++ b/src/Appwrite/Services/Databases.cs @@ -22,7 +22,7 @@ public Databases(Client client) : base(client) /// public Task List(List? queries = null, string? search = null) { - var path = "/databases"; + var apiPath = "/databases"; var parameters = new Dictionary() { @@ -43,7 +43,7 @@ static Models.DatabaseList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -57,14 +57,15 @@ static Models.DatabaseList Convert(Dictionary it) => /// /// /// - public Task Create(string databaseId, string name) + public Task Create(string databaseId, string name, bool? enabled = null) { - var path = "/databases"; + var apiPath = "/databases"; var parameters = new Dictionary() { { "databaseId", databaseId }, - { "name", name } + { "name", name }, + { "enabled", enabled } }; var headers = new Dictionary() @@ -80,7 +81,7 @@ static Models.Database Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -96,7 +97,7 @@ static Models.Database Convert(Dictionary it) => /// public Task Get(string databaseId) { - var path = "/databases/{databaseId}" + var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); var parameters = new Dictionary() @@ -116,7 +117,7 @@ static Models.Database Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -129,14 +130,15 @@ static Models.Database Convert(Dictionary it) => /// Update a database by its unique ID. /// /// - public Task Update(string databaseId, string name) + public Task Update(string databaseId, string name, bool? enabled = null) { - var path = "/databases/{databaseId}" + var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); var parameters = new Dictionary() { - { "name", name } + { "name", name }, + { "enabled", enabled } }; var headers = new Dictionary() @@ -152,7 +154,7 @@ static Models.Database Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -168,7 +170,7 @@ static Models.Database Convert(Dictionary it) => /// public Task Delete(string databaseId) { - var path = "/databases/{databaseId}" + var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); var parameters = new Dictionary() @@ -186,7 +188,7 @@ public Task Delete(string databaseId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -201,7 +203,7 @@ public Task Delete(string databaseId) /// public Task ListCollections(string databaseId, List? queries = null, string? search = null) { - var path = "/databases/{databaseId}/collections" + var apiPath = "/databases/{databaseId}/collections" .Replace("{databaseId}", databaseId); var parameters = new Dictionary() @@ -223,7 +225,7 @@ static Models.CollectionList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -239,9 +241,9 @@ static Models.CollectionList Convert(Dictionary it) => /// directly from your database console. /// /// - public Task CreateCollection(string databaseId, string collectionId, string name, List? permissions = null, bool? documentSecurity = null) + public Task CreateCollection(string databaseId, string collectionId, string name, List? permissions = null, bool? documentSecurity = null, bool? enabled = null) { - var path = "/databases/{databaseId}/collections" + var apiPath = "/databases/{databaseId}/collections" .Replace("{databaseId}", databaseId); var parameters = new Dictionary() @@ -249,7 +251,8 @@ static Models.CollectionList Convert(Dictionary it) => { "collectionId", collectionId }, { "name", name }, { "permissions", permissions }, - { "documentSecurity", documentSecurity } + { "documentSecurity", documentSecurity }, + { "enabled", enabled } }; var headers = new Dictionary() @@ -265,7 +268,7 @@ static Models.Collection Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -281,7 +284,7 @@ static Models.Collection Convert(Dictionary it) => /// public Task GetCollection(string databaseId, string collectionId) { - var path = "/databases/{databaseId}/collections/{collectionId}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -302,7 +305,7 @@ static Models.Collection Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -317,7 +320,7 @@ static Models.Collection Convert(Dictionary it) => /// public Task UpdateCollection(string databaseId, string collectionId, string name, List? permissions = null, bool? documentSecurity = null, bool? enabled = null) { - var path = "/databases/{databaseId}/collections/{collectionId}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -342,7 +345,7 @@ static Models.Collection Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -358,7 +361,7 @@ static Models.Collection Convert(Dictionary it) => /// public Task DeleteCollection(string databaseId, string collectionId) { - var path = "/databases/{databaseId}/collections/{collectionId}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -377,7 +380,7 @@ public Task DeleteCollection(string databaseId, string collectionId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -386,14 +389,15 @@ public Task DeleteCollection(string databaseId, string collectionId) /// /// List Attributes /// - public Task ListAttributes(string databaseId, string collectionId) + public Task ListAttributes(string databaseId, string collectionId, List? queries = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); var parameters = new Dictionary() { + { "queries", queries } }; var headers = new Dictionary() @@ -409,7 +413,7 @@ static Models.AttributeList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -425,7 +429,7 @@ static Models.AttributeList Convert(Dictionary it) => /// public Task CreateBooleanAttribute(string databaseId, string collectionId, string key, bool required, bool? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -450,7 +454,7 @@ static Models.AttributeBoolean Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -462,7 +466,7 @@ static Models.AttributeBoolean Convert(Dictionary it) => /// public Task UpdateBooleanAttribute(string databaseId, string collectionId, string key, bool required, bool xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -486,7 +490,7 @@ static Models.AttributeBoolean Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -498,7 +502,7 @@ static Models.AttributeBoolean Convert(Dictionary it) => /// public Task CreateDatetimeAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -523,7 +527,7 @@ static Models.AttributeDatetime Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -535,7 +539,7 @@ static Models.AttributeDatetime Convert(Dictionary it) => /// public Task UpdateDatetimeAttribute(string databaseId, string collectionId, string key, bool required, string xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -559,7 +563,7 @@ static Models.AttributeDatetime Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -575,7 +579,7 @@ static Models.AttributeDatetime Convert(Dictionary it) => /// public Task CreateEmailAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/email" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/email" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -600,7 +604,7 @@ static Models.AttributeEmail Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -617,7 +621,7 @@ static Models.AttributeEmail Convert(Dictionary it) => /// public Task UpdateEmailAttribute(string databaseId, string collectionId, string key, bool required, string xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -641,7 +645,7 @@ static Models.AttributeEmail Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -653,7 +657,7 @@ static Models.AttributeEmail Convert(Dictionary it) => /// public Task CreateEnumAttribute(string databaseId, string collectionId, string key, List elements, bool required, string? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/enum" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/enum" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -679,7 +683,7 @@ static Models.AttributeEnum Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -696,7 +700,7 @@ static Models.AttributeEnum Convert(Dictionary it) => /// public Task UpdateEnumAttribute(string databaseId, string collectionId, string key, List elements, bool required, string xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -721,7 +725,7 @@ static Models.AttributeEnum Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -738,7 +742,7 @@ static Models.AttributeEnum Convert(Dictionary it) => /// public Task CreateFloatAttribute(string databaseId, string collectionId, string key, bool required, double? min = null, double? max = null, double? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/float" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/float" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -765,7 +769,7 @@ static Models.AttributeFloat Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -782,7 +786,7 @@ static Models.AttributeFloat Convert(Dictionary it) => /// public Task UpdateFloatAttribute(string databaseId, string collectionId, string key, bool required, double min, double max, double xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -808,7 +812,7 @@ static Models.AttributeFloat Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -825,7 +829,7 @@ static Models.AttributeFloat Convert(Dictionary it) => /// public Task CreateIntegerAttribute(string databaseId, string collectionId, string key, bool required, long? min = null, long? max = null, long? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/integer" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/integer" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -852,7 +856,7 @@ static Models.AttributeInteger Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -869,7 +873,7 @@ static Models.AttributeInteger Convert(Dictionary it) => /// public Task UpdateIntegerAttribute(string databaseId, string collectionId, string key, bool required, long min, long max, long xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -895,7 +899,7 @@ static Models.AttributeInteger Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -911,7 +915,7 @@ static Models.AttributeInteger Convert(Dictionary it) => /// public Task CreateIpAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/ip" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/ip" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -936,7 +940,7 @@ static Models.AttributeIp Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -953,7 +957,7 @@ static Models.AttributeIp Convert(Dictionary it) => /// public Task UpdateIpAttribute(string databaseId, string collectionId, string key, bool required, string xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -977,7 +981,7 @@ static Models.AttributeIp Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -994,7 +998,7 @@ static Models.AttributeIp Convert(Dictionary it) => /// public Task CreateRelationshipAttribute(string databaseId, string collectionId, string relatedCollectionId, string type, bool? twoWay = null, string? key = null, string? twoWayKey = null, string? onDelete = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -1021,7 +1025,7 @@ static Models.AttributeRelationship Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1035,9 +1039,9 @@ static Models.AttributeRelationship Convert(Dictionary it) => /// /// /// - public Task CreateStringAttribute(string databaseId, string collectionId, string key, long size, bool required, string? xdefault = null, bool? array = null) + public Task CreateStringAttribute(string databaseId, string collectionId, string key, long size, bool required, string? xdefault = null, bool? array = null, bool? encrypt = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/string" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/string" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -1047,7 +1051,8 @@ static Models.AttributeRelationship Convert(Dictionary it) => { "size", size }, { "required", required }, { "default", xdefault }, - { "array", array } + { "array", array }, + { "encrypt", encrypt } }; var headers = new Dictionary() @@ -1063,7 +1068,7 @@ static Models.AttributeString Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1080,7 +1085,7 @@ static Models.AttributeString Convert(Dictionary it) => /// public Task UpdateStringAttribute(string databaseId, string collectionId, string key, bool required, string xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1104,7 +1109,7 @@ static Models.AttributeString Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1120,7 +1125,7 @@ static Models.AttributeString Convert(Dictionary it) => /// public Task CreateUrlAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/url" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/url" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -1145,7 +1150,7 @@ static Models.AttributeUrl Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1162,7 +1167,7 @@ static Models.AttributeUrl Convert(Dictionary it) => /// public Task UpdateUrlAttribute(string databaseId, string collectionId, string key, bool required, string xdefault) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1186,7 +1191,7 @@ static Models.AttributeUrl Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1198,7 +1203,7 @@ static Models.AttributeUrl Convert(Dictionary it) => /// public Task GetAttribute(string databaseId, string collectionId, string key) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1218,7 +1223,7 @@ public Task GetAttribute(string databaseId, string collectionId, string return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -1229,7 +1234,7 @@ public Task GetAttribute(string databaseId, string collectionId, string /// public Task DeleteAttribute(string databaseId, string collectionId, string key) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1249,7 +1254,7 @@ public Task DeleteAttribute(string databaseId, string collectionId, stri return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -1265,7 +1270,7 @@ public Task DeleteAttribute(string databaseId, string collectionId, stri /// public Task UpdateRelationshipAttribute(string databaseId, string collectionId, string key, string? onDelete = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1288,7 +1293,7 @@ static Models.AttributeRelationship Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1304,7 +1309,7 @@ static Models.AttributeRelationship Convert(Dictionary it) => /// public Task ListDocuments(string databaseId, string collectionId, List? queries = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/documents" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -1326,7 +1331,7 @@ static Models.DocumentList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1344,7 +1349,7 @@ static Models.DocumentList Convert(Dictionary it) => /// public Task CreateDocument(string databaseId, string collectionId, string documentId, object data, List? permissions = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/documents" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -1368,7 +1373,7 @@ static Models.Document Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1384,7 +1389,7 @@ static Models.Document Convert(Dictionary it) => /// public Task GetDocument(string databaseId, string collectionId, string documentId, List? queries = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{documentId}", documentId); @@ -1407,7 +1412,7 @@ static Models.Document Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1423,7 +1428,7 @@ static Models.Document Convert(Dictionary it) => /// public Task UpdateDocument(string databaseId, string collectionId, string documentId, object? data = null, List? permissions = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{documentId}", documentId); @@ -1447,7 +1452,7 @@ static Models.Document Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1462,7 +1467,7 @@ static Models.Document Convert(Dictionary it) => /// public Task DeleteDocument(string databaseId, string collectionId, string documentId) { - var path = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{documentId}", documentId); @@ -1482,7 +1487,7 @@ public Task DeleteDocument(string databaseId, string collectionId, strin return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -1491,14 +1496,15 @@ public Task DeleteDocument(string databaseId, string collectionId, strin /// /// List Indexes /// - public Task ListIndexes(string databaseId, string collectionId) + public Task ListIndexes(string databaseId, string collectionId, List? queries = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/indexes" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); var parameters = new Dictionary() { + { "queries", queries } }; var headers = new Dictionary() @@ -1514,7 +1520,7 @@ static Models.IndexList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1526,7 +1532,7 @@ static Models.IndexList Convert(Dictionary it) => /// public Task CreateIndex(string databaseId, string collectionId, string key, string type, List attributes, List? orders = null) { - var path = "/databases/{databaseId}/collections/{collectionId}/indexes" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); @@ -1551,7 +1557,7 @@ static Models.Index Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1563,7 +1569,7 @@ static Models.Index Convert(Dictionary it) => /// public Task GetIndex(string databaseId, string collectionId, string key) { - var path = "/databases/{databaseId}/collections/{collectionId}/indexes/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1585,7 +1591,7 @@ static Models.Index Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -1597,7 +1603,7 @@ static Models.Index Convert(Dictionary it) => /// public Task DeleteIndex(string databaseId, string collectionId, string key) { - var path = "/databases/{databaseId}/collections/{collectionId}/indexes/{key}" + var apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes/{key}" .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId) .Replace("{key}", key); @@ -1617,7 +1623,7 @@ public Task DeleteIndex(string databaseId, string collectionId, string k return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); diff --git a/src/Appwrite/Services/Functions.cs b/src/Appwrite/Services/Functions.cs index e2f48b0..1681ee8 100644 --- a/src/Appwrite/Services/Functions.cs +++ b/src/Appwrite/Services/Functions.cs @@ -22,7 +22,7 @@ public Functions(Client client) : base(client) /// public Task List(List? queries = null, string? search = null) { - var path = "/functions"; + var apiPath = "/functions"; var parameters = new Dictionary() { @@ -43,7 +43,7 @@ static Models.FunctionList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -58,20 +58,32 @@ static Models.FunctionList Convert(Dictionary it) => /// with access to execute the function using the client API. /// /// - public Task Create(string functionId, string name, string runtime, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null) + public Task Create(string functionId, string name, string runtime, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null, bool? logging = null, string? entrypoint = null, string? commands = null, string? installationId = null, string? providerRepositoryId = null, string? providerBranch = null, bool? providerSilentMode = null, string? providerRootDirectory = null, string? templateRepository = null, string? templateOwner = null, string? templateRootDirectory = null, string? templateBranch = null) { - var path = "/functions"; + var apiPath = "/functions"; var parameters = new Dictionary() { { "functionId", functionId }, { "name", name }, - { "execute", execute }, { "runtime", runtime }, + { "execute", execute }, { "events", events }, { "schedule", schedule }, { "timeout", timeout }, - { "enabled", enabled } + { "enabled", enabled }, + { "logging", logging }, + { "entrypoint", entrypoint }, + { "commands", commands }, + { "installationId", installationId }, + { "providerRepositoryId", providerRepositoryId }, + { "providerBranch", providerBranch }, + { "providerSilentMode", providerSilentMode }, + { "providerRootDirectory", providerRootDirectory }, + { "templateRepository", templateRepository }, + { "templateOwner", templateOwner }, + { "templateRootDirectory", templateRootDirectory }, + { "templateBranch", templateBranch } }; var headers = new Dictionary() @@ -87,7 +99,7 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -102,7 +114,7 @@ static Models.Function Convert(Dictionary it) => /// public Task ListRuntimes() { - var path = "/functions/runtimes"; + var apiPath = "/functions/runtimes"; var parameters = new Dictionary() { @@ -121,7 +133,7 @@ static Models.RuntimeList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -136,7 +148,7 @@ static Models.RuntimeList Convert(Dictionary it) => /// public Task Get(string functionId) { - var path = "/functions/{functionId}" + var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); var parameters = new Dictionary() @@ -156,7 +168,7 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -169,19 +181,28 @@ static Models.Function Convert(Dictionary it) => /// Update function by its unique ID. /// /// - public Task Update(string functionId, string name, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null) + public Task Update(string functionId, string name, string runtime, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null, bool? logging = null, string? entrypoint = null, string? commands = null, string? installationId = null, string? providerRepositoryId = null, string? providerBranch = null, bool? providerSilentMode = null, string? providerRootDirectory = null) { - var path = "/functions/{functionId}" + var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); var parameters = new Dictionary() { { "name", name }, + { "runtime", runtime }, { "execute", execute }, { "events", events }, { "schedule", schedule }, { "timeout", timeout }, - { "enabled", enabled } + { "enabled", enabled }, + { "logging", logging }, + { "entrypoint", entrypoint }, + { "commands", commands }, + { "installationId", installationId }, + { "providerRepositoryId", providerRepositoryId }, + { "providerBranch", providerBranch }, + { "providerSilentMode", providerSilentMode }, + { "providerRootDirectory", providerRootDirectory } }; var headers = new Dictionary() @@ -197,7 +218,7 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -212,7 +233,7 @@ static Models.Function Convert(Dictionary it) => /// public Task Delete(string functionId) { - var path = "/functions/{functionId}" + var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); var parameters = new Dictionary() @@ -230,7 +251,7 @@ public Task Delete(string functionId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -245,7 +266,7 @@ public Task Delete(string functionId) /// public Task ListDeployments(string functionId, List? queries = null, string? search = null) { - var path = "/functions/{functionId}/deployments" + var apiPath = "/functions/{functionId}/deployments" .Replace("{functionId}", functionId); var parameters = new Dictionary() @@ -267,7 +288,7 @@ static Models.DeploymentList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -286,17 +307,18 @@ static Models.DeploymentList Convert(Dictionary it) => /// learn more about code packaging in the [Appwrite Cloud Functions /// tutorial](/docs/functions). /// - /// Use the "command" param to set the entry point used to execute your code. + /// Use the "command" param to set the entrypoint used to execute your code. /// /// - public Task CreateDeployment(string functionId, string entrypoint, InputFile code, bool activate, Action? onProgress = null) + public Task CreateDeployment(string functionId, InputFile code, bool activate, string? entrypoint = null, string? commands = null, Action? onProgress = null) { - var path = "/functions/{functionId}/deployments" + var apiPath = "/functions/{functionId}/deployments" .Replace("{functionId}", functionId); var parameters = new Dictionary() { { "entrypoint", entrypoint }, + { "commands", commands }, { "code", code }, { "activate", activate } }; @@ -316,7 +338,7 @@ static Models.Deployment Convert(Dictionary it) => var paramName = "code"; return _client.ChunkedUpload( - path, + apiPath, headers, parameters, Convert, @@ -333,7 +355,7 @@ static Models.Deployment Convert(Dictionary it) => /// public Task GetDeployment(string functionId, string deploymentId) { - var path = "/functions/{functionId}/deployments/{deploymentId}" + var apiPath = "/functions/{functionId}/deployments/{deploymentId}" .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); @@ -354,7 +376,7 @@ static Models.Deployment Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -371,7 +393,7 @@ static Models.Deployment Convert(Dictionary it) => /// public Task UpdateDeployment(string functionId, string deploymentId) { - var path = "/functions/{functionId}/deployments/{deploymentId}" + var apiPath = "/functions/{functionId}/deployments/{deploymentId}" .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); @@ -392,7 +414,7 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -407,7 +429,7 @@ static Models.Function Convert(Dictionary it) => /// public Task DeleteDeployment(string functionId, string deploymentId) { - var path = "/functions/{functionId}/deployments/{deploymentId}" + var apiPath = "/functions/{functionId}/deployments/{deploymentId}" .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); @@ -426,7 +448,7 @@ public Task DeleteDeployment(string functionId, string deploymentId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -434,10 +456,14 @@ public Task DeleteDeployment(string functionId, string deploymentId) /// /// Create Build + /// + /// Create a new build for an Appwrite Function deployment. This endpoint can + /// be used to retry a failed build. + /// /// public Task CreateBuild(string functionId, string deploymentId, string buildId) { - var path = "/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}" + var apiPath = "/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}" .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId) .Replace("{buildId}", buildId); @@ -457,12 +483,38 @@ public Task CreateBuild(string functionId, string deploymentId, string b return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } + /// + /// Download Deployment + /// + public Task DownloadDeployment(string functionId, string deploymentId) + { + var apiPath = "/functions/{functionId}/deployments/{deploymentId}/download" + .Replace("{functionId}", functionId) + .Replace("{deploymentId}", deploymentId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } + /// /// List Executions /// @@ -472,7 +524,7 @@ public Task CreateBuild(string functionId, string deploymentId, string b /// public Task ListExecutions(string functionId, List? queries = null, string? search = null) { - var path = "/functions/{functionId}/executions" + var apiPath = "/functions/{functionId}/executions" .Replace("{functionId}", functionId); var parameters = new Dictionary() @@ -494,7 +546,7 @@ static Models.ExecutionList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -510,15 +562,18 @@ static Models.ExecutionList Convert(Dictionary it) => /// function execution process will start asynchronously. /// /// - public Task CreateExecution(string functionId, string? data = null, bool? xasync = null) + public Task CreateExecution(string functionId, string? body = null, bool? xasync = null, string? xpath = null, string? method = null, object? headers = null) { - var path = "/functions/{functionId}/executions" + var apiPath = "/functions/{functionId}/executions" .Replace("{functionId}", functionId); var parameters = new Dictionary() { - { "data", data }, - { "async", xasync } + { "body", body }, + { "async", xasync }, + { "path", xpath }, + { "method", method }, + { "headers", headers } }; var headers = new Dictionary() @@ -534,7 +589,7 @@ static Models.Execution Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -549,7 +604,7 @@ static Models.Execution Convert(Dictionary it) => /// public Task GetExecution(string functionId, string executionId) { - var path = "/functions/{functionId}/executions/{executionId}" + var apiPath = "/functions/{functionId}/executions/{executionId}" .Replace("{functionId}", functionId) .Replace("{executionId}", executionId); @@ -570,7 +625,7 @@ static Models.Execution Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -585,7 +640,7 @@ static Models.Execution Convert(Dictionary it) => /// public Task ListVariables(string functionId) { - var path = "/functions/{functionId}/variables" + var apiPath = "/functions/{functionId}/variables" .Replace("{functionId}", functionId); var parameters = new Dictionary() @@ -605,7 +660,7 @@ static Models.VariableList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -615,13 +670,13 @@ static Models.VariableList Convert(Dictionary it) => /// /// Create Variable /// - /// Create a new function variable. These variables can be accessed within - /// function in the `env` object under the request variable. + /// Create a new function environment variable. These variables can be accessed + /// in the function at runtime as environment variables. /// /// public Task CreateVariable(string functionId, string key, string xvalue) { - var path = "/functions/{functionId}/variables" + var apiPath = "/functions/{functionId}/variables" .Replace("{functionId}", functionId); var parameters = new Dictionary() @@ -643,7 +698,7 @@ static Models.Variable Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -658,7 +713,7 @@ static Models.Variable Convert(Dictionary it) => /// public Task GetVariable(string functionId, string variableId) { - var path = "/functions/{functionId}/variables/{variableId}" + var apiPath = "/functions/{functionId}/variables/{variableId}" .Replace("{functionId}", functionId) .Replace("{variableId}", variableId); @@ -679,7 +734,7 @@ static Models.Variable Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -694,7 +749,7 @@ static Models.Variable Convert(Dictionary it) => /// public Task UpdateVariable(string functionId, string variableId, string key, string? xvalue = null) { - var path = "/functions/{functionId}/variables/{variableId}" + var apiPath = "/functions/{functionId}/variables/{variableId}" .Replace("{functionId}", functionId) .Replace("{variableId}", variableId); @@ -717,7 +772,7 @@ static Models.Variable Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -732,7 +787,7 @@ static Models.Variable Convert(Dictionary it) => /// public Task DeleteVariable(string functionId, string variableId) { - var path = "/functions/{functionId}/variables/{variableId}" + var apiPath = "/functions/{functionId}/variables/{variableId}" .Replace("{functionId}", functionId) .Replace("{variableId}", variableId); @@ -751,7 +806,7 @@ public Task DeleteVariable(string functionId, string variableId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); diff --git a/src/Appwrite/Services/Graphql.cs b/src/Appwrite/Services/Graphql.cs index 7d1cc7e..755f08a 100644 --- a/src/Appwrite/Services/Graphql.cs +++ b/src/Appwrite/Services/Graphql.cs @@ -21,7 +21,7 @@ public Graphql(Client client) : base(client) /// public Task Query(object query) { - var path = "/graphql"; + var apiPath = "/graphql"; var parameters = new Dictionary() { @@ -42,7 +42,7 @@ static object Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -57,7 +57,7 @@ static object Convert(Dictionary it) => /// public Task Mutation(object query) { - var path = "/graphql/mutation"; + var apiPath = "/graphql/mutation"; var parameters = new Dictionary() { @@ -78,7 +78,7 @@ static object Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); diff --git a/src/Appwrite/Services/Health.cs b/src/Appwrite/Services/Health.cs index ec0e0e1..0fb27d0 100644 --- a/src/Appwrite/Services/Health.cs +++ b/src/Appwrite/Services/Health.cs @@ -21,7 +21,7 @@ public Health(Client client) : base(client) /// public Task Get() { - var path = "/health"; + var apiPath = "/health"; var parameters = new Dictionary() { @@ -40,7 +40,7 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -55,7 +55,7 @@ static Models.HealthStatus Convert(Dictionary it) => /// public Task GetAntivirus() { - var path = "/health/anti-virus"; + var apiPath = "/health/anti-virus"; var parameters = new Dictionary() { @@ -74,7 +74,7 @@ static Models.HealthAntivirus Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -84,13 +84,13 @@ static Models.HealthAntivirus Convert(Dictionary it) => /// /// Get Cache /// - /// Check the Appwrite in-memory cache server is up and connection is + /// Check the Appwrite in-memory cache servers are up and connection is /// successful. /// /// public Task GetCache() { - var path = "/health/cache"; + var apiPath = "/health/cache"; var parameters = new Dictionary() { @@ -109,7 +109,7 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -119,12 +119,12 @@ static Models.HealthStatus Convert(Dictionary it) => /// /// Get DB /// - /// Check the Appwrite database server is up and connection is successful. + /// Check the Appwrite database servers are up and connection is successful. /// /// public Task GetDB() { - var path = "/health/db"; + var apiPath = "/health/db"; var parameters = new Dictionary() { @@ -143,7 +143,76 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get PubSub + /// + /// Check the Appwrite pub-sub servers are up and connection is successful. + /// + /// + public Task GetPubSub() + { + var apiPath = "/health/pubsub"; + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.HealthStatus Convert(Dictionary it) => + Models.HealthStatus.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get Queue + /// + /// Check the Appwrite queue messaging servers are up and connection is + /// successful. + /// + /// + public Task GetQueue() + { + var apiPath = "/health/queue"; + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.HealthStatus Convert(Dictionary it) => + Models.HealthStatus.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -160,7 +229,7 @@ static Models.HealthStatus Convert(Dictionary it) => /// public Task GetQueueCertificates() { - var path = "/health/queue/certificates"; + var apiPath = "/health/queue/certificates"; var parameters = new Dictionary() { @@ -179,7 +248,7 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -191,7 +260,7 @@ static Models.HealthQueue Convert(Dictionary it) => /// public Task GetQueueFunctions() { - var path = "/health/queue/functions"; + var apiPath = "/health/queue/functions"; var parameters = new Dictionary() { @@ -210,7 +279,7 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -226,7 +295,7 @@ static Models.HealthQueue Convert(Dictionary it) => /// public Task GetQueueLogs() { - var path = "/health/queue/logs"; + var apiPath = "/health/queue/logs"; var parameters = new Dictionary() { @@ -245,7 +314,7 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -261,7 +330,7 @@ static Models.HealthQueue Convert(Dictionary it) => /// public Task GetQueueWebhooks() { - var path = "/health/queue/webhooks"; + var apiPath = "/health/queue/webhooks"; var parameters = new Dictionary() { @@ -280,7 +349,7 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -295,7 +364,7 @@ static Models.HealthQueue Convert(Dictionary it) => /// public Task GetStorageLocal() { - var path = "/health/storage/local"; + var apiPath = "/health/storage/local"; var parameters = new Dictionary() { @@ -314,7 +383,7 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -335,7 +404,7 @@ static Models.HealthStatus Convert(Dictionary it) => /// public Task GetTime() { - var path = "/health/time"; + var apiPath = "/health/time"; var parameters = new Dictionary() { @@ -354,7 +423,7 @@ static Models.HealthTime Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); diff --git a/src/Appwrite/Services/Locale.cs b/src/Appwrite/Services/Locale.cs index 73f91ae..849ea68 100644 --- a/src/Appwrite/Services/Locale.cs +++ b/src/Appwrite/Services/Locale.cs @@ -26,7 +26,7 @@ public Locale(Client client) : base(client) /// public Task Get() { - var path = "/locale"; + var apiPath = "/locale"; var parameters = new Dictionary() { @@ -45,7 +45,42 @@ static Models.Locale Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List Locale Codes + /// + /// List of all locale codes in [ISO + /// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + /// + /// + public Task ListCodes() + { + var apiPath = "/locale/codes"; + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.LocaleCodeList Convert(Dictionary it) => + Models.LocaleCodeList.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -61,7 +96,7 @@ static Models.Locale Convert(Dictionary it) => /// public Task ListContinents() { - var path = "/locale/continents"; + var apiPath = "/locale/continents"; var parameters = new Dictionary() { @@ -80,7 +115,7 @@ static Models.ContinentList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -96,7 +131,7 @@ static Models.ContinentList Convert(Dictionary it) => /// public Task ListCountries() { - var path = "/locale/countries"; + var apiPath = "/locale/countries"; var parameters = new Dictionary() { @@ -115,7 +150,7 @@ static Models.CountryList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -131,7 +166,7 @@ static Models.CountryList Convert(Dictionary it) => /// public Task ListCountriesEU() { - var path = "/locale/countries/eu"; + var apiPath = "/locale/countries/eu"; var parameters = new Dictionary() { @@ -150,7 +185,7 @@ static Models.CountryList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -166,7 +201,7 @@ static Models.CountryList Convert(Dictionary it) => /// public Task ListCountriesPhones() { - var path = "/locale/countries/phones"; + var apiPath = "/locale/countries/phones"; var parameters = new Dictionary() { @@ -185,7 +220,7 @@ static Models.PhoneList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -202,7 +237,7 @@ static Models.PhoneList Convert(Dictionary it) => /// public Task ListCurrencies() { - var path = "/locale/currencies"; + var apiPath = "/locale/currencies"; var parameters = new Dictionary() { @@ -221,7 +256,7 @@ static Models.CurrencyList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -237,7 +272,7 @@ static Models.CurrencyList Convert(Dictionary it) => /// public Task ListLanguages() { - var path = "/locale/languages"; + var apiPath = "/locale/languages"; var parameters = new Dictionary() { @@ -256,7 +291,7 @@ static Models.LanguageList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); diff --git a/src/Appwrite/Services/Project.cs b/src/Appwrite/Services/Project.cs new file mode 100644 index 0000000..44cfb1c --- /dev/null +++ b/src/Appwrite/Services/Project.cs @@ -0,0 +1,194 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Appwrite.Models; + +namespace Appwrite.Services +{ + public class Project : Service + { + public Project(Client client) : base(client) + { + } + + /// + /// List Variables + /// + /// Get a list of all project variables. These variables will be accessible in + /// all Appwrite Functions at runtime. + /// + /// + public Task ListVariables() + { + var apiPath = "/project/variables"; + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.VariableList Convert(Dictionary it) => + Models.VariableList.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Create Variable + /// + /// Create a new project variable. This variable will be accessible in all + /// Appwrite Functions at runtime. + /// + /// + public Task CreateVariable(string key, string xvalue) + { + var apiPath = "/project/variables"; + + var parameters = new Dictionary() + { + { "key", key }, + { "value", xvalue } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.Variable Convert(Dictionary it) => + Models.Variable.From(map: it); + + + return _client.Call( + method: "POST", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get Variable + /// + /// Get a project variable by its unique ID. + /// + /// + public Task GetVariable(string variableId) + { + var apiPath = "/project/variables/{variableId}" + .Replace("{variableId}", variableId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.Variable Convert(Dictionary it) => + Models.Variable.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Update Variable + /// + /// Update project variable by its unique ID. This variable will be accessible + /// in all Appwrite Functions at runtime. + /// + /// + public Task UpdateVariable(string variableId, string key, string? xvalue = null) + { + var apiPath = "/project/variables/{variableId}" + .Replace("{variableId}", variableId); + + var parameters = new Dictionary() + { + { "key", key }, + { "value", xvalue } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.Variable Convert(Dictionary it) => + Models.Variable.From(map: it); + + + return _client.Call( + method: "PUT", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete Variable + /// + /// Delete a project variable by its unique ID. + /// + /// + public Task DeleteVariable(string variableId) + { + var apiPath = "/project/variables/{variableId}" + .Replace("{variableId}", variableId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + } +} diff --git a/src/Appwrite/Services/Proxy.cs b/src/Appwrite/Services/Proxy.cs new file mode 100644 index 0000000..e79b37f --- /dev/null +++ b/src/Appwrite/Services/Proxy.cs @@ -0,0 +1,190 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Appwrite.Models; + +namespace Appwrite.Services +{ + public class Proxy : Service + { + public Proxy(Client client) : base(client) + { + } + + /// + /// List Rules + /// + /// Get a list of all the proxy rules. You can use the query params to filter + /// your results. + /// + /// + public Task ListRules(List? queries = null, string? search = null) + { + var apiPath = "/proxy/rules"; + + var parameters = new Dictionary() + { + { "queries", queries }, + { "search", search } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.ProxyRuleList Convert(Dictionary it) => + Models.ProxyRuleList.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Create Rule + /// + /// Create a new proxy rule. + /// + /// + public Task CreateRule(string domain, string resourceType, string? resourceId = null) + { + var apiPath = "/proxy/rules"; + + var parameters = new Dictionary() + { + { "domain", domain }, + { "resourceType", resourceType }, + { "resourceId", resourceId } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.ProxyRule Convert(Dictionary it) => + Models.ProxyRule.From(map: it); + + + return _client.Call( + method: "POST", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get Rule + /// + /// Get a proxy rule by its unique ID. + /// + /// + public Task GetRule(string ruleId) + { + var apiPath = "/proxy/rules/{ruleId}" + .Replace("{ruleId}", ruleId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.ProxyRule Convert(Dictionary it) => + Models.ProxyRule.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete Rule + /// + /// Delete a proxy rule by its unique ID. + /// + /// + public Task DeleteRule(string ruleId) + { + var apiPath = "/proxy/rules/{ruleId}" + .Replace("{ruleId}", ruleId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// Update Rule Verification Status + /// + public Task UpdateRuleVerification(string ruleId) + { + var apiPath = "/proxy/rules/{ruleId}/verification" + .Replace("{ruleId}", ruleId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.ProxyRule Convert(Dictionary it) => + Models.ProxyRule.From(map: it); + + + return _client.Call( + method: "PATCH", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + } +} diff --git a/src/Appwrite/Services/Storage.cs b/src/Appwrite/Services/Storage.cs index 605476e..bad792c 100644 --- a/src/Appwrite/Services/Storage.cs +++ b/src/Appwrite/Services/Storage.cs @@ -22,7 +22,7 @@ public Storage(Client client) : base(client) /// public Task ListBuckets(List? queries = null, string? search = null) { - var path = "/storage/buckets"; + var apiPath = "/storage/buckets"; var parameters = new Dictionary() { @@ -43,7 +43,7 @@ static Models.BucketList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -58,7 +58,7 @@ static Models.BucketList Convert(Dictionary it) => /// public Task CreateBucket(string bucketId, string name, List? permissions = null, bool? fileSecurity = null, bool? enabled = null, long? maximumFileSize = null, List? allowedFileExtensions = null, string? compression = null, bool? encryption = null, bool? antivirus = null) { - var path = "/storage/buckets"; + var apiPath = "/storage/buckets"; var parameters = new Dictionary() { @@ -87,7 +87,7 @@ static Models.Bucket Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -103,7 +103,7 @@ static Models.Bucket Convert(Dictionary it) => /// public Task GetBucket(string bucketId) { - var path = "/storage/buckets/{bucketId}" + var apiPath = "/storage/buckets/{bucketId}" .Replace("{bucketId}", bucketId); var parameters = new Dictionary() @@ -123,7 +123,7 @@ static Models.Bucket Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -138,7 +138,7 @@ static Models.Bucket Convert(Dictionary it) => /// public Task UpdateBucket(string bucketId, string name, List? permissions = null, bool? fileSecurity = null, bool? enabled = null, long? maximumFileSize = null, List? allowedFileExtensions = null, string? compression = null, bool? encryption = null, bool? antivirus = null) { - var path = "/storage/buckets/{bucketId}" + var apiPath = "/storage/buckets/{bucketId}" .Replace("{bucketId}", bucketId); var parameters = new Dictionary() @@ -167,7 +167,7 @@ static Models.Bucket Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -182,7 +182,7 @@ static Models.Bucket Convert(Dictionary it) => /// public Task DeleteBucket(string bucketId) { - var path = "/storage/buckets/{bucketId}" + var apiPath = "/storage/buckets/{bucketId}" .Replace("{bucketId}", bucketId); var parameters = new Dictionary() @@ -200,7 +200,7 @@ public Task DeleteBucket(string bucketId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -215,7 +215,7 @@ public Task DeleteBucket(string bucketId) /// public Task ListFiles(string bucketId, List? queries = null, string? search = null) { - var path = "/storage/buckets/{bucketId}/files" + var apiPath = "/storage/buckets/{bucketId}/files" .Replace("{bucketId}", bucketId); var parameters = new Dictionary() @@ -237,7 +237,7 @@ static Models.FileList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -269,7 +269,7 @@ static Models.FileList Convert(Dictionary it) => /// public Task CreateFile(string bucketId, string fileId, InputFile file, List? permissions = null, Action? onProgress = null) { - var path = "/storage/buckets/{bucketId}/files" + var apiPath = "/storage/buckets/{bucketId}/files" .Replace("{bucketId}", bucketId); var parameters = new Dictionary() @@ -294,7 +294,7 @@ static Models.File Convert(Dictionary it) => var paramName = "file"; return _client.ChunkedUpload( - path, + apiPath, headers, parameters, Convert, @@ -312,7 +312,7 @@ static Models.File Convert(Dictionary it) => /// public Task GetFile(string bucketId, string fileId) { - var path = "/storage/buckets/{bucketId}/files/{fileId}" + var apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); @@ -333,7 +333,7 @@ static Models.File Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -347,14 +347,15 @@ static Models.File Convert(Dictionary it) => /// access to update this resource. /// /// - public Task UpdateFile(string bucketId, string fileId, List? permissions = null) + public Task UpdateFile(string bucketId, string fileId, string? name = null, List? permissions = null) { - var path = "/storage/buckets/{bucketId}/files/{fileId}" + var apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); var parameters = new Dictionary() { + { "name", name }, { "permissions", permissions } }; @@ -371,7 +372,7 @@ static Models.File Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -387,7 +388,7 @@ static Models.File Convert(Dictionary it) => /// public Task DeleteFile(string bucketId, string fileId) { - var path = "/storage/buckets/{bucketId}/files/{fileId}" + var apiPath = "/storage/buckets/{bucketId}/files/{fileId}" .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); @@ -406,7 +407,7 @@ public Task DeleteFile(string bucketId, string fileId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -422,7 +423,7 @@ public Task DeleteFile(string bucketId, string fileId) /// public Task GetFileDownload(string bucketId, string fileId) { - var path = "/storage/buckets/{bucketId}/files/{fileId}/download" + var apiPath = "/storage/buckets/{bucketId}/files/{fileId}/download" .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); @@ -438,7 +439,7 @@ public Task GetFileDownload(string bucketId, string fileId) return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -455,7 +456,7 @@ public Task GetFileDownload(string bucketId, string fileId) /// public Task GetFilePreview(string bucketId, string fileId, long? width = null, long? height = null, string? gravity = null, long? quality = null, long? borderWidth = null, string? borderColor = null, long? borderRadius = null, double? opacity = null, long? rotation = null, string? background = null, string? output = null) { - var path = "/storage/buckets/{bucketId}/files/{fileId}/preview" + var apiPath = "/storage/buckets/{bucketId}/files/{fileId}/preview" .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); @@ -482,7 +483,7 @@ public Task GetFilePreview(string bucketId, string fileId, long? width = return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -497,7 +498,7 @@ public Task GetFilePreview(string bucketId, string fileId, long? width = /// public Task GetFileView(string bucketId, string fileId) { - var path = "/storage/buckets/{bucketId}/files/{fileId}/view" + var apiPath = "/storage/buckets/{bucketId}/files/{fileId}/view" .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); @@ -513,7 +514,7 @@ public Task GetFileView(string bucketId, string fileId) return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } diff --git a/src/Appwrite/Services/Teams.cs b/src/Appwrite/Services/Teams.cs index 06d7dda..8d90af2 100644 --- a/src/Appwrite/Services/Teams.cs +++ b/src/Appwrite/Services/Teams.cs @@ -22,7 +22,7 @@ public Teams(Client client) : base(client) /// public Task List(List? queries = null, string? search = null) { - var path = "/teams"; + var apiPath = "/teams"; var parameters = new Dictionary() { @@ -43,7 +43,7 @@ static Models.TeamList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -60,7 +60,7 @@ static Models.TeamList Convert(Dictionary it) => /// public Task Create(string teamId, string name, List? roles = null) { - var path = "/teams"; + var apiPath = "/teams"; var parameters = new Dictionary() { @@ -82,7 +82,7 @@ static Models.Team Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -97,7 +97,7 @@ static Models.Team Convert(Dictionary it) => /// public Task Get(string teamId) { - var path = "/teams/{teamId}" + var apiPath = "/teams/{teamId}" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -117,7 +117,7 @@ static Models.Team Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -132,7 +132,7 @@ static Models.Team Convert(Dictionary it) => /// public Task UpdateName(string teamId, string name) { - var path = "/teams/{teamId}" + var apiPath = "/teams/{teamId}" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -153,7 +153,7 @@ static Models.Team Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -169,7 +169,7 @@ static Models.Team Convert(Dictionary it) => /// public Task Delete(string teamId) { - var path = "/teams/{teamId}" + var apiPath = "/teams/{teamId}" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -187,7 +187,7 @@ public Task Delete(string teamId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -202,7 +202,7 @@ public Task Delete(string teamId) /// public Task ListMemberships(string teamId, List? queries = null, string? search = null) { - var path = "/teams/{teamId}/memberships" + var apiPath = "/teams/{teamId}/memberships" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -224,7 +224,7 @@ static Models.MembershipList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -259,7 +259,7 @@ static Models.MembershipList Convert(Dictionary it) => /// public Task CreateMembership(string teamId, List roles, string url, string? email = null, string? userId = null, string? phone = null, string? name = null) { - var path = "/teams/{teamId}/memberships" + var apiPath = "/teams/{teamId}/memberships" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -285,7 +285,7 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -301,7 +301,7 @@ static Models.Membership Convert(Dictionary it) => /// public Task GetMembership(string teamId, string membershipId) { - var path = "/teams/{teamId}/memberships/{membershipId}" + var apiPath = "/teams/{teamId}/memberships/{membershipId}" .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); @@ -322,7 +322,7 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -330,16 +330,17 @@ static Models.Membership Convert(Dictionary it) => } /// - /// Update Membership Roles + /// Update Membership /// /// Modify the roles of a team member. Only team members with the owner role /// have access to this endpoint. Learn more about [roles and /// permissions](/docs/permissions). + /// /// /// - public Task UpdateMembershipRoles(string teamId, string membershipId, List roles) + public Task UpdateMembership(string teamId, string membershipId, List roles) { - var path = "/teams/{teamId}/memberships/{membershipId}" + var apiPath = "/teams/{teamId}/memberships/{membershipId}" .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); @@ -361,7 +362,7 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -378,7 +379,7 @@ static Models.Membership Convert(Dictionary it) => /// public Task DeleteMembership(string teamId, string membershipId) { - var path = "/teams/{teamId}/memberships/{membershipId}" + var apiPath = "/teams/{teamId}/memberships/{membershipId}" .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); @@ -397,7 +398,7 @@ public Task DeleteMembership(string teamId, string membershipId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -417,7 +418,7 @@ public Task DeleteMembership(string teamId, string membershipId) /// public Task UpdateMembershipStatus(string teamId, string membershipId, string userId, string secret) { - var path = "/teams/{teamId}/memberships/{membershipId}/status" + var apiPath = "/teams/{teamId}/memberships/{membershipId}/status" .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); @@ -440,7 +441,7 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -457,7 +458,7 @@ static Models.Membership Convert(Dictionary it) => /// public Task GetPrefs(string teamId) { - var path = "/teams/{teamId}/prefs" + var apiPath = "/teams/{teamId}/prefs" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -477,7 +478,7 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -494,7 +495,7 @@ static Models.Preferences Convert(Dictionary it) => /// public Task UpdatePrefs(string teamId, object prefs) { - var path = "/teams/{teamId}/prefs" + var apiPath = "/teams/{teamId}/prefs" .Replace("{teamId}", teamId); var parameters = new Dictionary() @@ -515,7 +516,7 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "PUT", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); diff --git a/src/Appwrite/Services/Users.cs b/src/Appwrite/Services/Users.cs index 1b1f057..2708f23 100644 --- a/src/Appwrite/Services/Users.cs +++ b/src/Appwrite/Services/Users.cs @@ -22,7 +22,7 @@ public Users(Client client) : base(client) /// public Task List(List? queries = null, string? search = null) { - var path = "/users"; + var apiPath = "/users"; var parameters = new Dictionary() { @@ -43,7 +43,7 @@ static Models.UserList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -58,7 +58,7 @@ static Models.UserList Convert(Dictionary it) => /// public Task Create(string userId, string? email = null, string? phone = null, string? password = null, string? name = null) { - var path = "/users"; + var apiPath = "/users"; var parameters = new Dictionary() { @@ -82,7 +82,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -100,7 +100,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateArgon2User(string userId, string email, string password, string? name = null) { - var path = "/users/argon2"; + var apiPath = "/users/argon2"; var parameters = new Dictionary() { @@ -123,7 +123,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -141,7 +141,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateBcryptUser(string userId, string email, string password, string? name = null) { - var path = "/users/bcrypt"; + var apiPath = "/users/bcrypt"; var parameters = new Dictionary() { @@ -164,13 +164,81 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } + /// + /// List Identities + /// + /// Get identities for all users. + /// + /// + public Task ListIdentities(string? queries = null, string? search = null) + { + var apiPath = "/users/identities"; + + var parameters = new Dictionary() + { + { "queries", queries }, + { "search", search } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.IdentityList Convert(Dictionary it) => + Models.IdentityList.From(map: it); + + + return _client.Call( + method: "GET", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete Identity + /// + /// Delete an identity by its unique ID. + /// + /// + public Task DeleteIdentity(string identityId) + { + var apiPath = "/users/identities/{identityId}" + .Replace("{identityId}", identityId); + + var parameters = new Dictionary() + { + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + /// /// Create User with MD5 Password /// @@ -182,7 +250,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateMD5User(string userId, string email, string password, string? name = null) { - var path = "/users/md5"; + var apiPath = "/users/md5"; var parameters = new Dictionary() { @@ -205,7 +273,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -223,7 +291,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreatePHPassUser(string userId, string email, string password, string? name = null) { - var path = "/users/phpass"; + var apiPath = "/users/phpass"; var parameters = new Dictionary() { @@ -246,7 +314,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -264,7 +332,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateScryptUser(string userId, string email, string password, string passwordSalt, long passwordCpu, long passwordMemory, long passwordParallel, long passwordLength, string? name = null) { - var path = "/users/scrypt"; + var apiPath = "/users/scrypt"; var parameters = new Dictionary() { @@ -292,7 +360,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -310,7 +378,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateScryptModifiedUser(string userId, string email, string password, string passwordSalt, string passwordSaltSeparator, string passwordSignerKey, string? name = null) { - var path = "/users/scrypt-modified"; + var apiPath = "/users/scrypt-modified"; var parameters = new Dictionary() { @@ -336,7 +404,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -354,7 +422,7 @@ static Models.User Convert(Dictionary it) => /// public Task CreateSHAUser(string userId, string email, string password, string? passwordVersion = null, string? name = null) { - var path = "/users/sha"; + var apiPath = "/users/sha"; var parameters = new Dictionary() { @@ -378,7 +446,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -393,7 +461,7 @@ static Models.User Convert(Dictionary it) => /// public Task Get(string userId) { - var path = "/users/{userId}" + var apiPath = "/users/{userId}" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -413,7 +481,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -432,7 +500,7 @@ static Models.User Convert(Dictionary it) => /// public Task Delete(string userId) { - var path = "/users/{userId}" + var apiPath = "/users/{userId}" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -450,7 +518,7 @@ public Task Delete(string userId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -464,7 +532,7 @@ public Task Delete(string userId) /// public Task UpdateEmail(string userId, string email) { - var path = "/users/{userId}/email" + var apiPath = "/users/{userId}/email" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -485,7 +553,48 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, + headers: headers, + parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Update User Labels + /// + /// Update the user labels by its unique ID. + /// + /// Labels can be used to grant access to resources. While teams are a way for + /// user's to share access to a resource, labels can be defined by the + /// developer to grant access without an invitation. See the [Permissions + /// docs](/docs/permissions) for more info. + /// + /// + public Task UpdateLabels(string userId, List labels) + { + var apiPath = "/users/{userId}/labels" + .Replace("{userId}", userId); + + var parameters = new Dictionary() + { + { "labels", labels } + }; + + var headers = new Dictionary() + { + { "content-type", "application/json" } + }; + + + + static Models.User Convert(Dictionary it) => + Models.User.From(map: it); + + + return _client.Call( + method: "PUT", + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -500,7 +609,7 @@ static Models.User Convert(Dictionary it) => /// public Task ListLogs(string userId, List? queries = null) { - var path = "/users/{userId}/logs" + var apiPath = "/users/{userId}/logs" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -521,7 +630,7 @@ static Models.LogList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -536,7 +645,7 @@ static Models.LogList Convert(Dictionary it) => /// public Task ListMemberships(string userId) { - var path = "/users/{userId}/memberships" + var apiPath = "/users/{userId}/memberships" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -556,7 +665,7 @@ static Models.MembershipList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -571,7 +680,7 @@ static Models.MembershipList Convert(Dictionary it) => /// public Task UpdateName(string userId, string name) { - var path = "/users/{userId}/name" + var apiPath = "/users/{userId}/name" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -592,7 +701,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -607,7 +716,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdatePassword(string userId, string password) { - var path = "/users/{userId}/password" + var apiPath = "/users/{userId}/password" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -628,7 +737,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -643,7 +752,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdatePhone(string userId, string number) { - var path = "/users/{userId}/phone" + var apiPath = "/users/{userId}/phone" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -664,7 +773,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -679,7 +788,7 @@ static Models.User Convert(Dictionary it) => /// public Task GetPrefs(string userId) { - var path = "/users/{userId}/prefs" + var apiPath = "/users/{userId}/prefs" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -699,7 +808,7 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -716,7 +825,7 @@ static Models.Preferences Convert(Dictionary it) => /// public Task UpdatePrefs(string userId, object prefs) { - var path = "/users/{userId}/prefs" + var apiPath = "/users/{userId}/prefs" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -737,7 +846,7 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -752,7 +861,7 @@ static Models.Preferences Convert(Dictionary it) => /// public Task ListSessions(string userId) { - var path = "/users/{userId}/sessions" + var apiPath = "/users/{userId}/sessions" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -772,7 +881,7 @@ static Models.SessionList Convert(Dictionary it) => return _client.Call( method: "GET", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -787,7 +896,7 @@ static Models.SessionList Convert(Dictionary it) => /// public Task DeleteSessions(string userId) { - var path = "/users/{userId}/sessions" + var apiPath = "/users/{userId}/sessions" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -805,7 +914,7 @@ public Task DeleteSessions(string userId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -819,7 +928,7 @@ public Task DeleteSessions(string userId) /// public Task DeleteSession(string userId, string sessionId) { - var path = "/users/{userId}/sessions/{sessionId}" + var apiPath = "/users/{userId}/sessions/{sessionId}" .Replace("{userId}", userId) .Replace("{sessionId}", sessionId); @@ -838,7 +947,7 @@ public Task DeleteSession(string userId, string sessionId) return _client.Call( method: "DELETE", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); @@ -853,7 +962,7 @@ public Task DeleteSession(string userId, string sessionId) /// public Task UpdateStatus(string userId, bool status) { - var path = "/users/{userId}/status" + var apiPath = "/users/{userId}/status" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -874,7 +983,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -889,7 +998,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdateEmailVerification(string userId, bool emailVerification) { - var path = "/users/{userId}/verification" + var apiPath = "/users/{userId}/verification" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -910,7 +1019,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); @@ -925,7 +1034,7 @@ static Models.User Convert(Dictionary it) => /// public Task UpdatePhoneVerification(string userId, bool phoneVerification) { - var path = "/users/{userId}/verification/phone" + var apiPath = "/users/{userId}/verification/phone" .Replace("{userId}", userId); var parameters = new Dictionary() @@ -946,7 +1055,7 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", - path: path, + path: apiPath, headers: headers, parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); From 9f56dfc6da3b3011b57b964592c50faf850262f3 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 30 Aug 2023 13:27:15 +0200 Subject: [PATCH 2/3] feat: release 1.4.x --- docs/examples/project/create-variable.md | 14 -- docs/examples/project/delete-variable.md | 13 -- docs/examples/project/get-variable.md | 13 -- docs/examples/project/list-variables.md | 12 -- docs/examples/project/update-variable.md | 14 -- docs/examples/proxy/create-rule.md | 14 -- docs/examples/proxy/delete-rule.md | 13 -- docs/examples/proxy/get-rule.md | 13 -- docs/examples/proxy/list-rules.md | 12 -- .../proxy/update-rule-verification.md | 13 -- src/Appwrite/Models/ProxyRule.cs | 87 -------- src/Appwrite/Models/ProxyRuleList.cs | 38 ---- src/Appwrite/Services/Project.cs | 194 ------------------ src/Appwrite/Services/Proxy.cs | 190 ----------------- 14 files changed, 640 deletions(-) delete mode 100644 docs/examples/project/create-variable.md delete mode 100644 docs/examples/project/delete-variable.md delete mode 100644 docs/examples/project/get-variable.md delete mode 100644 docs/examples/project/list-variables.md delete mode 100644 docs/examples/project/update-variable.md delete mode 100644 docs/examples/proxy/create-rule.md delete mode 100644 docs/examples/proxy/delete-rule.md delete mode 100644 docs/examples/proxy/get-rule.md delete mode 100644 docs/examples/proxy/list-rules.md delete mode 100644 docs/examples/proxy/update-rule-verification.md delete mode 100644 src/Appwrite/Models/ProxyRule.cs delete mode 100644 src/Appwrite/Models/ProxyRuleList.cs delete mode 100644 src/Appwrite/Services/Project.cs delete mode 100644 src/Appwrite/Services/Proxy.cs diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md deleted file mode 100644 index 3134c9b..0000000 --- a/docs/examples/project/create-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var project = new Project(client); - -Variable result = await project.CreateVariable( - key: "[KEY]", - value: "[VALUE]"); \ No newline at end of file diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md deleted file mode 100644 index 5d075ef..0000000 --- a/docs/examples/project/delete-variable.md +++ /dev/null @@ -1,13 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var project = new Project(client); - -await project.DeleteVariable( - variableId: "[VARIABLE_ID]"); \ No newline at end of file diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md deleted file mode 100644 index e2214dc..0000000 --- a/docs/examples/project/get-variable.md +++ /dev/null @@ -1,13 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var project = new Project(client); - -Variable result = await project.GetVariable( - variableId: "[VARIABLE_ID]"); \ No newline at end of file diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md deleted file mode 100644 index 4ab2a38..0000000 --- a/docs/examples/project/list-variables.md +++ /dev/null @@ -1,12 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var project = new Project(client); - -VariableList result = await project.ListVariables(); \ No newline at end of file diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md deleted file mode 100644 index a0011c4..0000000 --- a/docs/examples/project/update-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var project = new Project(client); - -Variable result = await project.UpdateVariable( - variableId: "[VARIABLE_ID]", - key: "[KEY]"); \ No newline at end of file diff --git a/docs/examples/proxy/create-rule.md b/docs/examples/proxy/create-rule.md deleted file mode 100644 index be0d116..0000000 --- a/docs/examples/proxy/create-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var proxy = new Proxy(client); - -ProxyRule result = await proxy.CreateRule( - domain: "", - resourceType: "api"); \ No newline at end of file diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md deleted file mode 100644 index 20e9151..0000000 --- a/docs/examples/proxy/delete-rule.md +++ /dev/null @@ -1,13 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var proxy = new Proxy(client); - -await proxy.DeleteRule( - ruleId: "[RULE_ID]"); \ No newline at end of file diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md deleted file mode 100644 index 29c97a6..0000000 --- a/docs/examples/proxy/get-rule.md +++ /dev/null @@ -1,13 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var proxy = new Proxy(client); - -ProxyRule result = await proxy.GetRule( - ruleId: "[RULE_ID]"); \ No newline at end of file diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md deleted file mode 100644 index 227f334..0000000 --- a/docs/examples/proxy/list-rules.md +++ /dev/null @@ -1,12 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var proxy = new Proxy(client); - -ProxyRuleList result = await proxy.ListRules(); \ No newline at end of file diff --git a/docs/examples/proxy/update-rule-verification.md b/docs/examples/proxy/update-rule-verification.md deleted file mode 100644 index 459a00d..0000000 --- a/docs/examples/proxy/update-rule-verification.md +++ /dev/null @@ -1,13 +0,0 @@ -using Appwrite; -using Appwrite.Services; -using Appwrite.Models; - -var client = new Client() - .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint - .SetProject("5df5acd0d48c2") // Your project ID - .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key - -var proxy = new Proxy(client); - -ProxyRule result = await proxy.UpdateRuleVerification( - ruleId: "[RULE_ID]"); \ No newline at end of file diff --git a/src/Appwrite/Models/ProxyRule.cs b/src/Appwrite/Models/ProxyRule.cs deleted file mode 100644 index c708949..0000000 --- a/src/Appwrite/Models/ProxyRule.cs +++ /dev/null @@ -1,87 +0,0 @@ - -using System; -using System.Linq; -using System.Collections.Generic; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Appwrite.Models -{ - public class ProxyRule - { - [JsonProperty("$id")] - public string Id { get; private set; } - - [JsonProperty("$createdAt")] - public string CreatedAt { get; private set; } - - [JsonProperty("$updatedAt")] - public string UpdatedAt { get; private set; } - - [JsonProperty("domain")] - public string Domain { get; private set; } - - [JsonProperty("resourceType")] - public string ResourceType { get; private set; } - - [JsonProperty("resourceId")] - public string ResourceId { get; private set; } - - [JsonProperty("status")] - public string Status { get; private set; } - - [JsonProperty("logs")] - public string Logs { get; private set; } - - [JsonProperty("renewAt")] - public string RenewAt { get; private set; } - - public ProxyRule( - string id, - string createdAt, - string updatedAt, - string domain, - string resourceType, - string resourceId, - string status, - string logs, - string renewAt - ) { - Id = id; - CreatedAt = createdAt; - UpdatedAt = updatedAt; - Domain = domain; - ResourceType = resourceType; - ResourceId = resourceId; - Status = status; - Logs = logs; - RenewAt = renewAt; - } - - public static ProxyRule From(Dictionary map) => new ProxyRule( - id: map["$id"].ToString(), - createdAt: map["$createdAt"].ToString(), - updatedAt: map["$updatedAt"].ToString(), - domain: map["domain"].ToString(), - resourceType: map["resourceType"].ToString(), - resourceId: map["resourceId"].ToString(), - status: map["status"].ToString(), - logs: map["logs"].ToString(), - renewAt: map["renewAt"].ToString() - ); - - public Dictionary ToMap() => new Dictionary() - { - { "$id", Id }, - { "$createdAt", CreatedAt }, - { "$updatedAt", UpdatedAt }, - { "domain", Domain }, - { "resourceType", ResourceType }, - { "resourceId", ResourceId }, - { "status", Status }, - { "logs", Logs }, - { "renewAt", RenewAt } - }; - } -} \ No newline at end of file diff --git a/src/Appwrite/Models/ProxyRuleList.cs b/src/Appwrite/Models/ProxyRuleList.cs deleted file mode 100644 index 465c237..0000000 --- a/src/Appwrite/Models/ProxyRuleList.cs +++ /dev/null @@ -1,38 +0,0 @@ - -using System; -using System.Linq; -using System.Collections.Generic; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Appwrite.Models -{ - public class ProxyRuleList - { - [JsonProperty("total")] - public long Total { get; private set; } - - [JsonProperty("rules")] - public List Rules { get; private set; } - - public ProxyRuleList( - long total, - List rules - ) { - Total = total; - Rules = rules; - } - - public static ProxyRuleList From(Dictionary map) => new ProxyRuleList( - total: Convert.ToInt64(map["total"]), - rules: ((JArray)map["rules"]).ToObject>>().Select(it => ProxyRule.From(map: it)).ToList() - ); - - public Dictionary ToMap() => new Dictionary() - { - { "total", Total }, - { "rules", Rules.Select(it => it.ToMap()) } - }; - } -} \ No newline at end of file diff --git a/src/Appwrite/Services/Project.cs b/src/Appwrite/Services/Project.cs deleted file mode 100644 index 44cfb1c..0000000 --- a/src/Appwrite/Services/Project.cs +++ /dev/null @@ -1,194 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Appwrite.Models; - -namespace Appwrite.Services -{ - public class Project : Service - { - public Project(Client client) : base(client) - { - } - - /// - /// List Variables - /// - /// Get a list of all project variables. These variables will be accessible in - /// all Appwrite Functions at runtime. - /// - /// - public Task ListVariables() - { - var apiPath = "/project/variables"; - - var parameters = new Dictionary() - { - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.VariableList Convert(Dictionary it) => - Models.VariableList.From(map: it); - - - return _client.Call( - method: "GET", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Create Variable - /// - /// Create a new project variable. This variable will be accessible in all - /// Appwrite Functions at runtime. - /// - /// - public Task CreateVariable(string key, string xvalue) - { - var apiPath = "/project/variables"; - - var parameters = new Dictionary() - { - { "key", key }, - { "value", xvalue } - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.Variable Convert(Dictionary it) => - Models.Variable.From(map: it); - - - return _client.Call( - method: "POST", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Get Variable - /// - /// Get a project variable by its unique ID. - /// - /// - public Task GetVariable(string variableId) - { - var apiPath = "/project/variables/{variableId}" - .Replace("{variableId}", variableId); - - var parameters = new Dictionary() - { - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.Variable Convert(Dictionary it) => - Models.Variable.From(map: it); - - - return _client.Call( - method: "GET", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Update Variable - /// - /// Update project variable by its unique ID. This variable will be accessible - /// in all Appwrite Functions at runtime. - /// - /// - public Task UpdateVariable(string variableId, string key, string? xvalue = null) - { - var apiPath = "/project/variables/{variableId}" - .Replace("{variableId}", variableId); - - var parameters = new Dictionary() - { - { "key", key }, - { "value", xvalue } - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.Variable Convert(Dictionary it) => - Models.Variable.From(map: it); - - - return _client.Call( - method: "PUT", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Delete Variable - /// - /// Delete a project variable by its unique ID. - /// - /// - public Task DeleteVariable(string variableId) - { - var apiPath = "/project/variables/{variableId}" - .Replace("{variableId}", variableId); - - var parameters = new Dictionary() - { - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - - - return _client.Call( - method: "DELETE", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); - - } - - } -} diff --git a/src/Appwrite/Services/Proxy.cs b/src/Appwrite/Services/Proxy.cs deleted file mode 100644 index e79b37f..0000000 --- a/src/Appwrite/Services/Proxy.cs +++ /dev/null @@ -1,190 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Appwrite.Models; - -namespace Appwrite.Services -{ - public class Proxy : Service - { - public Proxy(Client client) : base(client) - { - } - - /// - /// List Rules - /// - /// Get a list of all the proxy rules. You can use the query params to filter - /// your results. - /// - /// - public Task ListRules(List? queries = null, string? search = null) - { - var apiPath = "/proxy/rules"; - - var parameters = new Dictionary() - { - { "queries", queries }, - { "search", search } - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.ProxyRuleList Convert(Dictionary it) => - Models.ProxyRuleList.From(map: it); - - - return _client.Call( - method: "GET", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Create Rule - /// - /// Create a new proxy rule. - /// - /// - public Task CreateRule(string domain, string resourceType, string? resourceId = null) - { - var apiPath = "/proxy/rules"; - - var parameters = new Dictionary() - { - { "domain", domain }, - { "resourceType", resourceType }, - { "resourceId", resourceId } - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.ProxyRule Convert(Dictionary it) => - Models.ProxyRule.From(map: it); - - - return _client.Call( - method: "POST", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Get Rule - /// - /// Get a proxy rule by its unique ID. - /// - /// - public Task GetRule(string ruleId) - { - var apiPath = "/proxy/rules/{ruleId}" - .Replace("{ruleId}", ruleId); - - var parameters = new Dictionary() - { - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.ProxyRule Convert(Dictionary it) => - Models.ProxyRule.From(map: it); - - - return _client.Call( - method: "GET", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - /// - /// Delete Rule - /// - /// Delete a proxy rule by its unique ID. - /// - /// - public Task DeleteRule(string ruleId) - { - var apiPath = "/proxy/rules/{ruleId}" - .Replace("{ruleId}", ruleId); - - var parameters = new Dictionary() - { - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - - - return _client.Call( - method: "DELETE", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); - - } - - /// - /// Update Rule Verification Status - /// - public Task UpdateRuleVerification(string ruleId) - { - var apiPath = "/proxy/rules/{ruleId}/verification" - .Replace("{ruleId}", ruleId); - - var parameters = new Dictionary() - { - }; - - var headers = new Dictionary() - { - { "content-type", "application/json" } - }; - - - - static Models.ProxyRule Convert(Dictionary it) => - Models.ProxyRule.From(map: it); - - - return _client.Call( - method: "PATCH", - path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, - convert: Convert); - - } - - } -} From 3d7f833087ec19589081855df22c3e0a9b027765 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 31 Aug 2023 22:05:09 +0000 Subject: [PATCH 3/3] fix: patch updates for appwrite 1.4.1 --- README.md | 6 +- src/Appwrite/Appwrite.csproj | 2 +- src/Appwrite/Client.cs | 6 +- src/Appwrite/Role.cs | 51 +++++ src/Appwrite/Services/Account.cs | 176 +++++++-------- src/Appwrite/Services/Avatars.cs | 63 +++--- src/Appwrite/Services/Databases.cs | 336 ++++++++++++++--------------- src/Appwrite/Services/Functions.cs | 169 +++++++-------- src/Appwrite/Services/Graphql.cs | 16 +- src/Appwrite/Services/Health.cs | 96 ++++----- src/Appwrite/Services/Locale.cs | 64 +++--- src/Appwrite/Services/Storage.cs | 107 ++++----- src/Appwrite/Services/Teams.cs | 104 ++++----- src/Appwrite/Services/Users.cs | 224 +++++++++---------- 14 files changed, 741 insertions(+), 679 deletions(-) diff --git a/README.md b/README.md index 2b2f2b9..de1fec8 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,17 @@ Appwrite is an open-source backend as a service server that abstract and simplif Add this reference to your project's `.csproj` file: ```xml - + ``` You can install packages from the command line: ```powershell # Package Manager -Install-Package Appwrite -Version 0.4.2 +Install-Package Appwrite -Version 0.5.0 # or .NET CLI -dotnet add package Appwrite --version 0.4.2 +dotnet add package Appwrite --version 0.5.0 ``` diff --git a/src/Appwrite/Appwrite.csproj b/src/Appwrite/Appwrite.csproj index 17c3dba..08739de 100644 --- a/src/Appwrite/Appwrite.csproj +++ b/src/Appwrite/Appwrite.csproj @@ -2,7 +2,7 @@ netstandard2.0;net461 Appwrite - 0.4.2 + 0.5.0 Appwrite Team Appwrite Team diff --git a/src/Appwrite/Client.cs b/src/Appwrite/Client.cs index 20b1f60..fc0a741 100644 --- a/src/Appwrite/Client.cs +++ b/src/Appwrite/Client.cs @@ -58,11 +58,11 @@ public Client( _headers = new Dictionary() { { "content-type", "application/json" }, - { "user-agent" , "AppwriteDotNetSDK/0.4.2 (${Environment.OSVersion.Platform}; ${Environment.OSVersion.VersionString})"}, + { "user-agent" , "AppwriteDotNetSDK/0.5.0 (${Environment.OSVersion.Platform}; ${Environment.OSVersion.VersionString})"}, { "x-sdk-name", ".NET" }, { "x-sdk-platform", "server" }, { "x-sdk-language", "dotnet" }, - { "x-sdk-version", "0.4.2"}, { "X-Appwrite-Response-Format", "1.4.0" } + { "x-sdk-version", "0.5.0"}, { "X-Appwrite-Response-Format", "1.4.0" } }; _config = new Dictionary(); @@ -369,7 +369,7 @@ public async Task ChunkedUpload( parameters[paramName] = content; headers["Content-Range"] = - $"bytes {offset}-{Math.Min(offset + ChunkSize - 1, size)}/{size}"; + $"bytes {offset}-{Math.Min(offset + ChunkSize - 1, size - 1)}/{size}"; result = await Call>( method: "POST", diff --git a/src/Appwrite/Role.cs b/src/Appwrite/Role.cs index 7fc1fdb..b3ecf26 100644 --- a/src/Appwrite/Role.cs +++ b/src/Appwrite/Role.cs @@ -1,12 +1,28 @@ namespace Appwrite { + /// + /// Helper class to generate role strings for Permission. + /// public static class Role { + /// + /// Grants access to anyone. + /// + /// This includes authenticated and unauthenticated users. + /// + /// public static string Any() { return "any"; } + /// + /// Grants access to a specific user by user ID. + /// + /// You can optionally pass verified or unverified for + /// status to target specific types of users. + /// + /// public static string User(string id, string status = "") { return status == string.Empty @@ -14,6 +30,13 @@ public static string User(string id, string status = "") : $"user:{id}/{status}"; } + /// + /// Grants access to any authenticated or anonymous user. + /// + /// You can optionally pass verified or unverified for + /// status to target specific types of users. + /// + /// public static string Users(string status = "") { return status == string.Empty @@ -21,11 +44,24 @@ public static string Users(string status = "") $"users/{status}"; } + /// + /// Grants access to any guest user without a session. + /// + /// Authenticated users don't have access to this role. + /// + /// public static string Guests() { return "guests"; } + /// + /// Grants access to a team by team ID. + /// + /// You can optionally pass a role for role to target + /// team members with the specified role. + /// + /// public static string Team(string id, string role = "") { return role == string.Empty @@ -33,9 +69,24 @@ public static string Team(string id, string role = "") : $"team:{id}/{role}"; } + /// + /// Grants access to a specific member of a team. + /// + /// When the member is removed from the team, they will + /// no longer have access. + /// + /// public static string Member(string id) { return $"member:{id}"; } + + /// + /// Grants access to a user with the specified label. + /// + public static string Label(string name) + { + return $"label:{name}"; + } } } \ No newline at end of file diff --git a/src/Appwrite/Services/Account.cs b/src/Appwrite/Services/Account.cs index e188be7..7e7a6b3 100644 --- a/src/Appwrite/Services/Account.cs +++ b/src/Appwrite/Services/Account.cs @@ -23,11 +23,11 @@ public Account(Client client) : base(client) { var apiPath = "/account"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -41,8 +41,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -64,13 +64,13 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/email"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "email", email }, { "password", password } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -84,8 +84,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -100,12 +100,12 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/identities"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -119,8 +119,8 @@ static Models.IdentityList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -136,11 +136,11 @@ public Task DeleteIdentity(string identityId) var apiPath = "/account/identities/{identityId}" .Replace("{identityId}", identityId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -152,8 +152,8 @@ public Task DeleteIdentity(string identityId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -168,12 +168,12 @@ public Task DeleteIdentity(string identityId) { var apiPath = "/account/logs"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -187,8 +187,8 @@ static Models.LogList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -203,12 +203,12 @@ static Models.LogList Convert(Dictionary it) => { var apiPath = "/account/name"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -222,8 +222,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -240,13 +240,13 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/password"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "password", password }, { "oldPassword", oldPassword } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -260,8 +260,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -280,13 +280,13 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/phone"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "phone", phone }, { "password", password } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -300,8 +300,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -316,11 +316,11 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/prefs"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -334,8 +334,8 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -352,12 +352,12 @@ static Models.Preferences Convert(Dictionary it) => { var apiPath = "/account/prefs"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "prefs", prefs } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -371,8 +371,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -394,13 +394,13 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/recovery"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "email", email }, { "url", url } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -414,8 +414,8 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -438,7 +438,7 @@ static Models.Token Convert(Dictionary it) => { var apiPath = "/account/recovery"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "secret", secret }, @@ -446,7 +446,7 @@ static Models.Token Convert(Dictionary it) => { "passwordAgain", passwordAgain } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -460,8 +460,8 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -477,11 +477,11 @@ static Models.Token Convert(Dictionary it) => { var apiPath = "/account/sessions"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -495,8 +495,8 @@ static Models.SessionList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -512,11 +512,11 @@ public Task DeleteSessions() { var apiPath = "/account/sessions"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -528,8 +528,8 @@ public Task DeleteSessions() return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -545,11 +545,11 @@ public Task DeleteSessions() var apiPath = "/account/sessions/{sessionId}" .Replace("{sessionId}", sessionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -563,8 +563,8 @@ static Models.Session Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -582,11 +582,11 @@ static Models.Session Convert(Dictionary it) => var apiPath = "/account/sessions/{sessionId}" .Replace("{sessionId}", sessionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -600,8 +600,8 @@ static Models.Session Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -620,11 +620,11 @@ public Task DeleteSession(string sessionId) var apiPath = "/account/sessions/{sessionId}" .Replace("{sessionId}", sessionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -636,8 +636,8 @@ public Task DeleteSession(string sessionId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -653,11 +653,11 @@ public Task DeleteSession(string sessionId) { var apiPath = "/account/status"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -671,8 +671,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -701,12 +701,12 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/account/verification"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "url", url } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -720,8 +720,8 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -739,13 +739,13 @@ static Models.Token Convert(Dictionary it) => { var apiPath = "/account/verification"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "secret", secret } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -759,8 +759,8 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -780,11 +780,11 @@ static Models.Token Convert(Dictionary it) => { var apiPath = "/account/verification/phone"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -798,8 +798,8 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -817,13 +817,13 @@ static Models.Token Convert(Dictionary it) => { var apiPath = "/account/verification/phone"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "secret", secret } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -837,8 +837,8 @@ static Models.Token Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } diff --git a/src/Appwrite/Services/Avatars.cs b/src/Appwrite/Services/Avatars.cs index 3274ac5..f79593d 100644 --- a/src/Appwrite/Services/Avatars.cs +++ b/src/Appwrite/Services/Avatars.cs @@ -32,14 +32,14 @@ public Task GetBrowser(string code, long? width = null, long? height = n var apiPath = "/avatars/browsers/{code}" .Replace("{code}", code); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "width", width }, { "height", height }, { "quality", quality } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -48,8 +48,9 @@ public Task GetBrowser(string code, long? width = null, long? height = n return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -71,14 +72,14 @@ public Task GetCreditCard(string code, long? width = null, long? height var apiPath = "/avatars/credit-cards/{code}" .Replace("{code}", code); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "width", width }, { "height", height }, { "quality", quality } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -87,8 +88,9 @@ public Task GetCreditCard(string code, long? width = null, long? height return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -103,12 +105,12 @@ public Task GetFavicon(string url) { var apiPath = "/avatars/favicon"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "url", url } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -117,8 +119,9 @@ public Task GetFavicon(string url) return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -141,14 +144,14 @@ public Task GetFlag(string code, long? width = null, long? height = null var apiPath = "/avatars/flags/{code}" .Replace("{code}", code); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "width", width }, { "height", height }, { "quality", quality } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -157,8 +160,9 @@ public Task GetFlag(string code, long? width = null, long? height = null return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -180,14 +184,14 @@ public Task GetImage(string url, long? width = null, long? height = null { var apiPath = "/avatars/image"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "url", url }, { "width", width }, { "height", height } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -196,8 +200,9 @@ public Task GetImage(string url, long? width = null, long? height = null return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -225,7 +230,7 @@ public Task GetInitials(string? name = null, long? width = null, long? h { var apiPath = "/avatars/initials"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name }, { "width", width }, @@ -233,7 +238,7 @@ public Task GetInitials(string? name = null, long? width = null, long? h { "background", background } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -242,8 +247,9 @@ public Task GetInitials(string? name = null, long? width = null, long? h return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -258,7 +264,7 @@ public Task GetQR(string text, long? size = null, long? margin = null, b { var apiPath = "/avatars/qr"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "text", text }, { "size", size }, @@ -266,7 +272,7 @@ public Task GetQR(string text, long? size = null, long? margin = null, b { "download", download } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -275,8 +281,9 @@ public Task GetQR(string text, long? size = null, long? margin = null, b return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } } diff --git a/src/Appwrite/Services/Databases.cs b/src/Appwrite/Services/Databases.cs index 97cf45e..ab5997f 100644 --- a/src/Appwrite/Services/Databases.cs +++ b/src/Appwrite/Services/Databases.cs @@ -24,13 +24,13 @@ public Databases(Client client) : base(client) { var apiPath = "/databases"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -44,8 +44,8 @@ static Models.DatabaseList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -61,14 +61,14 @@ static Models.DatabaseList Convert(Dictionary it) => { var apiPath = "/databases"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "databaseId", databaseId }, { "name", name }, { "enabled", enabled } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -82,8 +82,8 @@ static Models.Database Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -100,11 +100,11 @@ static Models.Database Convert(Dictionary it) => var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -118,8 +118,8 @@ static Models.Database Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -135,13 +135,13 @@ static Models.Database Convert(Dictionary it) => var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name }, { "enabled", enabled } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -155,8 +155,8 @@ static Models.Database Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -173,11 +173,11 @@ public Task Delete(string databaseId) var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -189,8 +189,8 @@ public Task Delete(string databaseId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -206,13 +206,13 @@ public Task Delete(string databaseId) var apiPath = "/databases/{databaseId}/collections" .Replace("{databaseId}", databaseId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -226,8 +226,8 @@ static Models.CollectionList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -246,7 +246,7 @@ static Models.CollectionList Convert(Dictionary it) => var apiPath = "/databases/{databaseId}/collections" .Replace("{databaseId}", databaseId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "collectionId", collectionId }, { "name", name }, @@ -255,7 +255,7 @@ static Models.CollectionList Convert(Dictionary it) => { "enabled", enabled } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -269,8 +269,8 @@ static Models.Collection Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -288,11 +288,11 @@ static Models.Collection Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -306,8 +306,8 @@ static Models.Collection Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -324,7 +324,7 @@ static Models.Collection Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name }, { "permissions", permissions }, @@ -332,7 +332,7 @@ static Models.Collection Convert(Dictionary it) => { "enabled", enabled } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -346,8 +346,8 @@ static Models.Collection Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -365,11 +365,11 @@ public Task DeleteCollection(string databaseId, string collectionId) .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -381,8 +381,8 @@ public Task DeleteCollection(string databaseId, string collectionId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -395,12 +395,12 @@ public Task DeleteCollection(string databaseId, string collectionId) .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -414,8 +414,8 @@ static Models.AttributeList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -433,7 +433,7 @@ static Models.AttributeList Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -441,7 +441,7 @@ static Models.AttributeList Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -455,8 +455,8 @@ static Models.AttributeBoolean Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -471,13 +471,13 @@ static Models.AttributeBoolean Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -491,8 +491,8 @@ static Models.AttributeBoolean Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -506,7 +506,7 @@ static Models.AttributeBoolean Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -514,7 +514,7 @@ static Models.AttributeBoolean Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -528,8 +528,8 @@ static Models.AttributeDatetime Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -544,13 +544,13 @@ static Models.AttributeDatetime Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -564,8 +564,8 @@ static Models.AttributeDatetime Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -583,7 +583,7 @@ static Models.AttributeDatetime Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -591,7 +591,7 @@ static Models.AttributeDatetime Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -605,8 +605,8 @@ static Models.AttributeEmail Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -626,13 +626,13 @@ static Models.AttributeEmail Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -646,8 +646,8 @@ static Models.AttributeEmail Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -661,7 +661,7 @@ static Models.AttributeEmail Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "elements", elements }, @@ -670,7 +670,7 @@ static Models.AttributeEmail Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -684,8 +684,8 @@ static Models.AttributeEnum Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -705,14 +705,14 @@ static Models.AttributeEnum Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "elements", elements }, { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -726,8 +726,8 @@ static Models.AttributeEnum Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -746,7 +746,7 @@ static Models.AttributeEnum Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -756,7 +756,7 @@ static Models.AttributeEnum Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -770,8 +770,8 @@ static Models.AttributeFloat Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -791,7 +791,7 @@ static Models.AttributeFloat Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "min", min }, @@ -799,7 +799,7 @@ static Models.AttributeFloat Convert(Dictionary it) => { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -813,8 +813,8 @@ static Models.AttributeFloat Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -833,7 +833,7 @@ static Models.AttributeFloat Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -843,7 +843,7 @@ static Models.AttributeFloat Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -857,8 +857,8 @@ static Models.AttributeInteger Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -878,7 +878,7 @@ static Models.AttributeInteger Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "min", min }, @@ -886,7 +886,7 @@ static Models.AttributeInteger Convert(Dictionary it) => { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -900,8 +900,8 @@ static Models.AttributeInteger Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -919,7 +919,7 @@ static Models.AttributeInteger Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -927,7 +927,7 @@ static Models.AttributeInteger Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -941,8 +941,8 @@ static Models.AttributeIp Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -962,13 +962,13 @@ static Models.AttributeIp Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -982,8 +982,8 @@ static Models.AttributeIp Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1002,7 +1002,7 @@ static Models.AttributeIp Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "relatedCollectionId", relatedCollectionId }, { "type", type }, @@ -1012,7 +1012,7 @@ static Models.AttributeIp Convert(Dictionary it) => { "onDelete", onDelete } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1026,8 +1026,8 @@ static Models.AttributeRelationship Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1045,7 +1045,7 @@ static Models.AttributeRelationship Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "size", size }, @@ -1055,7 +1055,7 @@ static Models.AttributeRelationship Convert(Dictionary it) => { "encrypt", encrypt } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1069,8 +1069,8 @@ static Models.AttributeString Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1090,13 +1090,13 @@ static Models.AttributeString Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1110,8 +1110,8 @@ static Models.AttributeString Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1129,7 +1129,7 @@ static Models.AttributeString Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "required", required }, @@ -1137,7 +1137,7 @@ static Models.AttributeString Convert(Dictionary it) => { "array", array } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1151,8 +1151,8 @@ static Models.AttributeUrl Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1172,13 +1172,13 @@ static Models.AttributeUrl Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "required", required }, { "default", xdefault } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1192,8 +1192,8 @@ static Models.AttributeUrl Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1208,11 +1208,11 @@ public Task GetAttribute(string databaseId, string collectionId, string .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1224,8 +1224,8 @@ public Task GetAttribute(string databaseId, string collectionId, string return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -1239,11 +1239,11 @@ public Task DeleteAttribute(string databaseId, string collectionId, stri .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1255,8 +1255,8 @@ public Task DeleteAttribute(string databaseId, string collectionId, stri return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -1275,12 +1275,12 @@ public Task DeleteAttribute(string databaseId, string collectionId, stri .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "onDelete", onDelete } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1294,8 +1294,8 @@ static Models.AttributeRelationship Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1313,12 +1313,12 @@ static Models.AttributeRelationship Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1332,8 +1332,8 @@ static Models.DocumentList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1353,14 +1353,14 @@ static Models.DocumentList Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "documentId", documentId }, { "data", data }, { "permissions", permissions } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1374,8 +1374,8 @@ static Models.Document Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1394,12 +1394,12 @@ static Models.Document Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{documentId}", documentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1413,8 +1413,8 @@ static Models.Document Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1433,13 +1433,13 @@ static Models.Document Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{documentId}", documentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "data", data }, { "permissions", permissions } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1453,8 +1453,8 @@ static Models.Document Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1472,11 +1472,11 @@ public Task DeleteDocument(string databaseId, string collectionId, strin .Replace("{collectionId}", collectionId) .Replace("{documentId}", documentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1488,8 +1488,8 @@ public Task DeleteDocument(string databaseId, string collectionId, strin return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -1502,12 +1502,12 @@ public Task DeleteDocument(string databaseId, string collectionId, strin .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1521,8 +1521,8 @@ static Models.IndexList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1536,7 +1536,7 @@ static Models.IndexList Convert(Dictionary it) => .Replace("{databaseId}", databaseId) .Replace("{collectionId}", collectionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "type", type }, @@ -1544,7 +1544,7 @@ static Models.IndexList Convert(Dictionary it) => { "orders", orders } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1558,8 +1558,8 @@ static Models.Index Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1574,11 +1574,11 @@ static Models.Index Convert(Dictionary it) => .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1592,8 +1592,8 @@ static Models.Index Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1608,11 +1608,11 @@ public Task DeleteIndex(string databaseId, string collectionId, string k .Replace("{collectionId}", collectionId) .Replace("{key}", key); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1624,8 +1624,8 @@ public Task DeleteIndex(string databaseId, string collectionId, string k return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } diff --git a/src/Appwrite/Services/Functions.cs b/src/Appwrite/Services/Functions.cs index 1681ee8..af979d3 100644 --- a/src/Appwrite/Services/Functions.cs +++ b/src/Appwrite/Services/Functions.cs @@ -24,13 +24,13 @@ public Functions(Client client) : base(client) { var apiPath = "/functions"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -44,8 +44,8 @@ static Models.FunctionList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -62,7 +62,7 @@ static Models.FunctionList Convert(Dictionary it) => { var apiPath = "/functions"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "functionId", functionId }, { "name", name }, @@ -86,7 +86,7 @@ static Models.FunctionList Convert(Dictionary it) => { "templateBranch", templateBranch } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -100,8 +100,8 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -116,11 +116,11 @@ static Models.Function Convert(Dictionary it) => { var apiPath = "/functions/runtimes"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -134,8 +134,8 @@ static Models.RuntimeList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -151,11 +151,11 @@ static Models.RuntimeList Convert(Dictionary it) => var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -169,8 +169,8 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -186,7 +186,7 @@ static Models.Function Convert(Dictionary it) => var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name }, { "runtime", runtime }, @@ -205,7 +205,7 @@ static Models.Function Convert(Dictionary it) => { "providerRootDirectory", providerRootDirectory } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -219,8 +219,8 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -236,11 +236,11 @@ public Task Delete(string functionId) var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -252,8 +252,8 @@ public Task Delete(string functionId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -269,13 +269,13 @@ public Task Delete(string functionId) var apiPath = "/functions/{functionId}/deployments" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -289,8 +289,8 @@ static Models.DeploymentList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -315,7 +315,7 @@ static Models.DeploymentList Convert(Dictionary it) => var apiPath = "/functions/{functionId}/deployments" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "entrypoint", entrypoint }, { "commands", commands }, @@ -323,7 +323,7 @@ static Models.DeploymentList Convert(Dictionary it) => { "activate", activate } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "multipart/form-data" } }; @@ -339,8 +339,8 @@ static Models.Deployment Convert(Dictionary it) => return _client.ChunkedUpload( apiPath, - headers, - parameters, + apiHeaders, + apiParameters, Convert, paramName, idParamName, @@ -359,11 +359,11 @@ static Models.Deployment Convert(Dictionary it) => .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -377,8 +377,8 @@ static Models.Deployment Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -397,11 +397,11 @@ static Models.Deployment Convert(Dictionary it) => .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -415,8 +415,8 @@ static Models.Function Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -433,11 +433,11 @@ public Task DeleteDeployment(string functionId, string deploymentId) .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -449,8 +449,8 @@ public Task DeleteDeployment(string functionId, string deploymentId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -468,11 +468,11 @@ public Task CreateBuild(string functionId, string deploymentId, string b .Replace("{deploymentId}", deploymentId) .Replace("{buildId}", buildId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -484,8 +484,8 @@ public Task CreateBuild(string functionId, string deploymentId, string b return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -498,11 +498,11 @@ public Task DownloadDeployment(string functionId, string deploymentId) .Replace("{functionId}", functionId) .Replace("{deploymentId}", deploymentId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -511,8 +511,9 @@ public Task DownloadDeployment(string functionId, string deploymentId) return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -527,13 +528,13 @@ public Task DownloadDeployment(string functionId, string deploymentId) var apiPath = "/functions/{functionId}/executions" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -547,8 +548,8 @@ static Models.ExecutionList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -567,7 +568,7 @@ static Models.ExecutionList Convert(Dictionary it) => var apiPath = "/functions/{functionId}/executions" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "body", body }, { "async", xasync }, @@ -576,7 +577,7 @@ static Models.ExecutionList Convert(Dictionary it) => { "headers", headers } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -590,8 +591,8 @@ static Models.Execution Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -608,11 +609,11 @@ static Models.Execution Convert(Dictionary it) => .Replace("{functionId}", functionId) .Replace("{executionId}", executionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -626,8 +627,8 @@ static Models.Execution Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -643,11 +644,11 @@ static Models.Execution Convert(Dictionary it) => var apiPath = "/functions/{functionId}/variables" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -661,8 +662,8 @@ static Models.VariableList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -679,13 +680,13 @@ static Models.VariableList Convert(Dictionary it) => var apiPath = "/functions/{functionId}/variables" .Replace("{functionId}", functionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "value", xvalue } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -699,8 +700,8 @@ static Models.Variable Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -717,11 +718,11 @@ static Models.Variable Convert(Dictionary it) => .Replace("{functionId}", functionId) .Replace("{variableId}", variableId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -735,8 +736,8 @@ static Models.Variable Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -753,13 +754,13 @@ static Models.Variable Convert(Dictionary it) => .Replace("{functionId}", functionId) .Replace("{variableId}", variableId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "key", key }, { "value", xvalue } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -773,8 +774,8 @@ static Models.Variable Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -791,11 +792,11 @@ public Task DeleteVariable(string functionId, string variableId) .Replace("{functionId}", functionId) .Replace("{variableId}", variableId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -807,8 +808,8 @@ public Task DeleteVariable(string functionId, string variableId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } diff --git a/src/Appwrite/Services/Graphql.cs b/src/Appwrite/Services/Graphql.cs index 755f08a..6982eaf 100644 --- a/src/Appwrite/Services/Graphql.cs +++ b/src/Appwrite/Services/Graphql.cs @@ -23,12 +23,12 @@ public Task Query(object query) { var apiPath = "/graphql"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "query", query } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "x-sdk-graphql", "true" }, { "content-type", "application/json" } @@ -43,8 +43,8 @@ static object Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -59,12 +59,12 @@ public Task Mutation(object query) { var apiPath = "/graphql/mutation"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "query", query } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "x-sdk-graphql", "true" }, { "content-type", "application/json" } @@ -79,8 +79,8 @@ static object Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } diff --git a/src/Appwrite/Services/Health.cs b/src/Appwrite/Services/Health.cs index 0fb27d0..75a2827 100644 --- a/src/Appwrite/Services/Health.cs +++ b/src/Appwrite/Services/Health.cs @@ -23,11 +23,11 @@ public Health(Client client) : base(client) { var apiPath = "/health"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -41,8 +41,8 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -57,11 +57,11 @@ static Models.HealthStatus Convert(Dictionary it) => { var apiPath = "/health/anti-virus"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -75,8 +75,8 @@ static Models.HealthAntivirus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -92,11 +92,11 @@ static Models.HealthAntivirus Convert(Dictionary it) => { var apiPath = "/health/cache"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -110,8 +110,8 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -126,11 +126,11 @@ static Models.HealthStatus Convert(Dictionary it) => { var apiPath = "/health/db"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -144,8 +144,8 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -160,11 +160,11 @@ static Models.HealthStatus Convert(Dictionary it) => { var apiPath = "/health/pubsub"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -178,8 +178,8 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -195,11 +195,11 @@ static Models.HealthStatus Convert(Dictionary it) => { var apiPath = "/health/queue"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -213,8 +213,8 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -231,11 +231,11 @@ static Models.HealthStatus Convert(Dictionary it) => { var apiPath = "/health/queue/certificates"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -249,8 +249,8 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -262,11 +262,11 @@ static Models.HealthQueue Convert(Dictionary it) => { var apiPath = "/health/queue/functions"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -280,8 +280,8 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -297,11 +297,11 @@ static Models.HealthQueue Convert(Dictionary it) => { var apiPath = "/health/queue/logs"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -315,8 +315,8 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -332,11 +332,11 @@ static Models.HealthQueue Convert(Dictionary it) => { var apiPath = "/health/queue/webhooks"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -350,8 +350,8 @@ static Models.HealthQueue Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -366,11 +366,11 @@ static Models.HealthQueue Convert(Dictionary it) => { var apiPath = "/health/storage/local"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -384,8 +384,8 @@ static Models.HealthStatus Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -406,11 +406,11 @@ static Models.HealthStatus Convert(Dictionary it) => { var apiPath = "/health/time"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -424,8 +424,8 @@ static Models.HealthTime Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } diff --git a/src/Appwrite/Services/Locale.cs b/src/Appwrite/Services/Locale.cs index 849ea68..8db2b3e 100644 --- a/src/Appwrite/Services/Locale.cs +++ b/src/Appwrite/Services/Locale.cs @@ -28,11 +28,11 @@ public Locale(Client client) : base(client) { var apiPath = "/locale"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -46,8 +46,8 @@ static Models.Locale Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -63,11 +63,11 @@ static Models.Locale Convert(Dictionary it) => { var apiPath = "/locale/codes"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -81,8 +81,8 @@ static Models.LocaleCodeList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -98,11 +98,11 @@ static Models.LocaleCodeList Convert(Dictionary it) => { var apiPath = "/locale/continents"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -116,8 +116,8 @@ static Models.ContinentList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -133,11 +133,11 @@ static Models.ContinentList Convert(Dictionary it) => { var apiPath = "/locale/countries"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -151,8 +151,8 @@ static Models.CountryList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -168,11 +168,11 @@ static Models.CountryList Convert(Dictionary it) => { var apiPath = "/locale/countries/eu"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -186,8 +186,8 @@ static Models.CountryList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -203,11 +203,11 @@ static Models.CountryList Convert(Dictionary it) => { var apiPath = "/locale/countries/phones"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -221,8 +221,8 @@ static Models.PhoneList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -239,11 +239,11 @@ static Models.PhoneList Convert(Dictionary it) => { var apiPath = "/locale/currencies"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -257,8 +257,8 @@ static Models.CurrencyList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -274,11 +274,11 @@ static Models.CurrencyList Convert(Dictionary it) => { var apiPath = "/locale/languages"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -292,8 +292,8 @@ static Models.LanguageList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } diff --git a/src/Appwrite/Services/Storage.cs b/src/Appwrite/Services/Storage.cs index bad792c..38f29eb 100644 --- a/src/Appwrite/Services/Storage.cs +++ b/src/Appwrite/Services/Storage.cs @@ -24,13 +24,13 @@ public Storage(Client client) : base(client) { var apiPath = "/storage/buckets"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -44,8 +44,8 @@ static Models.BucketList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -60,7 +60,7 @@ static Models.BucketList Convert(Dictionary it) => { var apiPath = "/storage/buckets"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "bucketId", bucketId }, { "name", name }, @@ -74,7 +74,7 @@ static Models.BucketList Convert(Dictionary it) => { "antivirus", antivirus } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -88,8 +88,8 @@ static Models.Bucket Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -106,11 +106,11 @@ static Models.Bucket Convert(Dictionary it) => var apiPath = "/storage/buckets/{bucketId}" .Replace("{bucketId}", bucketId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -124,8 +124,8 @@ static Models.Bucket Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -141,7 +141,7 @@ static Models.Bucket Convert(Dictionary it) => var apiPath = "/storage/buckets/{bucketId}" .Replace("{bucketId}", bucketId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name }, { "permissions", permissions }, @@ -154,7 +154,7 @@ static Models.Bucket Convert(Dictionary it) => { "antivirus", antivirus } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -168,8 +168,8 @@ static Models.Bucket Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -185,11 +185,11 @@ public Task DeleteBucket(string bucketId) var apiPath = "/storage/buckets/{bucketId}" .Replace("{bucketId}", bucketId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -201,8 +201,8 @@ public Task DeleteBucket(string bucketId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -218,13 +218,13 @@ public Task DeleteBucket(string bucketId) var apiPath = "/storage/buckets/{bucketId}/files" .Replace("{bucketId}", bucketId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -238,8 +238,8 @@ static Models.FileList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -272,14 +272,14 @@ static Models.FileList Convert(Dictionary it) => var apiPath = "/storage/buckets/{bucketId}/files" .Replace("{bucketId}", bucketId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "fileId", fileId }, { "file", file }, { "permissions", permissions } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "multipart/form-data" } }; @@ -295,8 +295,8 @@ static Models.File Convert(Dictionary it) => return _client.ChunkedUpload( apiPath, - headers, - parameters, + apiHeaders, + apiParameters, Convert, paramName, idParamName, @@ -316,11 +316,11 @@ static Models.File Convert(Dictionary it) => .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -334,8 +334,8 @@ static Models.File Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -353,13 +353,13 @@ static Models.File Convert(Dictionary it) => .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name }, { "permissions", permissions } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -373,8 +373,8 @@ static Models.File Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -392,11 +392,11 @@ public Task DeleteFile(string bucketId, string fileId) .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -408,8 +408,8 @@ public Task DeleteFile(string bucketId, string fileId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -427,11 +427,11 @@ public Task GetFileDownload(string bucketId, string fileId) .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -440,8 +440,9 @@ public Task GetFileDownload(string bucketId, string fileId) return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -460,7 +461,7 @@ public Task GetFilePreview(string bucketId, string fileId, long? width = .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "width", width }, { "height", height }, @@ -475,7 +476,7 @@ public Task GetFilePreview(string bucketId, string fileId, long? width = { "output", output } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -484,8 +485,9 @@ public Task GetFilePreview(string bucketId, string fileId, long? width = return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } /// @@ -502,11 +504,11 @@ public Task GetFileView(string bucketId, string fileId) .Replace("{bucketId}", bucketId) .Replace("{fileId}", fileId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -515,8 +517,9 @@ public Task GetFileView(string bucketId, string fileId) return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + } } diff --git a/src/Appwrite/Services/Teams.cs b/src/Appwrite/Services/Teams.cs index 8d90af2..f3d920f 100644 --- a/src/Appwrite/Services/Teams.cs +++ b/src/Appwrite/Services/Teams.cs @@ -24,13 +24,13 @@ public Teams(Client client) : base(client) { var apiPath = "/teams"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -44,8 +44,8 @@ static Models.TeamList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -62,14 +62,14 @@ static Models.TeamList Convert(Dictionary it) => { var apiPath = "/teams"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "teamId", teamId }, { "name", name }, { "roles", roles } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -83,8 +83,8 @@ static Models.Team Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -100,11 +100,11 @@ static Models.Team Convert(Dictionary it) => var apiPath = "/teams/{teamId}" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -118,8 +118,8 @@ static Models.Team Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -135,12 +135,12 @@ static Models.Team Convert(Dictionary it) => var apiPath = "/teams/{teamId}" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -154,8 +154,8 @@ static Models.Team Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -172,11 +172,11 @@ public Task Delete(string teamId) var apiPath = "/teams/{teamId}" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -188,8 +188,8 @@ public Task Delete(string teamId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -205,13 +205,13 @@ public Task Delete(string teamId) var apiPath = "/teams/{teamId}/memberships" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -225,8 +225,8 @@ static Models.MembershipList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -262,7 +262,7 @@ static Models.MembershipList Convert(Dictionary it) => var apiPath = "/teams/{teamId}/memberships" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "email", email }, { "userId", userId }, @@ -272,7 +272,7 @@ static Models.MembershipList Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -286,8 +286,8 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -305,11 +305,11 @@ static Models.Membership Convert(Dictionary it) => .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -323,8 +323,8 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -344,12 +344,12 @@ static Models.Membership Convert(Dictionary it) => .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "roles", roles } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -363,8 +363,8 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -383,11 +383,11 @@ public Task DeleteMembership(string teamId, string membershipId) .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -399,8 +399,8 @@ public Task DeleteMembership(string teamId, string membershipId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -422,13 +422,13 @@ public Task DeleteMembership(string teamId, string membershipId) .Replace("{teamId}", teamId) .Replace("{membershipId}", membershipId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "secret", secret } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -442,8 +442,8 @@ static Models.Membership Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -461,11 +461,11 @@ static Models.Membership Convert(Dictionary it) => var apiPath = "/teams/{teamId}/prefs" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -479,8 +479,8 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -498,12 +498,12 @@ static Models.Preferences Convert(Dictionary it) => var apiPath = "/teams/{teamId}/prefs" .Replace("{teamId}", teamId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "prefs", prefs } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -517,8 +517,8 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } diff --git a/src/Appwrite/Services/Users.cs b/src/Appwrite/Services/Users.cs index 2708f23..202b62f 100644 --- a/src/Appwrite/Services/Users.cs +++ b/src/Appwrite/Services/Users.cs @@ -24,13 +24,13 @@ public Users(Client client) : base(client) { var apiPath = "/users"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -44,8 +44,8 @@ static Models.UserList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -60,7 +60,7 @@ static Models.UserList Convert(Dictionary it) => { var apiPath = "/users"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -69,7 +69,7 @@ static Models.UserList Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -83,8 +83,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -102,7 +102,7 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/argon2"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -110,7 +110,7 @@ static Models.User Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -124,8 +124,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -143,7 +143,7 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/bcrypt"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -151,7 +151,7 @@ static Models.User Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -165,8 +165,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -181,13 +181,13 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/identities"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries }, { "search", search } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -201,8 +201,8 @@ static Models.IdentityList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -218,11 +218,11 @@ public Task DeleteIdentity(string identityId) var apiPath = "/users/identities/{identityId}" .Replace("{identityId}", identityId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -234,8 +234,8 @@ public Task DeleteIdentity(string identityId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -252,7 +252,7 @@ public Task DeleteIdentity(string identityId) { var apiPath = "/users/md5"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -260,7 +260,7 @@ public Task DeleteIdentity(string identityId) { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -274,8 +274,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -293,7 +293,7 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/phpass"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -301,7 +301,7 @@ static Models.User Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -315,8 +315,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -334,7 +334,7 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/scrypt"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -347,7 +347,7 @@ static Models.User Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -361,8 +361,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -380,7 +380,7 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/scrypt-modified"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -391,7 +391,7 @@ static Models.User Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -405,8 +405,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -424,7 +424,7 @@ static Models.User Convert(Dictionary it) => { var apiPath = "/users/sha"; - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "userId", userId }, { "email", email }, @@ -433,7 +433,7 @@ static Models.User Convert(Dictionary it) => { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -447,8 +447,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "POST", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -464,11 +464,11 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -482,8 +482,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -503,11 +503,11 @@ public Task Delete(string userId) var apiPath = "/users/{userId}" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -519,8 +519,8 @@ public Task Delete(string userId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -535,12 +535,12 @@ public Task Delete(string userId) var apiPath = "/users/{userId}/email" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "email", email } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -554,8 +554,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -576,12 +576,12 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/labels" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "labels", labels } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -595,8 +595,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PUT", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -612,12 +612,12 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/logs" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "queries", queries } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -631,8 +631,8 @@ static Models.LogList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -648,11 +648,11 @@ static Models.LogList Convert(Dictionary it) => var apiPath = "/users/{userId}/memberships" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -666,8 +666,8 @@ static Models.MembershipList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -683,12 +683,12 @@ static Models.MembershipList Convert(Dictionary it) => var apiPath = "/users/{userId}/name" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "name", name } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -702,8 +702,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -719,12 +719,12 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/password" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "password", password } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -738,8 +738,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -755,12 +755,12 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/phone" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "number", number } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -774,8 +774,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -791,11 +791,11 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/prefs" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -809,8 +809,8 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -828,12 +828,12 @@ static Models.Preferences Convert(Dictionary it) => var apiPath = "/users/{userId}/prefs" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "prefs", prefs } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -847,8 +847,8 @@ static Models.Preferences Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -864,11 +864,11 @@ static Models.Preferences Convert(Dictionary it) => var apiPath = "/users/{userId}/sessions" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -882,8 +882,8 @@ static Models.SessionList Convert(Dictionary it) => return _client.Call( method: "GET", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -899,11 +899,11 @@ public Task DeleteSessions(string userId) var apiPath = "/users/{userId}/sessions" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -915,8 +915,8 @@ public Task DeleteSessions(string userId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -932,11 +932,11 @@ public Task DeleteSession(string userId, string sessionId) .Replace("{userId}", userId) .Replace("{sessionId}", sessionId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -948,8 +948,8 @@ public Task DeleteSession(string userId, string sessionId) return _client.Call( method: "DELETE", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); } @@ -965,12 +965,12 @@ public Task DeleteSession(string userId, string sessionId) var apiPath = "/users/{userId}/status" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "status", status } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -984,8 +984,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1001,12 +1001,12 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/verification" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "emailVerification", emailVerification } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1020,8 +1020,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); } @@ -1037,12 +1037,12 @@ static Models.User Convert(Dictionary it) => var apiPath = "/users/{userId}/verification/phone" .Replace("{userId}", userId); - var parameters = new Dictionary() + var apiParameters = new Dictionary() { { "phoneVerification", phoneVerification } }; - var headers = new Dictionary() + var apiHeaders = new Dictionary() { { "content-type", "application/json" } }; @@ -1056,8 +1056,8 @@ static Models.User Convert(Dictionary it) => return _client.Call( method: "PATCH", path: apiPath, - headers: headers, - parameters: parameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, convert: Convert); }