diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8767c005..111cb3d4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,10 +9,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up .NET - uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: dotnet-version: '6' diff --git a/Appwrite/Appwrite.csproj b/Appwrite/Appwrite.csproj index 51965b44..54772716 100644 --- a/Appwrite/Appwrite.csproj +++ b/Appwrite/Appwrite.csproj @@ -2,7 +2,7 @@ netstandard2.0;net462 Appwrite - 6.0.0 + 6.1.0 Appwrite Team Appwrite Team @@ -20,7 +20,7 @@ - + diff --git a/Appwrite/Client.cs b/Appwrite/Client.cs index 9b456828..4754333e 100644 --- a/Appwrite/Client.cs +++ b/Appwrite/Client.cs @@ -76,11 +76,11 @@ public Client( _headers = new Dictionary() { { "content-type", "application/json" }, - { "user-agent" , $"AppwriteDotNetSDK/6.0.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"}, + { "user-agent" , $"AppwriteDotNetSDK/6.1.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"}, { "x-sdk-name", ".NET" }, { "x-sdk-platform", "server" }, { "x-sdk-language", "dotnet" }, - { "x-sdk-version", "6.0.0"}, + { "x-sdk-version", "6.1.0"}, { "X-Appwrite-Response-Format", "1.9.5" } }; diff --git a/Appwrite/Enums/DatabaseStatus.cs b/Appwrite/Enums/DatabaseStatus.cs index cd8892d2..dc8860a1 100644 --- a/Appwrite/Enums/DatabaseStatus.cs +++ b/Appwrite/Enums/DatabaseStatus.cs @@ -13,6 +13,17 @@ public DatabaseStatus(string value) public static DatabaseStatus Provisioning => new DatabaseStatus("provisioning"); public static DatabaseStatus Ready => new DatabaseStatus("ready"); + public static DatabaseStatus Inactive => new DatabaseStatus("inactive"); + public static DatabaseStatus Paused => new DatabaseStatus("paused"); public static DatabaseStatus Failed => new DatabaseStatus("failed"); + public static DatabaseStatus Deleting => new DatabaseStatus("deleting"); + public static DatabaseStatus Deleted => new DatabaseStatus("deleted"); + public static DatabaseStatus Restoring => new DatabaseStatus("restoring"); + public static DatabaseStatus Scaling => new DatabaseStatus("scaling"); + public static DatabaseStatus Upgrading => new DatabaseStatus("upgrading"); + public static DatabaseStatus Migrating => new DatabaseStatus("migrating"); + public static DatabaseStatus Pausing => new DatabaseStatus("pausing"); + public static DatabaseStatus Resuming => new DatabaseStatus("resuming"); + public static DatabaseStatus FailingOver => new DatabaseStatus("failing-over"); } } diff --git a/Appwrite/Enums/DatabaseType.cs b/Appwrite/Enums/DatabaseType.cs index 11b4916b..5a559464 100644 --- a/Appwrite/Enums/DatabaseType.cs +++ b/Appwrite/Enums/DatabaseType.cs @@ -15,5 +15,8 @@ public DatabaseType(string value) public static DatabaseType Tablesdb => new DatabaseType("tablesdb"); public static DatabaseType Documentsdb => new DatabaseType("documentsdb"); public static DatabaseType Vectorsdb => new DatabaseType("vectorsdb"); + public static DatabaseType Mysql => new DatabaseType("mysql"); + public static DatabaseType Postgresql => new DatabaseType("postgresql"); + public static DatabaseType Mongodb => new DatabaseType("mongodb"); } } diff --git a/Appwrite/Enums/OrganizationKeyScopes.cs b/Appwrite/Enums/OrganizationKeyScopes.cs index 8802f0fa..8e848a17 100644 --- a/Appwrite/Enums/OrganizationKeyScopes.cs +++ b/Appwrite/Enums/OrganizationKeyScopes.cs @@ -17,6 +17,8 @@ public OrganizationKeyScopes(string value) public static OrganizationKeyScopes DevKeysWrite => new OrganizationKeyScopes("devKeys.write"); public static OrganizationKeyScopes OrganizationKeysRead => new OrganizationKeyScopes("organization.keys.read"); public static OrganizationKeyScopes OrganizationKeysWrite => new OrganizationKeyScopes("organization.keys.write"); + public static OrganizationKeyScopes OrganizationInstallationsRead => new OrganizationKeyScopes("organization.installations.read"); + public static OrganizationKeyScopes OrganizationInstallationsWrite => new OrganizationKeyScopes("organization.installations.write"); public static OrganizationKeyScopes OrganizationMembershipsRead => new OrganizationKeyScopes("organization.memberships.read"); public static OrganizationKeyScopes OrganizationMembershipsWrite => new OrganizationKeyScopes("organization.memberships.write"); public static OrganizationKeyScopes OrganizationRead => new OrganizationKeyScopes("organization.read"); diff --git a/Appwrite/Enums/ProjectKeyScopes.cs b/Appwrite/Enums/ProjectKeyScopes.cs index 9ccbd816..e728151f 100644 --- a/Appwrite/Enums/ProjectKeyScopes.cs +++ b/Appwrite/Enums/ProjectKeyScopes.cs @@ -106,11 +106,14 @@ public ProjectKeyScopes(string value) public static ProjectKeyScopes DedicatedDatabasesExecute => new ProjectKeyScopes("dedicatedDatabases.execute"); public static ProjectKeyScopes DomainsRead => new ProjectKeyScopes("domains.read"); public static ProjectKeyScopes DomainsWrite => new ProjectKeyScopes("domains.write"); + public static ProjectKeyScopes WafRulesRead => new ProjectKeyScopes("wafRules.read"); + public static ProjectKeyScopes WafRulesWrite => new ProjectKeyScopes("wafRules.write"); public static ProjectKeyScopes EventsRead => new ProjectKeyScopes("events.read"); public static ProjectKeyScopes AppsRead => new ProjectKeyScopes("apps.read"); public static ProjectKeyScopes AppsWrite => new ProjectKeyScopes("apps.write"); public static ProjectKeyScopes Oauth2Read => new ProjectKeyScopes("oauth2.read"); public static ProjectKeyScopes Oauth2Write => new ProjectKeyScopes("oauth2.write"); + public static ProjectKeyScopes Oauth2Introspect => new ProjectKeyScopes("oauth2.introspect"); public static ProjectKeyScopes UsageRead => new ProjectKeyScopes("usage.read"); } } diff --git a/Appwrite/Models/ActivityEvent.cs b/Appwrite/Models/ActivityEvent.cs index e0864a01..04af514f 100644 --- a/Appwrite/Models/ActivityEvent.cs +++ b/Appwrite/Models/ActivityEvent.cs @@ -53,6 +53,33 @@ public class ActivityEvent [JsonPropertyName("country")] public string Country { get; private set; } + [JsonPropertyName("continentCode")] + public string ContinentCode { get; private set; } + + [JsonPropertyName("city")] + public string City { get; private set; } + + [JsonPropertyName("subdivisions")] + public string Subdivisions { get; private set; } + + [JsonPropertyName("isp")] + public string Isp { get; private set; } + + [JsonPropertyName("autonomousSystemNumber")] + public string AutonomousSystemNumber { get; private set; } + + [JsonPropertyName("autonomousSystemOrganization")] + public string AutonomousSystemOrganization { get; private set; } + + [JsonPropertyName("connectionType")] + public string ConnectionType { get; private set; } + + [JsonPropertyName("connectionUsageType")] + public string ConnectionUsageType { get; private set; } + + [JsonPropertyName("connectionOrganization")] + public string ConnectionOrganization { get; private set; } + [JsonPropertyName("time")] public string Time { get; private set; } @@ -65,6 +92,12 @@ public class ActivityEvent [JsonPropertyName("hostname")] public string Hostname { get; private set; } + [JsonPropertyName("sdk")] + public string Sdk { get; private set; } + + [JsonPropertyName("sdkVersion")] + public string SdkVersion { get; private set; } + public ActivityEvent( string id, string actorType, @@ -80,10 +113,21 @@ public ActivityEvent( string ip, string mode, string country, + string continentCode, + string city, + string subdivisions, + string isp, + string autonomousSystemNumber, + string autonomousSystemOrganization, + string connectionType, + string connectionUsageType, + string connectionOrganization, string time, string projectId, string teamId, - string hostname + string hostname, + string sdk, + string sdkVersion ) { Id = id; @@ -100,10 +144,21 @@ string hostname Ip = ip; Mode = mode; Country = country; + ContinentCode = continentCode; + City = city; + Subdivisions = subdivisions; + Isp = isp; + AutonomousSystemNumber = autonomousSystemNumber; + AutonomousSystemOrganization = autonomousSystemOrganization; + ConnectionType = connectionType; + ConnectionUsageType = connectionUsageType; + ConnectionOrganization = connectionOrganization; Time = time; ProjectId = projectId; TeamId = teamId; Hostname = hostname; + Sdk = sdk; + SdkVersion = sdkVersion; } public static ActivityEvent From(Dictionary map) => new ActivityEvent( @@ -121,10 +176,21 @@ string hostname ip: map["ip"].ToString(), mode: map["mode"].ToString(), country: map["country"].ToString(), + continentCode: map["continentCode"].ToString(), + city: map["city"].ToString(), + subdivisions: map["subdivisions"].ToString(), + isp: map["isp"].ToString(), + autonomousSystemNumber: map["autonomousSystemNumber"].ToString(), + autonomousSystemOrganization: map["autonomousSystemOrganization"].ToString(), + connectionType: map["connectionType"].ToString(), + connectionUsageType: map["connectionUsageType"].ToString(), + connectionOrganization: map["connectionOrganization"].ToString(), time: map["time"].ToString(), projectId: map["projectId"].ToString(), teamId: map["teamId"].ToString(), - hostname: map["hostname"].ToString() + hostname: map["hostname"].ToString(), + sdk: map["sdk"].ToString(), + sdkVersion: map["sdkVersion"].ToString() ); public Dictionary ToMap() => new Dictionary() @@ -143,10 +209,21 @@ string hostname { "ip", Ip }, { "mode", Mode }, { "country", Country }, + { "continentCode", ContinentCode }, + { "city", City }, + { "subdivisions", Subdivisions }, + { "isp", Isp }, + { "autonomousSystemNumber", AutonomousSystemNumber }, + { "autonomousSystemOrganization", AutonomousSystemOrganization }, + { "connectionType", ConnectionType }, + { "connectionUsageType", ConnectionUsageType }, + { "connectionOrganization", ConnectionOrganization }, { "time", Time }, { "projectId", ProjectId }, { "teamId", TeamId }, - { "hostname", Hostname } + { "hostname", Hostname }, + { "sdk", Sdk }, + { "sdkVersion", SdkVersion } }; } } diff --git a/Appwrite/Models/App.cs b/Appwrite/Models/App.cs new file mode 100644 index 00000000..866d9629 --- /dev/null +++ b/Appwrite/Models/App.cs @@ -0,0 +1,208 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class App + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("name")] + public string Name { get; private set; } + + [JsonPropertyName("description")] + public string Description { get; private set; } + + [JsonPropertyName("clientUri")] + public string ClientUri { get; private set; } + + [JsonPropertyName("logoUri")] + public string LogoUri { get; private set; } + + [JsonPropertyName("privacyPolicyUrl")] + public string PrivacyPolicyUrl { get; private set; } + + [JsonPropertyName("termsUrl")] + public string TermsUrl { get; private set; } + + [JsonPropertyName("contacts")] + public List Contacts { get; private set; } + + [JsonPropertyName("tagline")] + public string Tagline { get; private set; } + + [JsonPropertyName("tags")] + public List Tags { get; private set; } + + [JsonPropertyName("labels")] + public List Labels { get; private set; } + + [JsonPropertyName("images")] + public List Images { get; private set; } + + [JsonPropertyName("supportUrl")] + public string SupportUrl { get; private set; } + + [JsonPropertyName("dataDeletionUrl")] + public string DataDeletionUrl { get; private set; } + + [JsonPropertyName("redirectUris")] + public List RedirectUris { get; private set; } + + [JsonPropertyName("postLogoutRedirectUris")] + public List PostLogoutRedirectUris { get; private set; } + + [JsonPropertyName("enabled")] + public bool Enabled { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("deviceFlow")] + public bool DeviceFlow { get; private set; } + + [JsonPropertyName("teamId")] + public string TeamId { get; private set; } + + [JsonPropertyName("userId")] + public string UserId { get; private set; } + + [JsonPropertyName("installationScopes")] + public List InstallationScopes { get; private set; } + + [JsonPropertyName("installationRedirectUrl")] + public string InstallationRedirectUrl { get; private set; } + + [JsonPropertyName("secrets")] + public List Secrets { get; private set; } + + public App( + string id, + string createdAt, + string updatedAt, + string name, + string description, + string clientUri, + string logoUri, + string privacyPolicyUrl, + string termsUrl, + List contacts, + string tagline, + List tags, + List labels, + List images, + string supportUrl, + string dataDeletionUrl, + List redirectUris, + List postLogoutRedirectUris, + bool enabled, + string type, + bool deviceFlow, + string teamId, + string userId, + List installationScopes, + string installationRedirectUrl, + List secrets + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Name = name; + Description = description; + ClientUri = clientUri; + LogoUri = logoUri; + PrivacyPolicyUrl = privacyPolicyUrl; + TermsUrl = termsUrl; + Contacts = contacts; + Tagline = tagline; + Tags = tags; + Labels = labels; + Images = images; + SupportUrl = supportUrl; + DataDeletionUrl = dataDeletionUrl; + RedirectUris = redirectUris; + PostLogoutRedirectUris = postLogoutRedirectUris; + Enabled = enabled; + Type = type; + DeviceFlow = deviceFlow; + TeamId = teamId; + UserId = userId; + InstallationScopes = installationScopes; + InstallationRedirectUrl = installationRedirectUrl; + Secrets = secrets; + } + + public static App From(Dictionary map) => new App( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + name: map["name"].ToString(), + description: map["description"].ToString(), + clientUri: map["clientUri"].ToString(), + logoUri: map["logoUri"].ToString(), + privacyPolicyUrl: map["privacyPolicyUrl"].ToString(), + termsUrl: map["termsUrl"].ToString(), + contacts: map["contacts"].ConvertToList(), + tagline: map["tagline"].ToString(), + tags: map["tags"].ConvertToList(), + labels: map["labels"].ConvertToList(), + images: map["images"].ConvertToList(), + supportUrl: map["supportUrl"].ToString(), + dataDeletionUrl: map["dataDeletionUrl"].ToString(), + redirectUris: map["redirectUris"].ConvertToList(), + postLogoutRedirectUris: map["postLogoutRedirectUris"].ConvertToList(), + enabled: (bool)map["enabled"], + type: map["type"].ToString(), + deviceFlow: (bool)map["deviceFlow"], + teamId: map["teamId"].ToString(), + userId: map["userId"].ToString(), + installationScopes: map["installationScopes"].ConvertToList(), + installationRedirectUrl: map["installationRedirectUrl"].ToString(), + secrets: map["secrets"].ConvertToList>().Select(it => Appwrite.Models.AppSecret.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "name", Name }, + { "description", Description }, + { "clientUri", ClientUri }, + { "logoUri", LogoUri }, + { "privacyPolicyUrl", PrivacyPolicyUrl }, + { "termsUrl", TermsUrl }, + { "contacts", Contacts }, + { "tagline", Tagline }, + { "tags", Tags }, + { "labels", Labels }, + { "images", Images }, + { "supportUrl", SupportUrl }, + { "dataDeletionUrl", DataDeletionUrl }, + { "redirectUris", RedirectUris }, + { "postLogoutRedirectUris", PostLogoutRedirectUris }, + { "enabled", Enabled }, + { "type", Type }, + { "deviceFlow", DeviceFlow }, + { "teamId", TeamId }, + { "userId", UserId }, + { "installationScopes", InstallationScopes }, + { "installationRedirectUrl", InstallationRedirectUrl }, + { "secrets", Secrets?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/AppInstallation.cs b/Appwrite/Models/AppInstallation.cs new file mode 100644 index 00000000..3e80b8dd --- /dev/null +++ b/Appwrite/Models/AppInstallation.cs @@ -0,0 +1,96 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppInstallation + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("teamId")] + public string TeamId { get; private set; } + + [JsonPropertyName("scopes")] + public List Scopes { get; private set; } + + [JsonPropertyName("authorizationDetails")] + public object AuthorizationDetails { get; private set; } + + [JsonPropertyName("createdById")] + public string CreatedById { get; private set; } + + [JsonPropertyName("createdByName")] + public string CreatedByName { get; private set; } + + [JsonPropertyName("lastAccessedAt")] + public string? LastAccessedAt { get; private set; } + + public AppInstallation( + string id, + string createdAt, + string updatedAt, + string appId, + string teamId, + List scopes, + object authorizationDetails, + string createdById, + string createdByName, + string? lastAccessedAt + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + AppId = appId; + TeamId = teamId; + Scopes = scopes; + AuthorizationDetails = authorizationDetails; + CreatedById = createdById; + CreatedByName = createdByName; + LastAccessedAt = lastAccessedAt; + } + + public static AppInstallation From(Dictionary map) => new AppInstallation( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + appId: map["appId"].ToString(), + teamId: map["teamId"].ToString(), + scopes: map["scopes"].ConvertToList(), + authorizationDetails: map["authorizationDetails"], + createdById: map["createdById"].ToString(), + createdByName: map["createdByName"].ToString(), + lastAccessedAt: map.TryGetValue("lastAccessedAt", out var lastAccessedAt) ? lastAccessedAt?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "appId", AppId }, + { "teamId", TeamId }, + { "scopes", Scopes }, + { "authorizationDetails", AuthorizationDetails }, + { "createdById", CreatedById }, + { "createdByName", CreatedByName }, + { "lastAccessedAt", LastAccessedAt } + }; + } +} diff --git a/Appwrite/Models/AppInstallationList.cs b/Appwrite/Models/AppInstallationList.cs new file mode 100644 index 00000000..a5c8b4a0 --- /dev/null +++ b/Appwrite/Models/AppInstallationList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppInstallationList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("installations")] + public List Installations { get; private set; } + + public AppInstallationList( + long total, + List installations + ) + { + Total = total; + Installations = installations; + } + + public static AppInstallationList From(Dictionary map) => new AppInstallationList( + total: Convert.ToInt64(map["total"]), + installations: map["installations"].ConvertToList>().Select(it => Appwrite.Models.AppInstallation.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "installations", Installations?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/AppKey.cs b/Appwrite/Models/AppKey.cs new file mode 100644 index 00000000..ba98c012 --- /dev/null +++ b/Appwrite/Models/AppKey.cs @@ -0,0 +1,89 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppKey + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("secret")] + public string Secret { get; private set; } + + [JsonPropertyName("hint")] + public string Hint { get; private set; } + + [JsonPropertyName("createdById")] + public string CreatedById { get; private set; } + + [JsonPropertyName("createdByName")] + public string CreatedByName { get; private set; } + + [JsonPropertyName("lastAccessedAt")] + public string? LastAccessedAt { get; private set; } + + public AppKey( + string id, + string createdAt, + string updatedAt, + string appId, + string secret, + string hint, + string createdById, + string createdByName, + string? lastAccessedAt + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + AppId = appId; + Secret = secret; + Hint = hint; + CreatedById = createdById; + CreatedByName = createdByName; + LastAccessedAt = lastAccessedAt; + } + + public static AppKey From(Dictionary map) => new AppKey( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + appId: map["appId"].ToString(), + secret: map["secret"].ToString(), + hint: map["hint"].ToString(), + createdById: map["createdById"].ToString(), + createdByName: map["createdByName"].ToString(), + lastAccessedAt: map.TryGetValue("lastAccessedAt", out var lastAccessedAt) ? lastAccessedAt?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "appId", AppId }, + { "secret", Secret }, + { "hint", Hint }, + { "createdById", CreatedById }, + { "createdByName", CreatedByName }, + { "lastAccessedAt", LastAccessedAt } + }; + } +} diff --git a/Appwrite/Models/AppKeyList.cs b/Appwrite/Models/AppKeyList.cs new file mode 100644 index 00000000..ea0a40b2 --- /dev/null +++ b/Appwrite/Models/AppKeyList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppKeyList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("keys")] + public List Keys { get; private set; } + + public AppKeyList( + long total, + List keys + ) + { + Total = total; + Keys = keys; + } + + public static AppKeyList From(Dictionary map) => new AppKeyList( + total: Convert.ToInt64(map["total"]), + keys: map["keys"].ConvertToList>().Select(it => Appwrite.Models.AppKey.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "keys", Keys?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/AppScope.cs b/Appwrite/Models/AppScope.cs new file mode 100644 index 00000000..8426fc01 --- /dev/null +++ b/Appwrite/Models/AppScope.cs @@ -0,0 +1,61 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppScope + { + [JsonPropertyName("value")] + public string Value { get; private set; } + + [JsonPropertyName("description")] + public string Description { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("category")] + public string Category { get; private set; } + + [JsonPropertyName("deprecated")] + public bool Deprecated { get; private set; } + + public AppScope( + string @value, + string description, + string type, + string category, + bool deprecated + ) + { + Value = @value; + Description = description; + Type = type; + Category = category; + Deprecated = deprecated; + } + + public static AppScope From(Dictionary map) => new AppScope( + @value: map["value"].ToString(), + description: map["description"].ToString(), + type: map["type"].ToString(), + category: map["category"].ToString(), + deprecated: (bool)map["deprecated"] + ); + + public Dictionary ToMap() => new Dictionary() + { + { "value", Value }, + { "description", Description }, + { "type", Type }, + { "category", Category }, + { "deprecated", Deprecated } + }; + } +} diff --git a/Appwrite/Models/AppScopeList.cs b/Appwrite/Models/AppScopeList.cs new file mode 100644 index 00000000..f284b002 --- /dev/null +++ b/Appwrite/Models/AppScopeList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppScopeList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("scopes")] + public List Scopes { get; private set; } + + public AppScopeList( + long total, + List scopes + ) + { + Total = total; + Scopes = scopes; + } + + public static AppScopeList From(Dictionary map) => new AppScopeList( + total: Convert.ToInt64(map["total"]), + scopes: map["scopes"].ConvertToList>().Select(it => Appwrite.Models.AppScope.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "scopes", Scopes?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/AppSecret.cs b/Appwrite/Models/AppSecret.cs new file mode 100644 index 00000000..3c7f9156 --- /dev/null +++ b/Appwrite/Models/AppSecret.cs @@ -0,0 +1,89 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppSecret + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("secret")] + public string Secret { get; private set; } + + [JsonPropertyName("hint")] + public string Hint { get; private set; } + + [JsonPropertyName("createdById")] + public string CreatedById { get; private set; } + + [JsonPropertyName("createdByName")] + public string CreatedByName { get; private set; } + + [JsonPropertyName("lastAccessedAt")] + public string? LastAccessedAt { get; private set; } + + public AppSecret( + string id, + string createdAt, + string updatedAt, + string appId, + string secret, + string hint, + string createdById, + string createdByName, + string? lastAccessedAt + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + AppId = appId; + Secret = secret; + Hint = hint; + CreatedById = createdById; + CreatedByName = createdByName; + LastAccessedAt = lastAccessedAt; + } + + public static AppSecret From(Dictionary map) => new AppSecret( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + appId: map["appId"].ToString(), + secret: map["secret"].ToString(), + hint: map["hint"].ToString(), + createdById: map["createdById"].ToString(), + createdByName: map["createdByName"].ToString(), + lastAccessedAt: map.TryGetValue("lastAccessedAt", out var lastAccessedAt) ? lastAccessedAt?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "appId", AppId }, + { "secret", Secret }, + { "hint", Hint }, + { "createdById", CreatedById }, + { "createdByName", CreatedByName }, + { "lastAccessedAt", LastAccessedAt } + }; + } +} diff --git a/Appwrite/Models/AppSecretList.cs b/Appwrite/Models/AppSecretList.cs new file mode 100644 index 00000000..9730bfae --- /dev/null +++ b/Appwrite/Models/AppSecretList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppSecretList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("secrets")] + public List Secrets { get; private set; } + + public AppSecretList( + long total, + List secrets + ) + { + Total = total; + Secrets = secrets; + } + + public static AppSecretList From(Dictionary map) => new AppSecretList( + total: Convert.ToInt64(map["total"]), + secrets: map["secrets"].ConvertToList>().Select(it => Appwrite.Models.AppSecret.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "secrets", Secrets?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/AppSecretPlaintext.cs b/Appwrite/Models/AppSecretPlaintext.cs new file mode 100644 index 00000000..0fe131b7 --- /dev/null +++ b/Appwrite/Models/AppSecretPlaintext.cs @@ -0,0 +1,89 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppSecretPlaintext + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("secret")] + public string Secret { get; private set; } + + [JsonPropertyName("hint")] + public string Hint { get; private set; } + + [JsonPropertyName("createdById")] + public string CreatedById { get; private set; } + + [JsonPropertyName("createdByName")] + public string CreatedByName { get; private set; } + + [JsonPropertyName("lastAccessedAt")] + public string? LastAccessedAt { get; private set; } + + public AppSecretPlaintext( + string id, + string createdAt, + string updatedAt, + string appId, + string secret, + string hint, + string createdById, + string createdByName, + string? lastAccessedAt + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + AppId = appId; + Secret = secret; + Hint = hint; + CreatedById = createdById; + CreatedByName = createdByName; + LastAccessedAt = lastAccessedAt; + } + + public static AppSecretPlaintext From(Dictionary map) => new AppSecretPlaintext( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + appId: map["appId"].ToString(), + secret: map["secret"].ToString(), + hint: map["hint"].ToString(), + createdById: map["createdById"].ToString(), + createdByName: map["createdByName"].ToString(), + lastAccessedAt: map.TryGetValue("lastAccessedAt", out var lastAccessedAt) ? lastAccessedAt?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "appId", AppId }, + { "secret", Secret }, + { "hint", Hint }, + { "createdById", CreatedById }, + { "createdByName", CreatedByName }, + { "lastAccessedAt", LastAccessedAt } + }; + } +} diff --git a/Appwrite/Models/AppsList.cs b/Appwrite/Models/AppsList.cs new file mode 100644 index 00000000..f54516e1 --- /dev/null +++ b/Appwrite/Models/AppsList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class AppsList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("apps")] + public List Apps { get; private set; } + + public AppsList( + long total, + List apps + ) + { + Total = total; + Apps = apps; + } + + public static AppsList From(Dictionary map) => new AppsList( + total: Convert.ToInt64(map["total"]), + apps: map["apps"].ConvertToList>().Select(it => Appwrite.Models.App.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "apps", Apps?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/AttributeBigint.cs b/Appwrite/Models/AttributeBigint.cs index dc1feff9..416ef66c 100644 --- a/Appwrite/Models/AttributeBigint.cs +++ b/Appwrite/Models/AttributeBigint.cs @@ -18,7 +18,7 @@ public class AttributeBigint public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class AttributeBigint public AttributeBigint( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public AttributeBigint( public static AttributeBigint From(Dictionary map) => new AttributeBigint( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeBoolean.cs b/Appwrite/Models/AttributeBoolean.cs index 1c955c6d..bd5b8b1e 100644 --- a/Appwrite/Models/AttributeBoolean.cs +++ b/Appwrite/Models/AttributeBoolean.cs @@ -18,7 +18,7 @@ public class AttributeBoolean public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class AttributeBoolean public AttributeBoolean( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public AttributeBoolean( public static AttributeBoolean From(Dictionary map) => new AttributeBoolean( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeDatetime.cs b/Appwrite/Models/AttributeDatetime.cs index 4eeb1701..214f32e9 100644 --- a/Appwrite/Models/AttributeDatetime.cs +++ b/Appwrite/Models/AttributeDatetime.cs @@ -18,7 +18,7 @@ public class AttributeDatetime public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeDatetime public AttributeDatetime( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeDatetime( public static AttributeDatetime From(Dictionary map) => new AttributeDatetime( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeEmail.cs b/Appwrite/Models/AttributeEmail.cs index 7ea11286..a3cb390d 100644 --- a/Appwrite/Models/AttributeEmail.cs +++ b/Appwrite/Models/AttributeEmail.cs @@ -18,7 +18,7 @@ public class AttributeEmail public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeEmail public AttributeEmail( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeEmail( public static AttributeEmail From(Dictionary map) => new AttributeEmail( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeEnum.cs b/Appwrite/Models/AttributeEnum.cs index 474baaa6..387a4947 100644 --- a/Appwrite/Models/AttributeEnum.cs +++ b/Appwrite/Models/AttributeEnum.cs @@ -18,7 +18,7 @@ public class AttributeEnum public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class AttributeEnum public AttributeEnum( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public AttributeEnum( public static AttributeEnum From(Dictionary map) => new AttributeEnum( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeFloat.cs b/Appwrite/Models/AttributeFloat.cs index 21353a09..ec166677 100644 --- a/Appwrite/Models/AttributeFloat.cs +++ b/Appwrite/Models/AttributeFloat.cs @@ -18,7 +18,7 @@ public class AttributeFloat public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class AttributeFloat public AttributeFloat( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public AttributeFloat( public static AttributeFloat From(Dictionary map) => new AttributeFloat( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeInteger.cs b/Appwrite/Models/AttributeInteger.cs index 37718dce..db12d723 100644 --- a/Appwrite/Models/AttributeInteger.cs +++ b/Appwrite/Models/AttributeInteger.cs @@ -18,7 +18,7 @@ public class AttributeInteger public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class AttributeInteger public AttributeInteger( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public AttributeInteger( public static AttributeInteger From(Dictionary map) => new AttributeInteger( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeIp.cs b/Appwrite/Models/AttributeIp.cs index 85368219..ca2d5275 100644 --- a/Appwrite/Models/AttributeIp.cs +++ b/Appwrite/Models/AttributeIp.cs @@ -18,7 +18,7 @@ public class AttributeIp public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeIp public AttributeIp( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeIp( public static AttributeIp From(Dictionary map) => new AttributeIp( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeLine.cs b/Appwrite/Models/AttributeLine.cs index 8180fa75..4d7c00a6 100644 --- a/Appwrite/Models/AttributeLine.cs +++ b/Appwrite/Models/AttributeLine.cs @@ -18,7 +18,7 @@ public class AttributeLine public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class AttributeLine public AttributeLine( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public AttributeLine( public static AttributeLine From(Dictionary map) => new AttributeLine( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeLongtext.cs b/Appwrite/Models/AttributeLongtext.cs index 0efc01f6..68026989 100644 --- a/Appwrite/Models/AttributeLongtext.cs +++ b/Appwrite/Models/AttributeLongtext.cs @@ -18,7 +18,7 @@ public class AttributeLongtext public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeLongtext public AttributeLongtext( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeLongtext( public static AttributeLongtext From(Dictionary map) => new AttributeLongtext( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeMediumtext.cs b/Appwrite/Models/AttributeMediumtext.cs index e21bb3f3..9bd21121 100644 --- a/Appwrite/Models/AttributeMediumtext.cs +++ b/Appwrite/Models/AttributeMediumtext.cs @@ -18,7 +18,7 @@ public class AttributeMediumtext public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeMediumtext public AttributeMediumtext( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeMediumtext( public static AttributeMediumtext From(Dictionary map) => new AttributeMediumtext( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributePoint.cs b/Appwrite/Models/AttributePoint.cs index 80256bd2..0d0baf53 100644 --- a/Appwrite/Models/AttributePoint.cs +++ b/Appwrite/Models/AttributePoint.cs @@ -18,7 +18,7 @@ public class AttributePoint public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class AttributePoint public AttributePoint( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public AttributePoint( public static AttributePoint From(Dictionary map) => new AttributePoint( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributePolygon.cs b/Appwrite/Models/AttributePolygon.cs index 4934c95e..dc8dc60a 100644 --- a/Appwrite/Models/AttributePolygon.cs +++ b/Appwrite/Models/AttributePolygon.cs @@ -18,7 +18,7 @@ public class AttributePolygon public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class AttributePolygon public AttributePolygon( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public AttributePolygon( public static AttributePolygon From(Dictionary map) => new AttributePolygon( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeRelationship.cs b/Appwrite/Models/AttributeRelationship.cs index b94014f8..3945bc1e 100644 --- a/Appwrite/Models/AttributeRelationship.cs +++ b/Appwrite/Models/AttributeRelationship.cs @@ -18,7 +18,7 @@ public class AttributeRelationship public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -56,7 +56,7 @@ public class AttributeRelationship public AttributeRelationship( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -89,7 +89,7 @@ string side public static AttributeRelationship From(Dictionary map) => new AttributeRelationship( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeString.cs b/Appwrite/Models/AttributeString.cs index 28f3019a..23bfd3ae 100644 --- a/Appwrite/Models/AttributeString.cs +++ b/Appwrite/Models/AttributeString.cs @@ -18,7 +18,7 @@ public class AttributeString public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class AttributeString public AttributeString( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public AttributeString( public static AttributeString From(Dictionary map) => new AttributeString( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeText.cs b/Appwrite/Models/AttributeText.cs index 79c8828c..231cf4a5 100644 --- a/Appwrite/Models/AttributeText.cs +++ b/Appwrite/Models/AttributeText.cs @@ -18,7 +18,7 @@ public class AttributeText public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeText public AttributeText( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeText( public static AttributeText From(Dictionary map) => new AttributeText( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeUrl.cs b/Appwrite/Models/AttributeUrl.cs index 0114ec52..68b5ebb7 100644 --- a/Appwrite/Models/AttributeUrl.cs +++ b/Appwrite/Models/AttributeUrl.cs @@ -18,7 +18,7 @@ public class AttributeUrl public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class AttributeUrl public AttributeUrl( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public AttributeUrl( public static AttributeUrl From(Dictionary map) => new AttributeUrl( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/AttributeVarchar.cs b/Appwrite/Models/AttributeVarchar.cs index 5d16aa0a..a3f407b0 100644 --- a/Appwrite/Models/AttributeVarchar.cs +++ b/Appwrite/Models/AttributeVarchar.cs @@ -18,7 +18,7 @@ public class AttributeVarchar public string Type { get; private set; } [JsonPropertyName("status")] - public AttributeStatus Status { get; private set; } + public Appwrite.Enums.AttributeStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class AttributeVarchar public AttributeVarchar( string key, string type, - AttributeStatus status, + Appwrite.Enums.AttributeStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public AttributeVarchar( public static AttributeVarchar From(Dictionary map) => new AttributeVarchar( key: map["key"].ToString(), type: map["type"].ToString(), - status: new AttributeStatus(map["status"].ToString()!), + status: new Appwrite.Enums.AttributeStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/BillingPlan.cs b/Appwrite/Models/BillingPlan.cs index 0c05ee92..ac8c218e 100644 --- a/Appwrite/Models/BillingPlan.cs +++ b/Appwrite/Models/BillingPlan.cs @@ -47,6 +47,9 @@ public class BillingPlan [JsonPropertyName("webhooks")] public long Webhooks { get; private set; } + [JsonPropertyName("wafRules")] + public long WafRules { get; private set; } + [JsonPropertyName("projects")] public long Projects { get; private set; } @@ -207,7 +210,7 @@ public class BillingPlan public BillingPlanLimits? Limits { get; private set; } [JsonPropertyName("group")] - public BillingPlanGroup Group { get; private set; } + public Appwrite.Enums.BillingPlanGroup Group { get; private set; } [JsonPropertyName("program")] public Program? Program { get; private set; } @@ -228,6 +231,7 @@ public BillingPlan( long screenshotsGenerated, long members, long webhooks, + long wafRules, long projects, long platforms, long users, @@ -281,7 +285,7 @@ public BillingPlan( long buildSize, bool databasesAllowEncrypt, BillingPlanLimits? limits, - BillingPlanGroup @group, + Appwrite.Enums.BillingPlanGroup @group, Program? program, BillingPlanDedicatedDatabaseLimits? dedicatedDatabases ) @@ -298,6 +302,7 @@ public BillingPlan( ScreenshotsGenerated = screenshotsGenerated; Members = members; Webhooks = webhooks; + WafRules = wafRules; Projects = projects; Platforms = platforms; Users = users; @@ -369,6 +374,7 @@ public BillingPlan( screenshotsGenerated: Convert.ToInt64(map["screenshotsGenerated"]), members: Convert.ToInt64(map["members"]), webhooks: Convert.ToInt64(map["webhooks"]), + wafRules: Convert.ToInt64(map["wafRules"]), projects: Convert.ToInt64(map["projects"]), platforms: Convert.ToInt64(map["platforms"]), users: Convert.ToInt64(map["users"]), @@ -392,13 +398,13 @@ public BillingPlan( domains: Convert.ToInt64(map["domains"]), activityLogs: Convert.ToInt64(map["activityLogs"]), usageLogs: Convert.ToInt64(map["usageLogs"]), - usageLogsIntervals: map.TryGetValue("usageLogsIntervals", out var arrayRaw36) && arrayRaw36 != null - ? arrayRaw36.ConvertToList() + usageLogsIntervals: map.TryGetValue("usageLogsIntervals", out var arrayRaw37) && arrayRaw37 != null + ? arrayRaw37.ConvertToList() : null, projectInactivityDays: Convert.ToInt64(map["projectInactivityDays"]), alertLimit: Convert.ToInt64(map["alertLimit"]), - usage: Appwrite.Models.UsageBillingPlan.From(map: map["usage"] is JsonElement jsonObj39 ? jsonObj39.Deserialize>()! : (Dictionary)map["usage"]), - addons: Appwrite.Models.BillingPlanAddon.From(map: map["addons"] is JsonElement jsonObj40 ? jsonObj40.Deserialize>()! : (Dictionary)map["addons"]), + usage: Appwrite.Models.UsageBillingPlan.From(map: map["usage"] is JsonElement jsonObj40 ? jsonObj40.Deserialize>()! : (Dictionary)map["usage"]), + addons: Appwrite.Models.BillingPlanAddon.From(map: map["addons"] is JsonElement jsonObj41 ? jsonObj41.Deserialize>()! : (Dictionary)map["addons"]), budgetCapEnabled: (bool)map["budgetCapEnabled"], customSmtp: (bool)map["customSmtp"], emailBranding: (bool)map["emailBranding"], @@ -418,20 +424,20 @@ public BillingPlan( supportsProjectSpecificRoles: (bool)map["supportsProjectSpecificRoles"], backupsEnabled: (bool)map["backupsEnabled"], usagePerProject: (bool)map["usagePerProject"], - supportedAddons: Appwrite.Models.BillingPlanSupportedAddons.From(map: map["supportedAddons"] is JsonElement jsonObj60 ? jsonObj60.Deserialize>()! : (Dictionary)map["supportedAddons"]), + supportedAddons: Appwrite.Models.BillingPlanSupportedAddons.From(map: map["supportedAddons"] is JsonElement jsonObj61 ? jsonObj61.Deserialize>()! : (Dictionary)map["supportedAddons"]), backupPolicies: Convert.ToInt64(map["backupPolicies"]), deploymentSize: Convert.ToInt64(map["deploymentSize"]), buildSize: Convert.ToInt64(map["buildSize"]), databasesAllowEncrypt: (bool)map["databasesAllowEncrypt"], - limits: map.TryGetValue("limits", out var objectRaw65) && objectRaw65 != null - ? Appwrite.Models.BillingPlanLimits.From(map: objectRaw65 is JsonElement jsonObj65 ? jsonObj65.Deserialize>()! : (Dictionary)objectRaw65) + limits: map.TryGetValue("limits", out var objectRaw66) && objectRaw66 != null + ? Appwrite.Models.BillingPlanLimits.From(map: objectRaw66 is JsonElement jsonObj66 ? jsonObj66.Deserialize>()! : (Dictionary)objectRaw66) : null, - @group: new BillingPlanGroup(map["group"].ToString()!), - program: map.TryGetValue("program", out var objectRaw67) && objectRaw67 != null - ? Appwrite.Models.Program.From(map: objectRaw67 is JsonElement jsonObj67 ? jsonObj67.Deserialize>()! : (Dictionary)objectRaw67) + @group: new Appwrite.Enums.BillingPlanGroup(map["group"].ToString()!), + program: map.TryGetValue("program", out var objectRaw68) && objectRaw68 != null + ? Appwrite.Models.Program.From(map: objectRaw68 is JsonElement jsonObj68 ? jsonObj68.Deserialize>()! : (Dictionary)objectRaw68) : null, - dedicatedDatabases: map.TryGetValue("dedicatedDatabases", out var objectRaw68) && objectRaw68 != null - ? Appwrite.Models.BillingPlanDedicatedDatabaseLimits.From(map: objectRaw68 is JsonElement jsonObj68 ? jsonObj68.Deserialize>()! : (Dictionary)objectRaw68) + dedicatedDatabases: map.TryGetValue("dedicatedDatabases", out var objectRaw69) && objectRaw69 != null + ? Appwrite.Models.BillingPlanDedicatedDatabaseLimits.From(map: objectRaw69 is JsonElement jsonObj69 ? jsonObj69.Deserialize>()! : (Dictionary)objectRaw69) : null ); @@ -449,6 +455,7 @@ public BillingPlan( { "screenshotsGenerated", ScreenshotsGenerated }, { "members", Members }, { "webhooks", Webhooks }, + { "wafRules", WafRules }, { "projects", Projects }, { "platforms", Platforms }, { "users", Users }, diff --git a/Appwrite/Models/ColumnBigint.cs b/Appwrite/Models/ColumnBigint.cs index d4408c40..22b344bd 100644 --- a/Appwrite/Models/ColumnBigint.cs +++ b/Appwrite/Models/ColumnBigint.cs @@ -18,7 +18,7 @@ public class ColumnBigint public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class ColumnBigint public ColumnBigint( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public ColumnBigint( public static ColumnBigint From(Dictionary map) => new ColumnBigint( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnBoolean.cs b/Appwrite/Models/ColumnBoolean.cs index 57fcb64e..f6fb093a 100644 --- a/Appwrite/Models/ColumnBoolean.cs +++ b/Appwrite/Models/ColumnBoolean.cs @@ -18,7 +18,7 @@ public class ColumnBoolean public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class ColumnBoolean public ColumnBoolean( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public ColumnBoolean( public static ColumnBoolean From(Dictionary map) => new ColumnBoolean( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnDatetime.cs b/Appwrite/Models/ColumnDatetime.cs index 1baefc45..3eb55e51 100644 --- a/Appwrite/Models/ColumnDatetime.cs +++ b/Appwrite/Models/ColumnDatetime.cs @@ -18,7 +18,7 @@ public class ColumnDatetime public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnDatetime public ColumnDatetime( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnDatetime( public static ColumnDatetime From(Dictionary map) => new ColumnDatetime( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnEmail.cs b/Appwrite/Models/ColumnEmail.cs index 9a907a84..96a5a952 100644 --- a/Appwrite/Models/ColumnEmail.cs +++ b/Appwrite/Models/ColumnEmail.cs @@ -18,7 +18,7 @@ public class ColumnEmail public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnEmail public ColumnEmail( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnEmail( public static ColumnEmail From(Dictionary map) => new ColumnEmail( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnEnum.cs b/Appwrite/Models/ColumnEnum.cs index f99c8f3f..9686f6f8 100644 --- a/Appwrite/Models/ColumnEnum.cs +++ b/Appwrite/Models/ColumnEnum.cs @@ -18,7 +18,7 @@ public class ColumnEnum public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class ColumnEnum public ColumnEnum( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public ColumnEnum( public static ColumnEnum From(Dictionary map) => new ColumnEnum( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnFloat.cs b/Appwrite/Models/ColumnFloat.cs index 75e6c747..98636303 100644 --- a/Appwrite/Models/ColumnFloat.cs +++ b/Appwrite/Models/ColumnFloat.cs @@ -18,7 +18,7 @@ public class ColumnFloat public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class ColumnFloat public ColumnFloat( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public ColumnFloat( public static ColumnFloat From(Dictionary map) => new ColumnFloat( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnInteger.cs b/Appwrite/Models/ColumnInteger.cs index 52b99cd7..21b6d927 100644 --- a/Appwrite/Models/ColumnInteger.cs +++ b/Appwrite/Models/ColumnInteger.cs @@ -18,7 +18,7 @@ public class ColumnInteger public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class ColumnInteger public ColumnInteger( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public ColumnInteger( public static ColumnInteger From(Dictionary map) => new ColumnInteger( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnIp.cs b/Appwrite/Models/ColumnIp.cs index dac7ded9..ce1e4675 100644 --- a/Appwrite/Models/ColumnIp.cs +++ b/Appwrite/Models/ColumnIp.cs @@ -18,7 +18,7 @@ public class ColumnIp public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnIp public ColumnIp( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnIp( public static ColumnIp From(Dictionary map) => new ColumnIp( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnLine.cs b/Appwrite/Models/ColumnLine.cs index a941803d..2f22e9d2 100644 --- a/Appwrite/Models/ColumnLine.cs +++ b/Appwrite/Models/ColumnLine.cs @@ -18,7 +18,7 @@ public class ColumnLine public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class ColumnLine public ColumnLine( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public ColumnLine( public static ColumnLine From(Dictionary map) => new ColumnLine( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnLongtext.cs b/Appwrite/Models/ColumnLongtext.cs index 304da072..68bad03d 100644 --- a/Appwrite/Models/ColumnLongtext.cs +++ b/Appwrite/Models/ColumnLongtext.cs @@ -18,7 +18,7 @@ public class ColumnLongtext public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnLongtext public ColumnLongtext( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnLongtext( public static ColumnLongtext From(Dictionary map) => new ColumnLongtext( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnMediumtext.cs b/Appwrite/Models/ColumnMediumtext.cs index f54b9e3c..6a16f369 100644 --- a/Appwrite/Models/ColumnMediumtext.cs +++ b/Appwrite/Models/ColumnMediumtext.cs @@ -18,7 +18,7 @@ public class ColumnMediumtext public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnMediumtext public ColumnMediumtext( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnMediumtext( public static ColumnMediumtext From(Dictionary map) => new ColumnMediumtext( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnPoint.cs b/Appwrite/Models/ColumnPoint.cs index 55968a40..77450962 100644 --- a/Appwrite/Models/ColumnPoint.cs +++ b/Appwrite/Models/ColumnPoint.cs @@ -18,7 +18,7 @@ public class ColumnPoint public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class ColumnPoint public ColumnPoint( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public ColumnPoint( public static ColumnPoint From(Dictionary map) => new ColumnPoint( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnPolygon.cs b/Appwrite/Models/ColumnPolygon.cs index 6ed47a6c..8d5c7256 100644 --- a/Appwrite/Models/ColumnPolygon.cs +++ b/Appwrite/Models/ColumnPolygon.cs @@ -18,7 +18,7 @@ public class ColumnPolygon public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -41,7 +41,7 @@ public class ColumnPolygon public ColumnPolygon( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -64,7 +64,7 @@ public ColumnPolygon( public static ColumnPolygon From(Dictionary map) => new ColumnPolygon( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnRelationship.cs b/Appwrite/Models/ColumnRelationship.cs index 6cf3d2dc..fb9d77a2 100644 --- a/Appwrite/Models/ColumnRelationship.cs +++ b/Appwrite/Models/ColumnRelationship.cs @@ -18,7 +18,7 @@ public class ColumnRelationship public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -56,7 +56,7 @@ public class ColumnRelationship public ColumnRelationship( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -89,7 +89,7 @@ string side public static ColumnRelationship From(Dictionary map) => new ColumnRelationship( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnString.cs b/Appwrite/Models/ColumnString.cs index f4bdbff9..974ff69a 100644 --- a/Appwrite/Models/ColumnString.cs +++ b/Appwrite/Models/ColumnString.cs @@ -18,7 +18,7 @@ public class ColumnString public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class ColumnString public ColumnString( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public ColumnString( public static ColumnString From(Dictionary map) => new ColumnString( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnText.cs b/Appwrite/Models/ColumnText.cs index 75cdc4a5..da4d9806 100644 --- a/Appwrite/Models/ColumnText.cs +++ b/Appwrite/Models/ColumnText.cs @@ -18,7 +18,7 @@ public class ColumnText public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnText public ColumnText( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnText( public static ColumnText From(Dictionary map) => new ColumnText( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnUrl.cs b/Appwrite/Models/ColumnUrl.cs index 092029b0..7250ade6 100644 --- a/Appwrite/Models/ColumnUrl.cs +++ b/Appwrite/Models/ColumnUrl.cs @@ -18,7 +18,7 @@ public class ColumnUrl public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -44,7 +44,7 @@ public class ColumnUrl public ColumnUrl( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -69,7 +69,7 @@ public ColumnUrl( public static ColumnUrl From(Dictionary map) => new ColumnUrl( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/ColumnVarchar.cs b/Appwrite/Models/ColumnVarchar.cs index f37860b7..7659a677 100644 --- a/Appwrite/Models/ColumnVarchar.cs +++ b/Appwrite/Models/ColumnVarchar.cs @@ -18,7 +18,7 @@ public class ColumnVarchar public string Type { get; private set; } [JsonPropertyName("status")] - public ColumnStatus Status { get; private set; } + public Appwrite.Enums.ColumnStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public class ColumnVarchar public ColumnVarchar( string key, string type, - ColumnStatus status, + Appwrite.Enums.ColumnStatus status, string error, bool required, bool? array, @@ -74,7 +74,7 @@ public ColumnVarchar( public static ColumnVarchar From(Dictionary map) => new ColumnVarchar( key: map["key"].ToString(), type: map["type"].ToString(), - status: new ColumnStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ColumnStatus(map["status"].ToString()!), error: map["error"].ToString(), required: (bool)map["required"], array: map.TryGetValue("array", out var boolRaw6) && boolRaw6 != null diff --git a/Appwrite/Models/Database.cs b/Appwrite/Models/Database.cs index 31822325..c1ade276 100644 --- a/Appwrite/Models/Database.cs +++ b/Appwrite/Models/Database.cs @@ -27,16 +27,25 @@ public class Database public bool Enabled { get; private set; } [JsonPropertyName("type")] - public DatabaseType Type { get; private set; } + public Appwrite.Enums.DatabaseType Type { get; private set; } [JsonPropertyName("status")] - public DatabaseStatus? Status { get; private set; } + public Appwrite.Enums.DatabaseStatus? Status { get; private set; } + + [JsonPropertyName("engine")] + public string? Engine { get; private set; } + + [JsonPropertyName("specification")] + public string? Specification { get; private set; } + + [JsonPropertyName("replicas")] + public long? Replicas { get; private set; } [JsonPropertyName("policies")] - public List Policies { get; private set; } + public List? Policies { get; private set; } [JsonPropertyName("archives")] - public List Archives { get; private set; } + public List? Archives { get; private set; } public Database( string id, @@ -44,10 +53,13 @@ public Database( string createdAt, string updatedAt, bool enabled, - DatabaseType type, - DatabaseStatus? status, - List policies, - List archives + Appwrite.Enums.DatabaseType type, + Appwrite.Enums.DatabaseStatus? status, + string? engine, + string? specification, + long? replicas, + List? policies, + List? archives ) { Id = id; @@ -57,6 +69,9 @@ List archives Enabled = enabled; Type = type; Status = status; + Engine = engine; + Specification = specification; + Replicas = replicas; Policies = policies; Archives = archives; } @@ -67,14 +82,23 @@ List archives createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), enabled: (bool)map["enabled"], - type: new DatabaseType(map["type"].ToString()!), + type: new Appwrite.Enums.DatabaseType(map["type"].ToString()!), status: map.TryGetValue("status", out var enumRaw7) ? enumRaw7 == null ? null - : new DatabaseStatus(enumRaw7.ToString()!) + : new Appwrite.Enums.DatabaseStatus(enumRaw7.ToString()!) : null, - policies: map["policies"].ConvertToList>().Select(it => Appwrite.Models.BackupPolicy.From(map: it)).ToList(), - archives: map["archives"].ConvertToList>().Select(it => Appwrite.Models.BackupArchive.From(map: it)).ToList() + engine: map.TryGetValue("engine", out var engine) ? engine?.ToString() : null, + specification: map.TryGetValue("specification", out var specification) ? specification?.ToString() : null, + replicas: map.TryGetValue("replicas", out var numberRaw10) && numberRaw10 != null + ? Convert.ToInt64(numberRaw10) + : null, + policies: map.TryGetValue("policies", out var arrayRaw11) && arrayRaw11 != null + ? arrayRaw11.ConvertToList>().Select(it => Appwrite.Models.BackupPolicy.From(map: it)).ToList() + : null, + archives: map.TryGetValue("archives", out var arrayRaw12) && arrayRaw12 != null + ? arrayRaw12.ConvertToList>().Select(it => Appwrite.Models.BackupArchive.From(map: it)).ToList() + : null ); public Dictionary ToMap() => new Dictionary() @@ -86,6 +110,9 @@ List archives { "enabled", Enabled }, { "type", Type.Value }, { "status", Status?.Value }, + { "engine", Engine }, + { "specification", Specification }, + { "replicas", Replicas }, { "policies", Policies?.Select(it => it.ToMap()).ToList() }, { "archives", Archives?.Select(it => it.ToMap()).ToList() } }; diff --git a/Appwrite/Models/DatabaseStatus.cs b/Appwrite/Models/DatabaseStatus.cs new file mode 100644 index 00000000..e5abcad2 --- /dev/null +++ b/Appwrite/Models/DatabaseStatus.cs @@ -0,0 +1,82 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DatabaseStatus + { + [JsonPropertyName("health")] + public string Health { get; private set; } + + [JsonPropertyName("ready")] + public bool Ready { get; private set; } + + [JsonPropertyName("engine")] + public string Engine { get; private set; } + + [JsonPropertyName("version")] + public string Version { get; private set; } + + [JsonPropertyName("uptime")] + public long Uptime { get; private set; } + + [JsonPropertyName("connections")] + public DatabaseStatusConnections Connections { get; private set; } + + [JsonPropertyName("replicas")] + public List Replicas { get; private set; } + + [JsonPropertyName("volumes")] + public List Volumes { get; private set; } + + public DatabaseStatus( + string health, + bool ready, + string engine, + string version, + long uptime, + DatabaseStatusConnections connections, + List replicas, + List volumes + ) + { + Health = health; + Ready = ready; + Engine = engine; + Version = version; + Uptime = uptime; + Connections = connections; + Replicas = replicas; + Volumes = volumes; + } + + public static DatabaseStatus From(Dictionary map) => new DatabaseStatus( + health: map["health"].ToString(), + ready: (bool)map["ready"], + engine: map["engine"].ToString(), + version: map["version"].ToString(), + uptime: Convert.ToInt64(map["uptime"]), + connections: Appwrite.Models.DatabaseStatusConnections.From(map: map["connections"] is JsonElement jsonObj6 ? jsonObj6.Deserialize>()! : (Dictionary)map["connections"]), + replicas: map["replicas"].ConvertToList>().Select(it => Appwrite.Models.DatabaseStatusReplica.From(map: it)).ToList(), + volumes: map["volumes"].ConvertToList>().Select(it => Appwrite.Models.DatabaseStatusVolume.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "health", Health }, + { "ready", Ready }, + { "engine", Engine }, + { "version", Version }, + { "uptime", Uptime }, + { "connections", Connections?.ToMap() }, + { "replicas", Replicas?.Select(it => it.ToMap()).ToList() }, + { "volumes", Volumes?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/DatabaseStatusConnections.cs b/Appwrite/Models/DatabaseStatusConnections.cs new file mode 100644 index 00000000..4a1de49a --- /dev/null +++ b/Appwrite/Models/DatabaseStatusConnections.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DatabaseStatusConnections + { + [JsonPropertyName("current")] + public long Current { get; private set; } + + [JsonPropertyName("max")] + public long Max { get; private set; } + + public DatabaseStatusConnections( + long current, + long max + ) + { + Current = current; + Max = max; + } + + public static DatabaseStatusConnections From(Dictionary map) => new DatabaseStatusConnections( + current: Convert.ToInt64(map["current"]), + max: Convert.ToInt64(map["max"]) + ); + + public Dictionary ToMap() => new Dictionary() + { + { "current", Current }, + { "max", Max } + }; + } +} diff --git a/Appwrite/Models/DatabaseStatusReplica.cs b/Appwrite/Models/DatabaseStatusReplica.cs new file mode 100644 index 00000000..b5b8442b --- /dev/null +++ b/Appwrite/Models/DatabaseStatusReplica.cs @@ -0,0 +1,56 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DatabaseStatusReplica + { + [JsonPropertyName("index")] + public long Index { get; private set; } + + [JsonPropertyName("role")] + public string Role { get; private set; } + + [JsonPropertyName("healthy")] + public bool Healthy { get; private set; } + + [JsonPropertyName("lagSeconds")] + public double? LagSeconds { get; private set; } + + public DatabaseStatusReplica( + long index, + string role, + bool healthy, + double? lagSeconds + ) + { + Index = index; + Role = role; + Healthy = healthy; + LagSeconds = lagSeconds; + } + + public static DatabaseStatusReplica From(Dictionary map) => new DatabaseStatusReplica( + index: Convert.ToInt64(map["index"]), + role: map["role"].ToString(), + healthy: (bool)map["healthy"], + lagSeconds: map.TryGetValue("lagSeconds", out var numberRaw4) && numberRaw4 != null + ? Convert.ToDouble(numberRaw4) + : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "index", Index }, + { "role", Role }, + { "healthy", Healthy }, + { "lagSeconds", LagSeconds } + }; + } +} diff --git a/Appwrite/Models/DatabaseStatusVolume.cs b/Appwrite/Models/DatabaseStatusVolume.cs new file mode 100644 index 00000000..8fe63d8a --- /dev/null +++ b/Appwrite/Models/DatabaseStatusVolume.cs @@ -0,0 +1,54 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DatabaseStatusVolume + { + [JsonPropertyName("path")] + public string Path { get; private set; } + + [JsonPropertyName("usedPercent")] + public string UsedPercent { get; private set; } + + [JsonPropertyName("available")] + public string Available { get; private set; } + + [JsonPropertyName("mounted")] + public bool Mounted { get; private set; } + + public DatabaseStatusVolume( + string @path, + string usedPercent, + string available, + bool mounted + ) + { + Path = @path; + UsedPercent = usedPercent; + Available = available; + Mounted = mounted; + } + + public static DatabaseStatusVolume From(Dictionary map) => new DatabaseStatusVolume( + @path: map["path"].ToString(), + usedPercent: map["usedPercent"].ToString(), + available: map["available"].ToString(), + mounted: (bool)map["mounted"] + ); + + public Dictionary ToMap() => new Dictionary() + { + { "path", Path }, + { "usedPercent", UsedPercent }, + { "available", Available }, + { "mounted", Mounted } + }; + } +} diff --git a/Appwrite/Models/DedicatedDatabase.cs b/Appwrite/Models/DedicatedDatabase.cs new file mode 100644 index 00000000..23c8fd07 --- /dev/null +++ b/Appwrite/Models/DedicatedDatabase.cs @@ -0,0 +1,369 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DedicatedDatabase + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("projectId")] + public string ProjectId { get; private set; } + + [JsonPropertyName("name")] + public string Name { get; private set; } + + [JsonPropertyName("api")] + public string Api { get; private set; } + + [JsonPropertyName("engine")] + public string Engine { get; private set; } + + [JsonPropertyName("version")] + public string Version { get; private set; } + + [JsonPropertyName("specification")] + public string Specification { get; private set; } + + [JsonPropertyName("backend")] + public string Backend { get; private set; } + + [JsonPropertyName("hostname")] + public string Hostname { get; private set; } + + [JsonPropertyName("connectionPort")] + public long ConnectionPort { get; private set; } + + [JsonPropertyName("connectionUser")] + public string ConnectionUser { get; private set; } + + [JsonPropertyName("connectionPassword")] + public string ConnectionPassword { get; private set; } + + [JsonPropertyName("connectionString")] + public string ConnectionString { get; private set; } + + [JsonPropertyName("ssl")] + public bool Ssl { get; private set; } + + [JsonPropertyName("status")] + public string Status { get; private set; } + + [JsonPropertyName("containerStatus")] + public string ContainerStatus { get; private set; } + + [JsonPropertyName("lastAccessedAt")] + public string? LastAccessedAt { get; private set; } + + [JsonPropertyName("idleUntil")] + public string? IdleUntil { get; private set; } + + [JsonPropertyName("lifecycleState")] + public string LifecycleState { get; private set; } + + [JsonPropertyName("idleTimeoutMinutes")] + public long IdleTimeoutMinutes { get; private set; } + + [JsonPropertyName("cpu")] + public long Cpu { get; private set; } + + [JsonPropertyName("memory")] + public long Memory { get; private set; } + + [JsonPropertyName("storage")] + public long Storage { get; private set; } + + [JsonPropertyName("storageClass")] + public string StorageClass { get; private set; } + + [JsonPropertyName("storageMaxGb")] + public long StorageMaxGb { get; private set; } + + [JsonPropertyName("nodePool")] + public string NodePool { get; private set; } + + [JsonPropertyName("replicas")] + public long Replicas { get; private set; } + + [JsonPropertyName("syncMode")] + public string SyncMode { get; private set; } + + [JsonPropertyName("crossRegionReplicas")] + public long CrossRegionReplicas { get; private set; } + + [JsonPropertyName("networkMaxConnections")] + public long NetworkMaxConnections { get; private set; } + + [JsonPropertyName("networkIdleTimeoutSeconds")] + public long NetworkIdleTimeoutSeconds { get; private set; } + + [JsonPropertyName("networkIPAllowlist")] + public List NetworkIPAllowlist { get; private set; } + + [JsonPropertyName("backupEnabled")] + public bool BackupEnabled { get; private set; } + + [JsonPropertyName("pitr")] + public bool Pitr { get; private set; } + + [JsonPropertyName("pitrRetentionDays")] + public long PitrRetentionDays { get; private set; } + + [JsonPropertyName("storageAutoscaling")] + public bool StorageAutoscaling { get; private set; } + + [JsonPropertyName("storageAutoscalingThresholdPercent")] + public long StorageAutoscalingThresholdPercent { get; private set; } + + [JsonPropertyName("storageAutoscalingMaxGb")] + public long StorageAutoscalingMaxGb { get; private set; } + + [JsonPropertyName("maintenanceWindowDay")] + public string MaintenanceWindowDay { get; private set; } + + [JsonPropertyName("maintenanceWindowHourUtc")] + public long MaintenanceWindowHourUtc { get; private set; } + + [JsonPropertyName("metricsEnabled")] + public bool MetricsEnabled { get; private set; } + + [JsonPropertyName("sqlApiEnabled")] + public bool SqlApiEnabled { get; private set; } + + [JsonPropertyName("sqlApiAllowedStatements")] + public List SqlApiAllowedStatements { get; private set; } + + [JsonPropertyName("sqlApiMaxRows")] + public long SqlApiMaxRows { get; private set; } + + [JsonPropertyName("sqlApiMaxBytes")] + public long SqlApiMaxBytes { get; private set; } + + [JsonPropertyName("sqlApiTimeoutSeconds")] + public long SqlApiTimeoutSeconds { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + public DedicatedDatabase( + string id, + string createdAt, + string updatedAt, + string projectId, + string name, + string api, + string engine, + string version, + string specification, + string backend, + string hostname, + long connectionPort, + string connectionUser, + string connectionPassword, + string connectionString, + bool ssl, + string status, + string containerStatus, + string? lastAccessedAt, + string? idleUntil, + string lifecycleState, + long idleTimeoutMinutes, + long cpu, + long memory, + long storage, + string storageClass, + long storageMaxGb, + string nodePool, + long replicas, + string syncMode, + long crossRegionReplicas, + long networkMaxConnections, + long networkIdleTimeoutSeconds, + List networkIPAllowlist, + bool backupEnabled, + bool pitr, + long pitrRetentionDays, + bool storageAutoscaling, + long storageAutoscalingThresholdPercent, + long storageAutoscalingMaxGb, + string maintenanceWindowDay, + long maintenanceWindowHourUtc, + bool metricsEnabled, + bool sqlApiEnabled, + List sqlApiAllowedStatements, + long sqlApiMaxRows, + long sqlApiMaxBytes, + long sqlApiTimeoutSeconds, + string error + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + ProjectId = projectId; + Name = name; + Api = api; + Engine = engine; + Version = version; + Specification = specification; + Backend = backend; + Hostname = hostname; + ConnectionPort = connectionPort; + ConnectionUser = connectionUser; + ConnectionPassword = connectionPassword; + ConnectionString = connectionString; + Ssl = ssl; + Status = status; + ContainerStatus = containerStatus; + LastAccessedAt = lastAccessedAt; + IdleUntil = idleUntil; + LifecycleState = lifecycleState; + IdleTimeoutMinutes = idleTimeoutMinutes; + Cpu = cpu; + Memory = memory; + Storage = storage; + StorageClass = storageClass; + StorageMaxGb = storageMaxGb; + NodePool = nodePool; + Replicas = replicas; + SyncMode = syncMode; + CrossRegionReplicas = crossRegionReplicas; + NetworkMaxConnections = networkMaxConnections; + NetworkIdleTimeoutSeconds = networkIdleTimeoutSeconds; + NetworkIPAllowlist = networkIPAllowlist; + BackupEnabled = backupEnabled; + Pitr = pitr; + PitrRetentionDays = pitrRetentionDays; + StorageAutoscaling = storageAutoscaling; + StorageAutoscalingThresholdPercent = storageAutoscalingThresholdPercent; + StorageAutoscalingMaxGb = storageAutoscalingMaxGb; + MaintenanceWindowDay = maintenanceWindowDay; + MaintenanceWindowHourUtc = maintenanceWindowHourUtc; + MetricsEnabled = metricsEnabled; + SqlApiEnabled = sqlApiEnabled; + SqlApiAllowedStatements = sqlApiAllowedStatements; + SqlApiMaxRows = sqlApiMaxRows; + SqlApiMaxBytes = sqlApiMaxBytes; + SqlApiTimeoutSeconds = sqlApiTimeoutSeconds; + Error = error; + } + + public static DedicatedDatabase From(Dictionary map) => new DedicatedDatabase( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + projectId: map["projectId"].ToString(), + name: map["name"].ToString(), + api: map["api"].ToString(), + engine: map["engine"].ToString(), + version: map["version"].ToString(), + specification: map["specification"].ToString(), + backend: map["backend"].ToString(), + hostname: map["hostname"].ToString(), + connectionPort: Convert.ToInt64(map["connectionPort"]), + connectionUser: map["connectionUser"].ToString(), + connectionPassword: map["connectionPassword"].ToString(), + connectionString: map["connectionString"].ToString(), + ssl: (bool)map["ssl"], + status: map["status"].ToString(), + containerStatus: map["containerStatus"].ToString(), + lastAccessedAt: map.TryGetValue("lastAccessedAt", out var lastAccessedAt) ? lastAccessedAt?.ToString() : null, + idleUntil: map.TryGetValue("idleUntil", out var idleUntil) ? idleUntil?.ToString() : null, + lifecycleState: map["lifecycleState"].ToString(), + idleTimeoutMinutes: Convert.ToInt64(map["idleTimeoutMinutes"]), + cpu: Convert.ToInt64(map["cpu"]), + memory: Convert.ToInt64(map["memory"]), + storage: Convert.ToInt64(map["storage"]), + storageClass: map["storageClass"].ToString(), + storageMaxGb: Convert.ToInt64(map["storageMaxGb"]), + nodePool: map["nodePool"].ToString(), + replicas: Convert.ToInt64(map["replicas"]), + syncMode: map["syncMode"].ToString(), + crossRegionReplicas: Convert.ToInt64(map["crossRegionReplicas"]), + networkMaxConnections: Convert.ToInt64(map["networkMaxConnections"]), + networkIdleTimeoutSeconds: Convert.ToInt64(map["networkIdleTimeoutSeconds"]), + networkIPAllowlist: map["networkIPAllowlist"].ConvertToList(), + backupEnabled: (bool)map["backupEnabled"], + pitr: (bool)map["pitr"], + pitrRetentionDays: Convert.ToInt64(map["pitrRetentionDays"]), + storageAutoscaling: (bool)map["storageAutoscaling"], + storageAutoscalingThresholdPercent: Convert.ToInt64(map["storageAutoscalingThresholdPercent"]), + storageAutoscalingMaxGb: Convert.ToInt64(map["storageAutoscalingMaxGb"]), + maintenanceWindowDay: map["maintenanceWindowDay"].ToString(), + maintenanceWindowHourUtc: Convert.ToInt64(map["maintenanceWindowHourUtc"]), + metricsEnabled: (bool)map["metricsEnabled"], + sqlApiEnabled: (bool)map["sqlApiEnabled"], + sqlApiAllowedStatements: map["sqlApiAllowedStatements"].ConvertToList(), + sqlApiMaxRows: Convert.ToInt64(map["sqlApiMaxRows"]), + sqlApiMaxBytes: Convert.ToInt64(map["sqlApiMaxBytes"]), + sqlApiTimeoutSeconds: Convert.ToInt64(map["sqlApiTimeoutSeconds"]), + error: map["error"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "projectId", ProjectId }, + { "name", Name }, + { "api", Api }, + { "engine", Engine }, + { "version", Version }, + { "specification", Specification }, + { "backend", Backend }, + { "hostname", Hostname }, + { "connectionPort", ConnectionPort }, + { "connectionUser", ConnectionUser }, + { "connectionPassword", ConnectionPassword }, + { "connectionString", ConnectionString }, + { "ssl", Ssl }, + { "status", Status }, + { "containerStatus", ContainerStatus }, + { "lastAccessedAt", LastAccessedAt }, + { "idleUntil", IdleUntil }, + { "lifecycleState", LifecycleState }, + { "idleTimeoutMinutes", IdleTimeoutMinutes }, + { "cpu", Cpu }, + { "memory", Memory }, + { "storage", Storage }, + { "storageClass", StorageClass }, + { "storageMaxGb", StorageMaxGb }, + { "nodePool", NodePool }, + { "replicas", Replicas }, + { "syncMode", SyncMode }, + { "crossRegionReplicas", CrossRegionReplicas }, + { "networkMaxConnections", NetworkMaxConnections }, + { "networkIdleTimeoutSeconds", NetworkIdleTimeoutSeconds }, + { "networkIPAllowlist", NetworkIPAllowlist }, + { "backupEnabled", BackupEnabled }, + { "pitr", Pitr }, + { "pitrRetentionDays", PitrRetentionDays }, + { "storageAutoscaling", StorageAutoscaling }, + { "storageAutoscalingThresholdPercent", StorageAutoscalingThresholdPercent }, + { "storageAutoscalingMaxGb", StorageAutoscalingMaxGb }, + { "maintenanceWindowDay", MaintenanceWindowDay }, + { "maintenanceWindowHourUtc", MaintenanceWindowHourUtc }, + { "metricsEnabled", MetricsEnabled }, + { "sqlApiEnabled", SqlApiEnabled }, + { "sqlApiAllowedStatements", SqlApiAllowedStatements }, + { "sqlApiMaxRows", SqlApiMaxRows }, + { "sqlApiMaxBytes", SqlApiMaxBytes }, + { "sqlApiTimeoutSeconds", SqlApiTimeoutSeconds }, + { "error", Error } + }; + } +} diff --git a/Appwrite/Models/DedicatedDatabaseMember.cs b/Appwrite/Models/DedicatedDatabaseMember.cs new file mode 100644 index 00000000..5a3875a8 --- /dev/null +++ b/Appwrite/Models/DedicatedDatabaseMember.cs @@ -0,0 +1,54 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DedicatedDatabaseMember + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("role")] + public string Role { get; private set; } + + [JsonPropertyName("status")] + public string Status { get; private set; } + + [JsonPropertyName("lagSeconds")] + public double LagSeconds { get; private set; } + + public DedicatedDatabaseMember( + string id, + string role, + string status, + double lagSeconds + ) + { + Id = id; + Role = role; + Status = status; + LagSeconds = lagSeconds; + } + + public static DedicatedDatabaseMember From(Dictionary map) => new DedicatedDatabaseMember( + id: map["$id"].ToString(), + role: map["role"].ToString(), + status: map["status"].ToString(), + lagSeconds: Convert.ToDouble(map["lagSeconds"]) + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "role", Role }, + { "status", Status }, + { "lagSeconds", LagSeconds } + }; + } +} diff --git a/Appwrite/Models/DedicatedDatabaseReplicas.cs b/Appwrite/Models/DedicatedDatabaseReplicas.cs new file mode 100644 index 00000000..caaa5990 --- /dev/null +++ b/Appwrite/Models/DedicatedDatabaseReplicas.cs @@ -0,0 +1,47 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DedicatedDatabaseReplicas + { + [JsonPropertyName("replicas")] + public long Replicas { get; private set; } + + [JsonPropertyName("syncMode")] + public string SyncMode { get; private set; } + + [JsonPropertyName("members")] + public List Members { get; private set; } + + public DedicatedDatabaseReplicas( + long replicas, + string syncMode, + List members + ) + { + Replicas = replicas; + SyncMode = syncMode; + Members = members; + } + + public static DedicatedDatabaseReplicas From(Dictionary map) => new DedicatedDatabaseReplicas( + replicas: Convert.ToInt64(map["replicas"]), + syncMode: map["syncMode"].ToString(), + members: map["members"].ConvertToList>().Select(it => Appwrite.Models.DedicatedDatabaseMember.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "replicas", Replicas }, + { "syncMode", SyncMode }, + { "members", Members?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/DedicatedDatabaseSpecification.cs b/Appwrite/Models/DedicatedDatabaseSpecification.cs new file mode 100644 index 00000000..0b815194 --- /dev/null +++ b/Appwrite/Models/DedicatedDatabaseSpecification.cs @@ -0,0 +1,89 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DedicatedDatabaseSpecification + { + [JsonPropertyName("slug")] + public string Slug { get; private set; } + + [JsonPropertyName("name")] + public string Name { get; private set; } + + [JsonPropertyName("price")] + public double Price { get; private set; } + + [JsonPropertyName("cpu")] + public long Cpu { get; private set; } + + [JsonPropertyName("memory")] + public long Memory { get; private set; } + + [JsonPropertyName("maxConnections")] + public long MaxConnections { get; private set; } + + [JsonPropertyName("includedStorage")] + public long IncludedStorage { get; private set; } + + [JsonPropertyName("includedBandwidth")] + public long IncludedBandwidth { get; private set; } + + [JsonPropertyName("enabled")] + public bool Enabled { get; private set; } + + public DedicatedDatabaseSpecification( + string slug, + string name, + double price, + long cpu, + long memory, + long maxConnections, + long includedStorage, + long includedBandwidth, + bool enabled + ) + { + Slug = slug; + Name = name; + Price = price; + Cpu = cpu; + Memory = memory; + MaxConnections = maxConnections; + IncludedStorage = includedStorage; + IncludedBandwidth = includedBandwidth; + Enabled = enabled; + } + + public static DedicatedDatabaseSpecification From(Dictionary map) => new DedicatedDatabaseSpecification( + slug: map["slug"].ToString(), + name: map["name"].ToString(), + price: Convert.ToDouble(map["price"]), + cpu: Convert.ToInt64(map["cpu"]), + memory: Convert.ToInt64(map["memory"]), + maxConnections: Convert.ToInt64(map["maxConnections"]), + includedStorage: Convert.ToInt64(map["includedStorage"]), + includedBandwidth: Convert.ToInt64(map["includedBandwidth"]), + enabled: (bool)map["enabled"] + ); + + public Dictionary ToMap() => new Dictionary() + { + { "slug", Slug }, + { "name", Name }, + { "price", Price }, + { "cpu", Cpu }, + { "memory", Memory }, + { "maxConnections", MaxConnections }, + { "includedStorage", IncludedStorage }, + { "includedBandwidth", IncludedBandwidth }, + { "enabled", Enabled } + }; + } +} diff --git a/Appwrite/Models/DedicatedDatabaseSpecificationList.cs b/Appwrite/Models/DedicatedDatabaseSpecificationList.cs new file mode 100644 index 00000000..59c0336b --- /dev/null +++ b/Appwrite/Models/DedicatedDatabaseSpecificationList.cs @@ -0,0 +1,47 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DedicatedDatabaseSpecificationList + { + [JsonPropertyName("specifications")] + public List Specifications { get; private set; } + + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("pricing")] + public DedicatedDatabaseSpecificationPricing Pricing { get; private set; } + + public DedicatedDatabaseSpecificationList( + List specifications, + long total, + DedicatedDatabaseSpecificationPricing pricing + ) + { + Specifications = specifications; + Total = total; + Pricing = pricing; + } + + public static DedicatedDatabaseSpecificationList From(Dictionary map) => new DedicatedDatabaseSpecificationList( + specifications: map["specifications"].ConvertToList>().Select(it => Appwrite.Models.DedicatedDatabaseSpecification.From(map: it)).ToList(), + total: Convert.ToInt64(map["total"]), + pricing: Appwrite.Models.DedicatedDatabaseSpecificationPricing.From(map: map["pricing"] is JsonElement jsonObj3 ? jsonObj3.Deserialize>()! : (Dictionary)map["pricing"]) + ); + + public Dictionary ToMap() => new Dictionary() + { + { "specifications", Specifications?.Select(it => it.ToMap()).ToList() }, + { "total", Total }, + { "pricing", Pricing?.ToMap() } + }; + } +} diff --git a/Appwrite/Models/DedicatedDatabaseSpecificationPricing.cs b/Appwrite/Models/DedicatedDatabaseSpecificationPricing.cs new file mode 100644 index 00000000..ccf587aa --- /dev/null +++ b/Appwrite/Models/DedicatedDatabaseSpecificationPricing.cs @@ -0,0 +1,61 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class DedicatedDatabaseSpecificationPricing + { + [JsonPropertyName("storageOverageRate")] + public double StorageOverageRate { get; private set; } + + [JsonPropertyName("bandwidthOverageRate")] + public double BandwidthOverageRate { get; private set; } + + [JsonPropertyName("replicaRate")] + public double ReplicaRate { get; private set; } + + [JsonPropertyName("crossRegionReplicaRate")] + public double CrossRegionReplicaRate { get; private set; } + + [JsonPropertyName("pitrRate")] + public double PitrRate { get; private set; } + + public DedicatedDatabaseSpecificationPricing( + double storageOverageRate, + double bandwidthOverageRate, + double replicaRate, + double crossRegionReplicaRate, + double pitrRate + ) + { + StorageOverageRate = storageOverageRate; + BandwidthOverageRate = bandwidthOverageRate; + ReplicaRate = replicaRate; + CrossRegionReplicaRate = crossRegionReplicaRate; + PitrRate = pitrRate; + } + + public static DedicatedDatabaseSpecificationPricing From(Dictionary map) => new DedicatedDatabaseSpecificationPricing( + storageOverageRate: Convert.ToDouble(map["storageOverageRate"]), + bandwidthOverageRate: Convert.ToDouble(map["bandwidthOverageRate"]), + replicaRate: Convert.ToDouble(map["replicaRate"]), + crossRegionReplicaRate: Convert.ToDouble(map["crossRegionReplicaRate"]), + pitrRate: Convert.ToDouble(map["pitrRate"]) + ); + + public Dictionary ToMap() => new Dictionary() + { + { "storageOverageRate", StorageOverageRate }, + { "bandwidthOverageRate", BandwidthOverageRate }, + { "replicaRate", ReplicaRate }, + { "crossRegionReplicaRate", CrossRegionReplicaRate }, + { "pitrRate", PitrRate } + }; + } +} diff --git a/Appwrite/Models/Deployment.cs b/Appwrite/Models/Deployment.cs index 6a3786b2..79f43f76 100644 --- a/Appwrite/Models/Deployment.cs +++ b/Appwrite/Models/Deployment.cs @@ -54,7 +54,7 @@ public class Deployment public string ScreenshotDark { get; private set; } [JsonPropertyName("status")] - public DeploymentStatus Status { get; private set; } + public Appwrite.Enums.DeploymentStatus Status { get; private set; } [JsonPropertyName("buildLogs")] public string BuildLogs { get; private set; } @@ -107,7 +107,7 @@ public Deployment( bool activate, string screenshotLight, string screenshotDark, - DeploymentStatus status, + Appwrite.Enums.DeploymentStatus status, string buildLogs, long buildDuration, string providerRepositoryName, @@ -166,7 +166,7 @@ string providerBranchUrl activate: (bool)map["activate"], screenshotLight: map["screenshotLight"].ToString(), screenshotDark: map["screenshotDark"].ToString(), - status: new DeploymentStatus(map["status"].ToString()!), + status: new Appwrite.Enums.DeploymentStatus(map["status"].ToString()!), buildLogs: map["buildLogs"].ToString(), buildDuration: Convert.ToInt64(map["buildDuration"]), providerRepositoryName: map["providerRepositoryName"].ToString(), diff --git a/Appwrite/Models/Execution.cs b/Appwrite/Models/Execution.cs index 04c39e47..2393dbc0 100644 --- a/Appwrite/Models/Execution.cs +++ b/Appwrite/Models/Execution.cs @@ -30,10 +30,10 @@ public class Execution public string DeploymentId { get; private set; } [JsonPropertyName("trigger")] - public ExecutionTrigger Trigger { get; private set; } + public Appwrite.Enums.ExecutionTrigger Trigger { get; private set; } [JsonPropertyName("status")] - public ExecutionStatus Status { get; private set; } + public Appwrite.Enums.ExecutionStatus Status { get; private set; } [JsonPropertyName("requestMethod")] public string RequestMethod { get; private set; } @@ -72,8 +72,8 @@ public Execution( List permissions, string functionId, string deploymentId, - ExecutionTrigger trigger, - ExecutionStatus status, + Appwrite.Enums.ExecutionTrigger trigger, + Appwrite.Enums.ExecutionStatus status, string requestMethod, string requestPath, List requestHeaders, @@ -113,8 +113,8 @@ public Execution( permissions: map["$permissions"].ConvertToList(), functionId: map["functionId"].ToString(), deploymentId: map["deploymentId"].ToString(), - trigger: new ExecutionTrigger(map["trigger"].ToString()!), - status: new ExecutionStatus(map["status"].ToString()!), + trigger: new Appwrite.Enums.ExecutionTrigger(map["trigger"].ToString()!), + status: new Appwrite.Enums.ExecutionStatus(map["status"].ToString()!), requestMethod: map["requestMethod"].ToString(), requestPath: map["requestPath"].ToString(), requestHeaders: map["requestHeaders"].ConvertToList>().Select(it => Appwrite.Models.Headers.From(map: it)).ToList(), diff --git a/Appwrite/Models/Index.cs b/Appwrite/Models/Index.cs index 12f897d7..ddebe855 100644 --- a/Appwrite/Models/Index.cs +++ b/Appwrite/Models/Index.cs @@ -27,7 +27,7 @@ public class Index public string Type { get; private set; } [JsonPropertyName("status")] - public IndexStatus Status { get; private set; } + public Appwrite.Enums.IndexStatus Status { get; private set; } [JsonPropertyName("error")] public string Error { get; private set; } @@ -47,7 +47,7 @@ public Index( string updatedAt, string key, string type, - IndexStatus status, + Appwrite.Enums.IndexStatus status, string error, List attributes, List lengths, @@ -72,7 +72,7 @@ public Index( updatedAt: map["$updatedAt"].ToString(), key: map["key"].ToString(), type: map["type"].ToString(), - status: new IndexStatus(map["status"].ToString()!), + status: new Appwrite.Enums.IndexStatus(map["status"].ToString()!), error: map["error"].ToString(), attributes: map["attributes"].ConvertToList(), lengths: map["lengths"].ConvertToList(), diff --git a/Appwrite/Models/InsightCTA.cs b/Appwrite/Models/InsightCTA.cs index 516cae98..3fa87ddf 100644 --- a/Appwrite/Models/InsightCTA.cs +++ b/Appwrite/Models/InsightCTA.cs @@ -40,7 +40,7 @@ object @params label: map["label"].ToString(), service: map["service"].ToString(), method: map["method"].ToString(), - @params: map["params"].ToString() + @params: map["params"] ); public Dictionary ToMap() => new Dictionary() diff --git a/Appwrite/Models/Message.cs b/Appwrite/Models/Message.cs index b90570b6..7ef49fca 100644 --- a/Appwrite/Models/Message.cs +++ b/Appwrite/Models/Message.cs @@ -48,7 +48,7 @@ public class Message public object Data { get; private set; } [JsonPropertyName("status")] - public MessageStatus Status { get; private set; } + public Appwrite.Enums.MessageStatus Status { get; private set; } public Message( string id, @@ -63,7 +63,7 @@ public Message( List? deliveryErrors, long deliveredTotal, object data, - MessageStatus status + Appwrite.Enums.MessageStatus status ) { Id = id; @@ -95,8 +95,8 @@ MessageStatus status ? arrayRaw10.ConvertToList() : null, deliveredTotal: Convert.ToInt64(map["deliveredTotal"]), - data: map["data"].ToString(), - status: new MessageStatus(map["status"].ToString()!) + data: map["data"], + status: new Appwrite.Enums.MessageStatus(map["status"].ToString()!) ); public Dictionary ToMap() => new Dictionary() diff --git a/Appwrite/Models/Oauth2Approve.cs b/Appwrite/Models/Oauth2Approve.cs new file mode 100644 index 00000000..cbcd97db --- /dev/null +++ b/Appwrite/Models/Oauth2Approve.cs @@ -0,0 +1,33 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Approve + { + [JsonPropertyName("redirectUrl")] + public string RedirectUrl { get; private set; } + + public Oauth2Approve( + string redirectUrl + ) + { + RedirectUrl = redirectUrl; + } + + public static Oauth2Approve From(Dictionary map) => new Oauth2Approve( + redirectUrl: map["redirectUrl"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "redirectUrl", RedirectUrl } + }; + } +} diff --git a/Appwrite/Models/Oauth2Authorize.cs b/Appwrite/Models/Oauth2Authorize.cs new file mode 100644 index 00000000..6ce3913c --- /dev/null +++ b/Appwrite/Models/Oauth2Authorize.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Authorize + { + [JsonPropertyName("grantId")] + public string GrantId { get; private set; } + + [JsonPropertyName("redirectUrl")] + public string RedirectUrl { get; private set; } + + public Oauth2Authorize( + string grantId, + string redirectUrl + ) + { + GrantId = grantId; + RedirectUrl = redirectUrl; + } + + public static Oauth2Authorize From(Dictionary map) => new Oauth2Authorize( + grantId: map["grantId"].ToString(), + redirectUrl: map["redirectUrl"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "grantId", GrantId }, + { "redirectUrl", RedirectUrl } + }; + } +} diff --git a/Appwrite/Models/Oauth2Consent.cs b/Appwrite/Models/Oauth2Consent.cs new file mode 100644 index 00000000..86c338b4 --- /dev/null +++ b/Appwrite/Models/Oauth2Consent.cs @@ -0,0 +1,96 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Consent + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("userId")] + public string UserId { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("cimdUrl")] + public string CimdUrl { get; private set; } + + [JsonPropertyName("scopes")] + public List Scopes { get; private set; } + + [JsonPropertyName("resources")] + public List Resources { get; private set; } + + [JsonPropertyName("authorizationDetails")] + public string AuthorizationDetails { get; private set; } + + [JsonPropertyName("expire")] + public string Expire { get; private set; } + + public Oauth2Consent( + string id, + string createdAt, + string updatedAt, + string userId, + string appId, + string cimdUrl, + List scopes, + List resources, + string authorizationDetails, + string expire + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + UserId = userId; + AppId = appId; + CimdUrl = cimdUrl; + Scopes = scopes; + Resources = resources; + AuthorizationDetails = authorizationDetails; + Expire = expire; + } + + public static Oauth2Consent From(Dictionary map) => new Oauth2Consent( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + userId: map["userId"].ToString(), + appId: map["appId"].ToString(), + cimdUrl: map["cimdUrl"].ToString(), + scopes: map["scopes"].ConvertToList(), + resources: map["resources"].ConvertToList(), + authorizationDetails: map["authorizationDetails"].ToString(), + expire: map["expire"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "userId", UserId }, + { "appId", AppId }, + { "cimdUrl", CimdUrl }, + { "scopes", Scopes }, + { "resources", Resources }, + { "authorizationDetails", AuthorizationDetails }, + { "expire", Expire } + }; + } +} diff --git a/Appwrite/Models/Oauth2ConsentList.cs b/Appwrite/Models/Oauth2ConsentList.cs new file mode 100644 index 00000000..cdeef9ff --- /dev/null +++ b/Appwrite/Models/Oauth2ConsentList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2ConsentList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("consents")] + public List Consents { get; private set; } + + public Oauth2ConsentList( + long total, + List consents + ) + { + Total = total; + Consents = consents; + } + + public static Oauth2ConsentList From(Dictionary map) => new Oauth2ConsentList( + total: Convert.ToInt64(map["total"]), + consents: map["consents"].ConvertToList>().Select(it => Appwrite.Models.Oauth2Consent.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "consents", Consents?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/Oauth2ConsentToken.cs b/Appwrite/Models/Oauth2ConsentToken.cs new file mode 100644 index 00000000..40abe8da --- /dev/null +++ b/Appwrite/Models/Oauth2ConsentToken.cs @@ -0,0 +1,103 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2ConsentToken + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("consentId")] + public string ConsentId { get; private set; } + + [JsonPropertyName("userId")] + public string UserId { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("cimdUrl")] + public string CimdUrl { get; private set; } + + [JsonPropertyName("scopes")] + public List Scopes { get; private set; } + + [JsonPropertyName("resources")] + public List Resources { get; private set; } + + [JsonPropertyName("authorizationDetails")] + public string AuthorizationDetails { get; private set; } + + [JsonPropertyName("expire")] + public string Expire { get; private set; } + + public Oauth2ConsentToken( + string id, + string createdAt, + string updatedAt, + string consentId, + string userId, + string appId, + string cimdUrl, + List scopes, + List resources, + string authorizationDetails, + string expire + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + ConsentId = consentId; + UserId = userId; + AppId = appId; + CimdUrl = cimdUrl; + Scopes = scopes; + Resources = resources; + AuthorizationDetails = authorizationDetails; + Expire = expire; + } + + public static Oauth2ConsentToken From(Dictionary map) => new Oauth2ConsentToken( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + consentId: map["consentId"].ToString(), + userId: map["userId"].ToString(), + appId: map["appId"].ToString(), + cimdUrl: map["cimdUrl"].ToString(), + scopes: map["scopes"].ConvertToList(), + resources: map["resources"].ConvertToList(), + authorizationDetails: map["authorizationDetails"].ToString(), + expire: map["expire"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "consentId", ConsentId }, + { "userId", UserId }, + { "appId", AppId }, + { "cimdUrl", CimdUrl }, + { "scopes", Scopes }, + { "resources", Resources }, + { "authorizationDetails", AuthorizationDetails }, + { "expire", Expire } + }; + } +} diff --git a/Appwrite/Models/Oauth2ConsentTokenList.cs b/Appwrite/Models/Oauth2ConsentTokenList.cs new file mode 100644 index 00000000..87703e57 --- /dev/null +++ b/Appwrite/Models/Oauth2ConsentTokenList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2ConsentTokenList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("tokens")] + public List Tokens { get; private set; } + + public Oauth2ConsentTokenList( + long total, + List tokens + ) + { + Total = total; + Tokens = tokens; + } + + public static Oauth2ConsentTokenList From(Dictionary map) => new Oauth2ConsentTokenList( + total: Convert.ToInt64(map["total"]), + tokens: map["tokens"].ConvertToList>().Select(it => Appwrite.Models.Oauth2ConsentToken.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "tokens", Tokens?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/Oauth2DeviceAuthorization.cs b/Appwrite/Models/Oauth2DeviceAuthorization.cs new file mode 100644 index 00000000..78c9631f --- /dev/null +++ b/Appwrite/Models/Oauth2DeviceAuthorization.cs @@ -0,0 +1,68 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2DeviceAuthorization + { + [JsonPropertyName("device_code")] + public string DeviceCode { get; private set; } + + [JsonPropertyName("user_code")] + public string UserCode { get; private set; } + + [JsonPropertyName("verification_uri")] + public string VerificationUri { get; private set; } + + [JsonPropertyName("verification_uri_complete")] + public string VerificationUriComplete { get; private set; } + + [JsonPropertyName("expires_in")] + public long ExpiresIn { get; private set; } + + [JsonPropertyName("interval")] + public long Interval { get; private set; } + + public Oauth2DeviceAuthorization( + string deviceCode, + string userCode, + string verificationUri, + string verificationUriComplete, + long expiresIn, + long interval + ) + { + DeviceCode = deviceCode; + UserCode = userCode; + VerificationUri = verificationUri; + VerificationUriComplete = verificationUriComplete; + ExpiresIn = expiresIn; + Interval = interval; + } + + public static Oauth2DeviceAuthorization From(Dictionary map) => new Oauth2DeviceAuthorization( + deviceCode: map["device_code"].ToString(), + userCode: map["user_code"].ToString(), + verificationUri: map["verification_uri"].ToString(), + verificationUriComplete: map["verification_uri_complete"].ToString(), + expiresIn: Convert.ToInt64(map["expires_in"]), + interval: Convert.ToInt64(map["interval"]) + ); + + public Dictionary ToMap() => new Dictionary() + { + { "device_code", DeviceCode }, + { "user_code", UserCode }, + { "verification_uri", VerificationUri }, + { "verification_uri_complete", VerificationUriComplete }, + { "expires_in", ExpiresIn }, + { "interval", Interval } + }; + } +} diff --git a/Appwrite/Models/Oauth2Grant.cs b/Appwrite/Models/Oauth2Grant.cs new file mode 100644 index 00000000..8b3e074e --- /dev/null +++ b/Appwrite/Models/Oauth2Grant.cs @@ -0,0 +1,110 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Grant + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("userId")] + public string UserId { get; private set; } + + [JsonPropertyName("appId")] + public string AppId { get; private set; } + + [JsonPropertyName("scopes")] + public List Scopes { get; private set; } + + [JsonPropertyName("resources")] + public List Resources { get; private set; } + + [JsonPropertyName("authorizationDetails")] + public string AuthorizationDetails { get; private set; } + + [JsonPropertyName("prompt")] + public string Prompt { get; private set; } + + [JsonPropertyName("redirectUri")] + public string RedirectUri { get; private set; } + + [JsonPropertyName("authTime")] + public long AuthTime { get; private set; } + + [JsonPropertyName("expire")] + public string Expire { get; private set; } + + public Oauth2Grant( + string id, + string createdAt, + string updatedAt, + string userId, + string appId, + List scopes, + List resources, + string authorizationDetails, + string prompt, + string redirectUri, + long authTime, + string expire + ) + { + Id = id; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + UserId = userId; + AppId = appId; + Scopes = scopes; + Resources = resources; + AuthorizationDetails = authorizationDetails; + Prompt = prompt; + RedirectUri = redirectUri; + AuthTime = authTime; + Expire = expire; + } + + public static Oauth2Grant From(Dictionary map) => new Oauth2Grant( + id: map["$id"].ToString(), + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + userId: map["userId"].ToString(), + appId: map["appId"].ToString(), + scopes: map["scopes"].ConvertToList(), + resources: map["resources"].ConvertToList(), + authorizationDetails: map["authorizationDetails"].ToString(), + prompt: map["prompt"].ToString(), + redirectUri: map["redirectUri"].ToString(), + authTime: Convert.ToInt64(map["authTime"]), + expire: map["expire"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "userId", UserId }, + { "appId", AppId }, + { "scopes", Scopes }, + { "resources", Resources }, + { "authorizationDetails", AuthorizationDetails }, + { "prompt", Prompt }, + { "redirectUri", RedirectUri }, + { "authTime", AuthTime }, + { "expire", Expire } + }; + } +} diff --git a/Appwrite/Models/Oauth2Organization.cs b/Appwrite/Models/Oauth2Organization.cs new file mode 100644 index 00000000..60c5e10f --- /dev/null +++ b/Appwrite/Models/Oauth2Organization.cs @@ -0,0 +1,33 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Organization + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + public Oauth2Organization( + string id + ) + { + Id = id; + } + + public static Oauth2Organization From(Dictionary map) => new Oauth2Organization( + id: map["$id"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id } + }; + } +} diff --git a/Appwrite/Models/Oauth2OrganizationList.cs b/Appwrite/Models/Oauth2OrganizationList.cs new file mode 100644 index 00000000..d2db18c1 --- /dev/null +++ b/Appwrite/Models/Oauth2OrganizationList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2OrganizationList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("organizations")] + public List Organizations { get; private set; } + + public Oauth2OrganizationList( + long total, + List organizations + ) + { + Total = total; + Organizations = organizations; + } + + public static Oauth2OrganizationList From(Dictionary map) => new Oauth2OrganizationList( + total: Convert.ToInt64(map["total"]), + organizations: map["organizations"].ConvertToList>().Select(it => Appwrite.Models.Oauth2Organization.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "organizations", Organizations?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/Oauth2PAR.cs b/Appwrite/Models/Oauth2PAR.cs new file mode 100644 index 00000000..08e630c3 --- /dev/null +++ b/Appwrite/Models/Oauth2PAR.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2PAR + { + [JsonPropertyName("request_uri")] + public string RequestUri { get; private set; } + + [JsonPropertyName("expires_in")] + public long ExpiresIn { get; private set; } + + public Oauth2PAR( + string requestUri, + long expiresIn + ) + { + RequestUri = requestUri; + ExpiresIn = expiresIn; + } + + public static Oauth2PAR From(Dictionary map) => new Oauth2PAR( + requestUri: map["request_uri"].ToString(), + expiresIn: Convert.ToInt64(map["expires_in"]) + ); + + public Dictionary ToMap() => new Dictionary() + { + { "request_uri", RequestUri }, + { "expires_in", ExpiresIn } + }; + } +} diff --git a/Appwrite/Models/Oauth2Project.cs b/Appwrite/Models/Oauth2Project.cs new file mode 100644 index 00000000..7378f28f --- /dev/null +++ b/Appwrite/Models/Oauth2Project.cs @@ -0,0 +1,47 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Project + { + [JsonPropertyName("$id")] + public string Id { get; private set; } + + [JsonPropertyName("region")] + public string Region { get; private set; } + + [JsonPropertyName("endpoint")] + public string Endpoint { get; private set; } + + public Oauth2Project( + string id, + string region, + string endpoint + ) + { + Id = id; + Region = region; + Endpoint = endpoint; + } + + public static Oauth2Project From(Dictionary map) => new Oauth2Project( + id: map["$id"].ToString(), + region: map["region"].ToString(), + endpoint: map["endpoint"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "$id", Id }, + { "region", Region }, + { "endpoint", Endpoint } + }; + } +} diff --git a/Appwrite/Models/Oauth2ProjectList.cs b/Appwrite/Models/Oauth2ProjectList.cs new file mode 100644 index 00000000..91c24435 --- /dev/null +++ b/Appwrite/Models/Oauth2ProjectList.cs @@ -0,0 +1,40 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2ProjectList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("projects")] + public List Projects { get; private set; } + + public Oauth2ProjectList( + long total, + List projects + ) + { + Total = total; + Projects = projects; + } + + public static Oauth2ProjectList From(Dictionary map) => new Oauth2ProjectList( + total: Convert.ToInt64(map["total"]), + projects: map["projects"].ConvertToList>().Select(it => Appwrite.Models.Oauth2Project.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "projects", Projects?.Select(it => it.ToMap()).ToList() } + }; + } +} diff --git a/Appwrite/Models/Oauth2Reject.cs b/Appwrite/Models/Oauth2Reject.cs new file mode 100644 index 00000000..edc64a6e --- /dev/null +++ b/Appwrite/Models/Oauth2Reject.cs @@ -0,0 +1,33 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Reject + { + [JsonPropertyName("redirectUrl")] + public string RedirectUrl { get; private set; } + + public Oauth2Reject( + string redirectUrl + ) + { + RedirectUrl = redirectUrl; + } + + public static Oauth2Reject From(Dictionary map) => new Oauth2Reject( + redirectUrl: map["redirectUrl"].ToString() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "redirectUrl", RedirectUrl } + }; + } +} diff --git a/Appwrite/Models/Oauth2Token.cs b/Appwrite/Models/Oauth2Token.cs new file mode 100644 index 00000000..3d18e113 --- /dev/null +++ b/Appwrite/Models/Oauth2Token.cs @@ -0,0 +1,75 @@ + +using System; +using System.Linq; +using System.Collections.Generic; +using System.Text.Json; +using System.Text.Json.Serialization; +using Appwrite.Enums; +using Appwrite.Extensions; + +namespace Appwrite.Models +{ + public class Oauth2Token + { + [JsonPropertyName("access_token")] + public string AccessToken { get; private set; } + + [JsonPropertyName("token_type")] + public string TokenType { get; private set; } + + [JsonPropertyName("expires_in")] + public long ExpiresIn { get; private set; } + + [JsonPropertyName("refresh_token")] + public string RefreshToken { get; private set; } + + [JsonPropertyName("scope")] + public string Scope { get; private set; } + + [JsonPropertyName("authorization_details")] + public string? AuthorizationDetails { get; private set; } + + [JsonPropertyName("id_token")] + public string? IdToken { get; private set; } + + public Oauth2Token( + string accessToken, + string tokenType, + long expiresIn, + string refreshToken, + string scope, + string? authorizationDetails, + string? idToken + ) + { + AccessToken = accessToken; + TokenType = tokenType; + ExpiresIn = expiresIn; + RefreshToken = refreshToken; + Scope = scope; + AuthorizationDetails = authorizationDetails; + IdToken = idToken; + } + + public static Oauth2Token From(Dictionary map) => new Oauth2Token( + accessToken: map["access_token"].ToString(), + tokenType: map["token_type"].ToString(), + expiresIn: Convert.ToInt64(map["expires_in"]), + refreshToken: map["refresh_token"].ToString(), + scope: map["scope"].ToString(), + authorizationDetails: map.TryGetValue("authorization_details", out var authorizationDetails) ? authorizationDetails?.ToString() : null, + idToken: map.TryGetValue("id_token", out var idToken) ? idToken?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "access_token", AccessToken }, + { "token_type", TokenType }, + { "expires_in", ExpiresIn }, + { "refresh_token", RefreshToken }, + { "scope", Scope }, + { "authorization_details", AuthorizationDetails }, + { "id_token", IdToken } + }; + } +} diff --git a/Appwrite/Models/PlatformAndroid.cs b/Appwrite/Models/PlatformAndroid.cs index a0295637..e671a8c7 100644 --- a/Appwrite/Models/PlatformAndroid.cs +++ b/Appwrite/Models/PlatformAndroid.cs @@ -24,7 +24,7 @@ public class PlatformAndroid public string Name { get; private set; } [JsonPropertyName("type")] - public PlatformType Type { get; private set; } + public Appwrite.Enums.PlatformType Type { get; private set; } [JsonPropertyName("applicationId")] public string ApplicationId { get; private set; } @@ -34,7 +34,7 @@ public PlatformAndroid( string createdAt, string updatedAt, string name, - PlatformType type, + Appwrite.Enums.PlatformType type, string applicationId ) { @@ -51,7 +51,7 @@ string applicationId createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), name: map["name"].ToString(), - type: new PlatformType(map["type"].ToString()!), + type: new Appwrite.Enums.PlatformType(map["type"].ToString()!), applicationId: map["applicationId"].ToString() ); diff --git a/Appwrite/Models/PlatformApple.cs b/Appwrite/Models/PlatformApple.cs index e0aadfcb..3e470808 100644 --- a/Appwrite/Models/PlatformApple.cs +++ b/Appwrite/Models/PlatformApple.cs @@ -24,7 +24,7 @@ public class PlatformApple public string Name { get; private set; } [JsonPropertyName("type")] - public PlatformType Type { get; private set; } + public Appwrite.Enums.PlatformType Type { get; private set; } [JsonPropertyName("bundleIdentifier")] public string BundleIdentifier { get; private set; } @@ -34,7 +34,7 @@ public PlatformApple( string createdAt, string updatedAt, string name, - PlatformType type, + Appwrite.Enums.PlatformType type, string bundleIdentifier ) { @@ -51,7 +51,7 @@ string bundleIdentifier createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), name: map["name"].ToString(), - type: new PlatformType(map["type"].ToString()!), + type: new Appwrite.Enums.PlatformType(map["type"].ToString()!), bundleIdentifier: map["bundleIdentifier"].ToString() ); diff --git a/Appwrite/Models/PlatformLinux.cs b/Appwrite/Models/PlatformLinux.cs index e6ef8666..7442840d 100644 --- a/Appwrite/Models/PlatformLinux.cs +++ b/Appwrite/Models/PlatformLinux.cs @@ -24,7 +24,7 @@ public class PlatformLinux public string Name { get; private set; } [JsonPropertyName("type")] - public PlatformType Type { get; private set; } + public Appwrite.Enums.PlatformType Type { get; private set; } [JsonPropertyName("packageName")] public string PackageName { get; private set; } @@ -34,7 +34,7 @@ public PlatformLinux( string createdAt, string updatedAt, string name, - PlatformType type, + Appwrite.Enums.PlatformType type, string packageName ) { @@ -51,7 +51,7 @@ string packageName createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), name: map["name"].ToString(), - type: new PlatformType(map["type"].ToString()!), + type: new Appwrite.Enums.PlatformType(map["type"].ToString()!), packageName: map["packageName"].ToString() ); diff --git a/Appwrite/Models/PlatformWeb.cs b/Appwrite/Models/PlatformWeb.cs index 73c6f8fb..5d06a206 100644 --- a/Appwrite/Models/PlatformWeb.cs +++ b/Appwrite/Models/PlatformWeb.cs @@ -24,7 +24,7 @@ public class PlatformWeb public string Name { get; private set; } [JsonPropertyName("type")] - public PlatformType Type { get; private set; } + public Appwrite.Enums.PlatformType Type { get; private set; } [JsonPropertyName("hostname")] public string Hostname { get; private set; } @@ -34,7 +34,7 @@ public PlatformWeb( string createdAt, string updatedAt, string name, - PlatformType type, + Appwrite.Enums.PlatformType type, string hostname ) { @@ -51,7 +51,7 @@ string hostname createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), name: map["name"].ToString(), - type: new PlatformType(map["type"].ToString()!), + type: new Appwrite.Enums.PlatformType(map["type"].ToString()!), hostname: map["hostname"].ToString() ); diff --git a/Appwrite/Models/PlatformWindows.cs b/Appwrite/Models/PlatformWindows.cs index d488de38..321f4d65 100644 --- a/Appwrite/Models/PlatformWindows.cs +++ b/Appwrite/Models/PlatformWindows.cs @@ -24,7 +24,7 @@ public class PlatformWindows public string Name { get; private set; } [JsonPropertyName("type")] - public PlatformType Type { get; private set; } + public Appwrite.Enums.PlatformType Type { get; private set; } [JsonPropertyName("packageIdentifierName")] public string PackageIdentifierName { get; private set; } @@ -34,7 +34,7 @@ public PlatformWindows( string createdAt, string updatedAt, string name, - PlatformType type, + Appwrite.Enums.PlatformType type, string packageIdentifierName ) { @@ -51,7 +51,7 @@ string packageIdentifierName createdAt: map["$createdAt"].ToString(), updatedAt: map["$updatedAt"].ToString(), name: map["name"].ToString(), - type: new PlatformType(map["type"].ToString()!), + type: new Appwrite.Enums.PlatformType(map["type"].ToString()!), packageIdentifierName: map["packageIdentifierName"].ToString() ); diff --git a/Appwrite/Models/Presence.cs b/Appwrite/Models/Presence.cs index 58d27464..c9ee35fa 100644 --- a/Appwrite/Models/Presence.cs +++ b/Appwrite/Models/Presence.cs @@ -70,7 +70,7 @@ public Presence( status: map.TryGetValue("status", out var status) ? status?.ToString() : null, source: map["source"].ToString(), expiresAt: map.TryGetValue("expiresAt", out var expiresAt) ? expiresAt?.ToString() : null, - metadata: map.TryGetValue("metadata", out var metadata) ? metadata?.ToString() : null + metadata: map.TryGetValue("metadata", out var objectRaw9) ? objectRaw9 : null ); public Dictionary ToMap() => new Dictionary() diff --git a/Appwrite/Models/Project.cs b/Appwrite/Models/Project.cs index 10b325e8..e1ac7125 100644 --- a/Appwrite/Models/Project.cs +++ b/Appwrite/Models/Project.cs @@ -92,6 +92,9 @@ public class Project [JsonPropertyName("consoleAccessedAt")] public string ConsoleAccessedAt { get; private set; } + [JsonPropertyName("wafEnabled")] + public bool WafEnabled { get; private set; } + [JsonPropertyName("billingLimits")] public BillingLimits? BillingLimits { get; private set; } @@ -122,6 +125,9 @@ public class Project [JsonPropertyName("oAuth2ServerPublicRefreshTokenDuration")] public long? OAuth2ServerPublicRefreshTokenDuration { get; private set; } + [JsonPropertyName("oAuth2ServerInstallationAccessTokenDuration")] + public long? OAuth2ServerInstallationAccessTokenDuration { get; private set; } + [JsonPropertyName("oAuth2ServerConfidentialPkce")] public bool? OAuth2ServerConfidentialPkce { get; private set; } @@ -168,6 +174,7 @@ public Project( List protocols, List blocks, string consoleAccessedAt, + bool wafEnabled, BillingLimits? billingLimits, bool? oAuth2ServerEnabled, string? oAuth2ServerAuthorizationUrl, @@ -178,6 +185,7 @@ public Project( long? oAuth2ServerRefreshTokenDuration, long? oAuth2ServerPublicAccessTokenDuration, long? oAuth2ServerPublicRefreshTokenDuration, + long? oAuth2ServerInstallationAccessTokenDuration, bool? oAuth2ServerConfidentialPkce, string? oAuth2ServerVerificationUrl, long? oAuth2ServerUserCodeLength, @@ -213,6 +221,7 @@ public Project( Protocols = protocols; Blocks = blocks; ConsoleAccessedAt = consoleAccessedAt; + WafEnabled = wafEnabled; BillingLimits = billingLimits; OAuth2ServerEnabled = oAuth2ServerEnabled; OAuth2ServerAuthorizationUrl = oAuth2ServerAuthorizationUrl; @@ -223,6 +232,7 @@ public Project( OAuth2ServerRefreshTokenDuration = oAuth2ServerRefreshTokenDuration; OAuth2ServerPublicAccessTokenDuration = oAuth2ServerPublicAccessTokenDuration; OAuth2ServerPublicRefreshTokenDuration = oAuth2ServerPublicRefreshTokenDuration; + OAuth2ServerInstallationAccessTokenDuration = oAuth2ServerInstallationAccessTokenDuration; OAuth2ServerConfidentialPkce = oAuth2ServerConfidentialPkce; OAuth2ServerVerificationUrl = oAuth2ServerVerificationUrl; OAuth2ServerUserCodeLength = oAuth2ServerUserCodeLength; @@ -253,50 +263,54 @@ public Project( pingedAt: map["pingedAt"].ToString(), labels: map["labels"].ConvertToList(), status: map["status"].ToString(), - onboarding: map["onboarding"].ToString(), + onboarding: map["onboarding"], authMethods: map["authMethods"].ConvertToList>().Select(it => Appwrite.Models.ProjectAuthMethod.From(map: it)).ToList(), services: map["services"].ConvertToList>().Select(it => Appwrite.Models.ProjectService.From(map: it)).ToList(), protocols: map["protocols"].ConvertToList>().Select(it => Appwrite.Models.ProjectProtocol.From(map: it)).ToList(), blocks: map["blocks"].ConvertToList>().Select(it => Appwrite.Models.Block.From(map: it)).ToList(), consoleAccessedAt: map["consoleAccessedAt"].ToString(), - billingLimits: map.TryGetValue("billingLimits", out var objectRaw28) && objectRaw28 != null - ? Appwrite.Models.BillingLimits.From(map: objectRaw28 is JsonElement jsonObj28 ? jsonObj28.Deserialize>()! : (Dictionary)objectRaw28) + wafEnabled: (bool)map["wafEnabled"], + billingLimits: map.TryGetValue("billingLimits", out var objectRaw29) && objectRaw29 != null + ? Appwrite.Models.BillingLimits.From(map: objectRaw29 is JsonElement jsonObj29 ? jsonObj29.Deserialize>()! : (Dictionary)objectRaw29) : null, - oAuth2ServerEnabled: map.TryGetValue("oAuth2ServerEnabled", out var boolRaw29) && boolRaw29 != null - ? (bool?)boolRaw29 + oAuth2ServerEnabled: map.TryGetValue("oAuth2ServerEnabled", out var boolRaw30) && boolRaw30 != null + ? (bool?)boolRaw30 : null, oAuth2ServerAuthorizationUrl: map.TryGetValue("oAuth2ServerAuthorizationUrl", out var oAuth2ServerAuthorizationUrl) ? oAuth2ServerAuthorizationUrl?.ToString() : null, - oAuth2ServerScopes: map.TryGetValue("oAuth2ServerScopes", out var arrayRaw31) && arrayRaw31 != null - ? arrayRaw31.ConvertToList() - : null, - oAuth2ServerDefaultScopes: map.TryGetValue("oAuth2ServerDefaultScopes", out var arrayRaw32) && arrayRaw32 != null + oAuth2ServerScopes: map.TryGetValue("oAuth2ServerScopes", out var arrayRaw32) && arrayRaw32 != null ? arrayRaw32.ConvertToList() : null, - oAuth2ServerAuthorizationDetailsTypes: map.TryGetValue("oAuth2ServerAuthorizationDetailsTypes", out var arrayRaw33) && arrayRaw33 != null + oAuth2ServerDefaultScopes: map.TryGetValue("oAuth2ServerDefaultScopes", out var arrayRaw33) && arrayRaw33 != null ? arrayRaw33.ConvertToList() : null, - oAuth2ServerAccessTokenDuration: map.TryGetValue("oAuth2ServerAccessTokenDuration", out var numberRaw34) && numberRaw34 != null - ? Convert.ToInt64(numberRaw34) - : null, - oAuth2ServerRefreshTokenDuration: map.TryGetValue("oAuth2ServerRefreshTokenDuration", out var numberRaw35) && numberRaw35 != null + oAuth2ServerAuthorizationDetailsTypes: map.TryGetValue("oAuth2ServerAuthorizationDetailsTypes", out var arrayRaw34) && arrayRaw34 != null + ? arrayRaw34.ConvertToList() + : null, + oAuth2ServerAccessTokenDuration: map.TryGetValue("oAuth2ServerAccessTokenDuration", out var numberRaw35) && numberRaw35 != null ? Convert.ToInt64(numberRaw35) : null, - oAuth2ServerPublicAccessTokenDuration: map.TryGetValue("oAuth2ServerPublicAccessTokenDuration", out var numberRaw36) && numberRaw36 != null + oAuth2ServerRefreshTokenDuration: map.TryGetValue("oAuth2ServerRefreshTokenDuration", out var numberRaw36) && numberRaw36 != null ? Convert.ToInt64(numberRaw36) : null, - oAuth2ServerPublicRefreshTokenDuration: map.TryGetValue("oAuth2ServerPublicRefreshTokenDuration", out var numberRaw37) && numberRaw37 != null + oAuth2ServerPublicAccessTokenDuration: map.TryGetValue("oAuth2ServerPublicAccessTokenDuration", out var numberRaw37) && numberRaw37 != null ? Convert.ToInt64(numberRaw37) : null, - oAuth2ServerConfidentialPkce: map.TryGetValue("oAuth2ServerConfidentialPkce", out var boolRaw38) && boolRaw38 != null - ? (bool?)boolRaw38 + oAuth2ServerPublicRefreshTokenDuration: map.TryGetValue("oAuth2ServerPublicRefreshTokenDuration", out var numberRaw38) && numberRaw38 != null + ? Convert.ToInt64(numberRaw38) + : null, + oAuth2ServerInstallationAccessTokenDuration: map.TryGetValue("oAuth2ServerInstallationAccessTokenDuration", out var numberRaw39) && numberRaw39 != null + ? Convert.ToInt64(numberRaw39) + : null, + oAuth2ServerConfidentialPkce: map.TryGetValue("oAuth2ServerConfidentialPkce", out var boolRaw40) && boolRaw40 != null + ? (bool?)boolRaw40 : null, oAuth2ServerVerificationUrl: map.TryGetValue("oAuth2ServerVerificationUrl", out var oAuth2ServerVerificationUrl) ? oAuth2ServerVerificationUrl?.ToString() : null, - oAuth2ServerUserCodeLength: map.TryGetValue("oAuth2ServerUserCodeLength", out var numberRaw40) && numberRaw40 != null - ? Convert.ToInt64(numberRaw40) + oAuth2ServerUserCodeLength: map.TryGetValue("oAuth2ServerUserCodeLength", out var numberRaw42) && numberRaw42 != null + ? Convert.ToInt64(numberRaw42) : null, oAuth2ServerUserCodeFormat: map.TryGetValue("oAuth2ServerUserCodeFormat", out var oAuth2ServerUserCodeFormat) ? oAuth2ServerUserCodeFormat?.ToString() : null, - oAuth2ServerDeviceCodeDuration: map.TryGetValue("oAuth2ServerDeviceCodeDuration", out var numberRaw42) && numberRaw42 != null - ? Convert.ToInt64(numberRaw42) + oAuth2ServerDeviceCodeDuration: map.TryGetValue("oAuth2ServerDeviceCodeDuration", out var numberRaw44) && numberRaw44 != null + ? Convert.ToInt64(numberRaw44) : null, oAuth2ServerDiscoveryUrl: map.TryGetValue("oAuth2ServerDiscoveryUrl", out var oAuth2ServerDiscoveryUrl) ? oAuth2ServerDiscoveryUrl?.ToString() : null ); @@ -330,6 +344,7 @@ public Project( { "protocols", Protocols?.Select(it => it.ToMap()).ToList() }, { "blocks", Blocks?.Select(it => it.ToMap()).ToList() }, { "consoleAccessedAt", ConsoleAccessedAt }, + { "wafEnabled", WafEnabled }, { "billingLimits", BillingLimits?.ToMap() }, { "oAuth2ServerEnabled", OAuth2ServerEnabled }, { "oAuth2ServerAuthorizationUrl", OAuth2ServerAuthorizationUrl }, @@ -340,6 +355,7 @@ public Project( { "oAuth2ServerRefreshTokenDuration", OAuth2ServerRefreshTokenDuration }, { "oAuth2ServerPublicAccessTokenDuration", OAuth2ServerPublicAccessTokenDuration }, { "oAuth2ServerPublicRefreshTokenDuration", OAuth2ServerPublicRefreshTokenDuration }, + { "oAuth2ServerInstallationAccessTokenDuration", OAuth2ServerInstallationAccessTokenDuration }, { "oAuth2ServerConfidentialPkce", OAuth2ServerConfidentialPkce }, { "oAuth2ServerVerificationUrl", OAuth2ServerVerificationUrl }, { "oAuth2ServerUserCodeLength", OAuth2ServerUserCodeLength }, diff --git a/Appwrite/Models/ProjectAuthMethod.cs b/Appwrite/Models/ProjectAuthMethod.cs index e6705325..f2813c8c 100644 --- a/Appwrite/Models/ProjectAuthMethod.cs +++ b/Appwrite/Models/ProjectAuthMethod.cs @@ -12,13 +12,13 @@ namespace Appwrite.Models public class ProjectAuthMethod { [JsonPropertyName("$id")] - public ProjectAuthMethodId Id { get; private set; } + public Appwrite.Enums.ProjectAuthMethodId Id { get; private set; } [JsonPropertyName("enabled")] public bool Enabled { get; private set; } public ProjectAuthMethod( - ProjectAuthMethodId id, + Appwrite.Enums.ProjectAuthMethodId id, bool enabled ) { @@ -27,7 +27,7 @@ bool enabled } public static ProjectAuthMethod From(Dictionary map) => new ProjectAuthMethod( - id: new ProjectAuthMethodId(map["$id"].ToString()!), + id: new Appwrite.Enums.ProjectAuthMethodId(map["$id"].ToString()!), enabled: (bool)map["enabled"] ); diff --git a/Appwrite/Models/ProjectProtocol.cs b/Appwrite/Models/ProjectProtocol.cs index b794986f..7f6782e5 100644 --- a/Appwrite/Models/ProjectProtocol.cs +++ b/Appwrite/Models/ProjectProtocol.cs @@ -12,13 +12,13 @@ namespace Appwrite.Models public class ProjectProtocol { [JsonPropertyName("$id")] - public ProjectProtocolId Id { get; private set; } + public Appwrite.Enums.ProjectProtocolId Id { get; private set; } [JsonPropertyName("enabled")] public bool Enabled { get; private set; } public ProjectProtocol( - ProjectProtocolId id, + Appwrite.Enums.ProjectProtocolId id, bool enabled ) { @@ -27,7 +27,7 @@ bool enabled } public static ProjectProtocol From(Dictionary map) => new ProjectProtocol( - id: new ProjectProtocolId(map["$id"].ToString()!), + id: new Appwrite.Enums.ProjectProtocolId(map["$id"].ToString()!), enabled: (bool)map["enabled"] ); diff --git a/Appwrite/Models/ProjectService.cs b/Appwrite/Models/ProjectService.cs index fca62cd5..bd862e5f 100644 --- a/Appwrite/Models/ProjectService.cs +++ b/Appwrite/Models/ProjectService.cs @@ -12,13 +12,13 @@ namespace Appwrite.Models public class ProjectService { [JsonPropertyName("$id")] - public ProjectServiceId Id { get; private set; } + public Appwrite.Enums.ProjectServiceId Id { get; private set; } [JsonPropertyName("enabled")] public bool Enabled { get; private set; } public ProjectService( - ProjectServiceId id, + Appwrite.Enums.ProjectServiceId id, bool enabled ) { @@ -27,7 +27,7 @@ bool enabled } public static ProjectService From(Dictionary map) => new ProjectService( - id: new ProjectServiceId(map["$id"].ToString()!), + id: new Appwrite.Enums.ProjectServiceId(map["$id"].ToString()!), enabled: (bool)map["enabled"] ); diff --git a/Appwrite/Models/Provider.cs b/Appwrite/Models/Provider.cs index 2f4671de..55365349 100644 --- a/Appwrite/Models/Provider.cs +++ b/Appwrite/Models/Provider.cs @@ -69,8 +69,8 @@ public Provider( provider: map["provider"].ToString(), enabled: (bool)map["enabled"], type: map["type"].ToString(), - credentials: map["credentials"].ToString(), - options: map.TryGetValue("options", out var options) ? options?.ToString() : null + credentials: map["credentials"], + options: map.TryGetValue("options", out var objectRaw9) ? objectRaw9 : null ); public Dictionary ToMap() => new Dictionary() diff --git a/Appwrite/Models/ProxyRule.cs b/Appwrite/Models/ProxyRule.cs index 1cbe0b7e..0043d6e0 100644 --- a/Appwrite/Models/ProxyRule.cs +++ b/Appwrite/Models/ProxyRule.cs @@ -39,7 +39,7 @@ public class ProxyRule public string DeploymentId { get; private set; } [JsonPropertyName("deploymentResourceType")] - public ProxyRuleDeploymentResourceType? DeploymentResourceType { get; private set; } + public Appwrite.Enums.ProxyRuleDeploymentResourceType? DeploymentResourceType { get; private set; } [JsonPropertyName("deploymentResourceId")] public string DeploymentResourceId { get; private set; } @@ -48,7 +48,7 @@ public class ProxyRule public string DeploymentVcsProviderBranch { get; private set; } [JsonPropertyName("status")] - public ProxyRuleStatus Status { get; private set; } + public Appwrite.Enums.ProxyRuleStatus Status { get; private set; } [JsonPropertyName("logs")] public string Logs { get; private set; } @@ -66,10 +66,10 @@ public ProxyRule( string redirectUrl, long redirectStatusCode, string deploymentId, - ProxyRuleDeploymentResourceType? deploymentResourceType, + Appwrite.Enums.ProxyRuleDeploymentResourceType? deploymentResourceType, string deploymentResourceId, string deploymentVcsProviderBranch, - ProxyRuleStatus status, + Appwrite.Enums.ProxyRuleStatus status, string logs, string renewAt ) @@ -104,11 +104,11 @@ string renewAt deploymentResourceType: map.TryGetValue("deploymentResourceType", out var enumRaw10) ? enumRaw10 == null ? null - : new ProxyRuleDeploymentResourceType(enumRaw10.ToString()!) + : new Appwrite.Enums.ProxyRuleDeploymentResourceType(enumRaw10.ToString()!) : null, deploymentResourceId: map["deploymentResourceId"].ToString(), deploymentVcsProviderBranch: map["deploymentVcsProviderBranch"].ToString(), - status: new ProxyRuleStatus(map["status"].ToString()!), + status: new Appwrite.Enums.ProxyRuleStatus(map["status"].ToString()!), logs: map["logs"].ToString(), renewAt: map["renewAt"].ToString() ); diff --git a/Appwrite/Models/User.cs b/Appwrite/Models/User.cs index f3440fc7..0d52e34e 100644 --- a/Appwrite/Models/User.cs +++ b/Appwrite/Models/User.cs @@ -153,7 +153,7 @@ public User( name: map["name"].ToString(), password: map.TryGetValue("password", out var password) ? password?.ToString() : null, hash: map.TryGetValue("hash", out var hash) ? hash?.ToString() : null, - hashOptions: map.TryGetValue("hashOptions", out var hashOptions) ? hashOptions?.ToString() : null, + hashOptions: map.TryGetValue("hashOptions", out var objectRaw7) ? objectRaw7 : null, registration: map["registration"].ToString(), status: (bool)map["status"], labels: map["labels"].ConvertToList(), diff --git a/Appwrite/Services/Account.cs b/Appwrite/Services/Account.cs index 9adf981b..4770a4bb 100644 --- a/Appwrite/Services/Account.cs +++ b/Appwrite/Services/Account.cs @@ -90,6 +90,216 @@ static Models.User Convert(Dictionary it) } + /// + /// Get a list of the OAuth2 consents the current user has given to third-party + /// apps. + /// + /// + public Task ListConsents(List? queries = null, bool? total = null) + { + var apiPath = "/account/consents"; + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.Oauth2ConsentList Convert(Dictionary it) + { + return Models.Oauth2ConsentList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an OAuth2 consent the current user has given to a third-party app by + /// its unique ID. + /// + /// + public Task GetConsent(string consentId) + { + var apiPath = "/account/consents/{consentId}" + .Replace("{consentId}", consentId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Consent Convert(Dictionary it) + { + return Models.Oauth2Consent.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete an OAuth2 consent by its unique ID. All token families issued under + /// the consent are revoked, and the app must ask for consent again to regain + /// access. + /// + /// + public Task DeleteConsent(string consentId) + { + var apiPath = "/account/consents/{consentId}" + .Replace("{consentId}", consentId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// Get a list of the token families issued under an OAuth2 consent. Each entry + /// represents one authorized device or session; the token secrets themselves + /// are never returned. + /// + /// + public Task ListConsentTokens(string consentId, List? queries = null, bool? total = null) + { + var apiPath = "/account/consents/{consentId}/tokens" + .Replace("{consentId}", consentId); + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.Oauth2ConsentTokenList Convert(Dictionary it) + { + return Models.Oauth2ConsentTokenList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get a token family issued under an OAuth2 consent by its unique ID. The + /// token secrets themselves are never returned. + /// + /// + public Task GetConsentToken(string consentId, string tokenId) + { + var apiPath = "/account/consents/{consentId}/tokens/{tokenId}" + .Replace("{consentId}", consentId) + .Replace("{tokenId}", tokenId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.Oauth2ConsentToken Convert(Dictionary it) + { + return Models.Oauth2ConsentToken.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete a token family issued under an OAuth2 consent by its unique ID. The + /// access and refresh tokens of the family stop working immediately; other + /// token families and the consent itself are unaffected. + /// + /// + public Task DeleteConsentToken(string consentId, string tokenId) + { + var apiPath = "/account/consents/{consentId}/tokens/{tokenId}" + .Replace("{consentId}", consentId) + .Replace("{tokenId}", tokenId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + /// /// Update currently logged in user account email address. After changing user /// address, the user confirmation status will get reset. A new confirmation diff --git a/Appwrite/Services/Apps.cs b/Appwrite/Services/Apps.cs new file mode 100644 index 00000000..1d61f420 --- /dev/null +++ b/Appwrite/Services/Apps.cs @@ -0,0 +1,784 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Appwrite.Models; +using Appwrite.Enums; + +namespace Appwrite.Services +{ + public class Apps : Service + { + public Apps(Client client) : base(client) + { + } + + /// + /// List applications. + /// + /// + public Task List(List? queries = null, bool? total = null) + { + var apiPath = "/apps"; + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppsList Convert(Dictionary it) + { + return Models.AppsList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Create a new application. + /// + /// + public Task Create(string appId, string name, List redirectUris, string? description = null, string? clientUri = null, string? logoUri = null, string? privacyPolicyUrl = null, string? termsUrl = null, List? contacts = null, string? tagline = null, List? tags = null, List? images = null, string? supportUrl = null, string? dataDeletionUrl = null, List? postLogoutRedirectUris = null, bool? enabled = null, string? type = null, bool? deviceFlow = null, string? teamId = null) + { + var apiPath = "/apps"; + + var apiParameters = new Dictionary() + { + { "appId", appId }, + { "name", name }, + { "description", description }, + { "clientUri", clientUri }, + { "logoUri", logoUri }, + { "privacyPolicyUrl", privacyPolicyUrl }, + { "termsUrl", termsUrl }, + { "contacts", contacts }, + { "tagline", tagline }, + { "tags", tags }, + { "images", images }, + { "supportUrl", supportUrl }, + { "dataDeletionUrl", dataDeletionUrl }, + { "redirectUris", redirectUris }, + { "postLogoutRedirectUris", postLogoutRedirectUris }, + { "enabled", enabled }, + { "type", type }, + { "deviceFlow", deviceFlow }, + { "teamId", teamId } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.App Convert(Dictionary it) + { + return Models.App.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List scopes an application can request when installed on a team. + /// + /// + public Task ListInstallationScopes() + { + var apiPath = "/apps/scopes/installations"; + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppScopeList Convert(Dictionary it) + { + return Models.AppScopeList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List scopes an application can request during the OAuth2 flow. + /// + /// + public Task ListOAuth2Scopes() + { + var apiPath = "/apps/scopes/oauth2"; + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppScopeList Convert(Dictionary it) + { + return Models.AppScopeList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an application by its unique ID. + /// + /// + public Task Get(string appId) + { + var apiPath = "/apps/{appId}" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.App Convert(Dictionary it) + { + return Models.App.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Update an application by its unique ID. + /// + /// + public Task Update(string appId, string name, string? description = null, string? clientUri = null, string? logoUri = null, string? privacyPolicyUrl = null, string? termsUrl = null, List? contacts = null, string? tagline = null, List? tags = null, List? images = null, string? supportUrl = null, string? dataDeletionUrl = null, bool? enabled = null, List? redirectUris = null, List? postLogoutRedirectUris = null, string? type = null, bool? deviceFlow = null, List? installationScopes = null, string? installationRedirectUrl = null) + { + var apiPath = "/apps/{appId}" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + { "name", name }, + { "description", description }, + { "clientUri", clientUri }, + { "logoUri", logoUri }, + { "privacyPolicyUrl", privacyPolicyUrl }, + { "termsUrl", termsUrl }, + { "contacts", contacts }, + { "tagline", tagline }, + { "tags", tags }, + { "images", images }, + { "supportUrl", supportUrl }, + { "dataDeletionUrl", dataDeletionUrl }, + { "enabled", enabled }, + { "redirectUris", redirectUris }, + { "postLogoutRedirectUris", postLogoutRedirectUris }, + { "type", type }, + { "deviceFlow", deviceFlow }, + { "installationScopes", installationScopes }, + { "installationRedirectUrl", installationRedirectUrl } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.App Convert(Dictionary it) + { + return Models.App.From(map: it); + } + + return _client.Call( + method: "PUT", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete an application by its unique ID. + /// + /// + public Task Delete(string appId) + { + var apiPath = "/apps/{appId}" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// List installations of an application. Requires an app key sent in the + /// `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + /// + /// + public Task ListInstallations(string appId, List? queries = null, bool? total = null) + { + var apiPath = "/apps/{appId}/installations" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppInstallationList Convert(Dictionary it) + { + return Models.AppInstallationList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an installation of an application by its unique ID. Requires an app key + /// sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + /// + /// + public Task GetInstallation(string appId, string installationId) + { + var apiPath = "/apps/{appId}/installations/{installationId}" + .Replace("{appId}", appId) + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Create a token for an installation of an application. Requires an app key + /// sent in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header. + /// The returned token carries the scopes and authorization details granted to + /// the installation, and can be used as an `Authorization: Bearer` header + /// everywhere OAuth2 access tokens are accepted. Multiple tokens can be active + /// for the same installation at once; each token stays valid until it expires + /// or the installation is updated or deleted. + /// + /// + public Task CreateInstallationToken(string appId, string installationId) + { + var apiPath = "/apps/{appId}/installations/{installationId}/tokens" + .Replace("{appId}", appId) + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Token Convert(Dictionary it) + { + return Models.Oauth2Token.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List app keys for an application. + /// + /// + public Task ListKeys(string appId, List? queries = null, bool? total = null) + { + var apiPath = "/apps/{appId}/keys" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppKeyList Convert(Dictionary it) + { + return Models.AppKeyList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Create a new app key for an application. App keys carry no scopes; send one + /// in the `X-Appwrite-Key` header alongside the `X-Appwrite-App` header to + /// list the application's installations and create installation access tokens. + /// + /// + public Task CreateKey(string appId) + { + var apiPath = "/apps/{appId}/keys" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.AppKey Convert(Dictionary it) + { + return Models.AppKey.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an app key by its unique ID. + /// + /// + public Task GetKey(string appId, string keyId) + { + var apiPath = "/apps/{appId}/keys/{keyId}" + .Replace("{appId}", appId) + .Replace("{keyId}", keyId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppKey Convert(Dictionary it) + { + return Models.AppKey.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete an app key by its unique ID. + /// + /// + public Task DeleteKey(string appId, string keyId) + { + var apiPath = "/apps/{appId}/keys/{keyId}" + .Replace("{appId}", appId) + .Replace("{keyId}", keyId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// Update the labels of an application. Labels are read-only for clients; only + /// a server SDK using a project API key can set them. Replaces the previous + /// labels. + /// + /// + public Task UpdateLabels(string appId, List labels) + { + var apiPath = "/apps/{appId}/labels" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + { "labels", labels } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.App Convert(Dictionary it) + { + return Models.App.From(map: it); + } + + return _client.Call( + method: "PUT", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List client secrets for an application. + /// + /// + public Task ListSecrets(string appId, List? queries = null, bool? total = null) + { + var apiPath = "/apps/{appId}/secrets" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppSecretList Convert(Dictionary it) + { + return Models.AppSecretList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Create a new client secret for an application. + /// + /// + public Task CreateSecret(string appId) + { + var apiPath = "/apps/{appId}/secrets" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.AppSecretPlaintext Convert(Dictionary it) + { + return Models.AppSecretPlaintext.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an application client secret by its unique ID. + /// + /// + public Task GetSecret(string appId, string secretId) + { + var apiPath = "/apps/{appId}/secrets/{secretId}" + .Replace("{appId}", appId) + .Replace("{secretId}", secretId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppSecret Convert(Dictionary it) + { + return Models.AppSecret.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Delete an application client secret by its unique ID. + /// + /// + public Task DeleteSecret(string appId, string secretId) + { + var apiPath = "/apps/{appId}/secrets/{secretId}" + .Replace("{appId}", appId) + .Replace("{secretId}", secretId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// Transfer an application to another team by its unique ID. + /// + /// + public Task UpdateTeam(string appId, string teamId) + { + var apiPath = "/apps/{appId}/team" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + { "teamId", teamId } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.App Convert(Dictionary it) + { + return Models.App.From(map: it); + } + + return _client.Call( + method: "PATCH", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Revoke all tokens for an application by its unique ID. + /// + /// + public Task DeleteTokens(string appId) + { + var apiPath = "/apps/{appId}/tokens" + .Replace("{appId}", appId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + } +} diff --git a/Appwrite/Services/Backups.cs b/Appwrite/Services/Backups.cs index fd199d91..8aed4965 100644 --- a/Appwrite/Services/Backups.cs +++ b/Appwrite/Services/Backups.cs @@ -328,18 +328,33 @@ public Task DeletePolicy(string policyId) /// /// Create and trigger a new restoration for a backup on a project. /// - /// When restoring a DocumentsDB or VectorsDB database to a new resource, pass - /// `newSpecification` to provision the restored database on a different - /// specification than the archived one (for example, restoring onto a larger - /// or smaller dedicated database). Use `serverless` to restore onto the shared - /// pool, or a dedicated specification slug to restore onto a dedicated - /// database of that size. The specification must be permitted by the - /// organization's plan. `newSpecification` is not supported for - /// legacy/TablesDB databases or for bucket restores. + /// For a backup of one database, the restoration resolves its destination + /// before it is queued. Pass `newResourceId` to restore into that database ID, + /// including the archived database ID to overwrite it. When `newResourceId` is + /// omitted, a new database ID is generated and returned in `options`. + /// + /// The restoration migration records the archived database in `resourceId` and + /// `resourceType`, and the resolved database in `destinationResourceId` and + /// `destinationResourceType`. Database types are stored canonically as + /// `database`, `documentsdb`, or `vectorsdb`. Project-wide restorations leave + /// these fields empty because they do not have a single source or destination + /// database. + /// + /// To list every migration related to one database, use its canonical type in + /// a nested `OR(AND(...), AND(...), AND(...))` across the root, parent, and + /// destination relation pairs: `(resourceType, resourceId)`, + /// `(parentResourceType, parentResourceId)`, and `(destinationResourceType, + /// destinationResourceId)`. Legacy and TablesDB databases use `database`; the + /// operational `resourceType` of a table migration is not rewritten to + /// `tablesdb`. + /// + /// When restoring a DocumentsDB or VectorsDB database to a new resource from a + /// dedicated source, the restore provisions a fresh dedicated backing database + /// at the source database's own specification. /// /// /// - public Task CreateRestoration(string archiveId, List services, string? newResourceId = null, string? newResourceName = null, string? newSpecification = null) + public Task CreateRestoration(string archiveId, List services, string? newResourceId = null, string? newResourceName = null) { var apiPath = "/backups/restoration"; @@ -348,8 +363,7 @@ public Task DeletePolicy(string policyId) { "archiveId", archiveId }, { "services", services?.Select(e => e.Value).ToList() }, { "newResourceId", newResourceId }, - { "newResourceName", newResourceName }, - { "newSpecification", newSpecification } + { "newResourceName", newResourceName } }; var apiHeaders = new Dictionary() diff --git a/Appwrite/Services/Oauth2.cs b/Appwrite/Services/Oauth2.cs new file mode 100644 index 00000000..534c1ab0 --- /dev/null +++ b/Appwrite/Services/Oauth2.cs @@ -0,0 +1,515 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Appwrite.Models; +using Appwrite.Enums; + +namespace Appwrite.Services +{ + public class Oauth2 : Service + { + public Oauth2(Client client) : base(client) + { + } + + /// + /// Approve an OAuth2 grant after the user gives consent. Returns the + /// `redirectUrl` the end user should be sent to. The consent screen may + /// optionally pass enriched `authorization_details` to record the concrete + /// resources the user selected. You can pass Accept header of + /// `application/json` to receive a JSON response instead of a redirect. + /// + /// + public Task Approve(string grantId, string? authorizationDetails = null, string? scope = null) + { + var apiPath = "/oauth2/{project_id}/approve" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "grant_id", grantId }, + { "authorization_details", authorizationDetails }, + { "scope", scope } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Approve Convert(Dictionary it) + { + return Models.Oauth2Approve.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Begin the OAuth2 authorization flow. When called without a session, the + /// user is redirected to the consent screen without grant ID. When called with + /// a session, the redirect URL includes param for grant ID. You can pass + /// Accept header of `application/json` to receive a JSON response instead of a + /// redirect. + /// + /// + public Task Authorize(string? clientId = null, string? redirectUri = null, string? responseType = null, string? scope = null, string? state = null, string? nonce = null, string? codeChallenge = null, string? codeChallengeMethod = null, string? prompt = null, long? maxAge = null, string? authorizationDetails = null, string? resource = null, string? audience = null, string? requestUri = null) + { + var apiPath = "/oauth2/{project_id}/authorize" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "client_id", clientId }, + { "redirect_uri", redirectUri }, + { "response_type", responseType }, + { "scope", scope }, + { "state", state }, + { "nonce", nonce }, + { "code_challenge", codeChallenge }, + { "code_challenge_method", codeChallengeMethod }, + { "prompt", prompt }, + { "max_age", maxAge }, + { "authorization_details", authorizationDetails }, + { "resource", resource }, + { "audience", audience }, + { "request_uri", requestUri } + }; + + var apiHeaders = new Dictionary() + { + { "accept", "application/json" } + }; + + + static Models.Oauth2Authorize Convert(Dictionary it) + { + return Models.Oauth2Authorize.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Begin the OAuth2 authorization flow. When called without a session, the + /// user is redirected to the consent screen without grant ID. When called with + /// a session, the redirect URL includes param for grant ID. You can pass + /// Accept header of `application/json` to receive a JSON response instead of a + /// redirect. + /// + /// + public Task AuthorizePost(string? clientId = null, string? redirectUri = null, string? responseType = null, string? scope = null, string? state = null, string? nonce = null, string? codeChallenge = null, string? codeChallengeMethod = null, string? prompt = null, long? maxAge = null, string? authorizationDetails = null, string? resource = null, string? audience = null, string? requestUri = null) + { + var apiPath = "/oauth2/{project_id}/authorize" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "client_id", clientId }, + { "redirect_uri", redirectUri }, + { "response_type", responseType }, + { "scope", scope }, + { "state", state }, + { "nonce", nonce }, + { "code_challenge", codeChallenge }, + { "code_challenge_method", codeChallengeMethod }, + { "prompt", prompt }, + { "max_age", maxAge }, + { "authorization_details", authorizationDetails }, + { "resource", resource }, + { "audience", audience }, + { "request_uri", requestUri } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Authorize Convert(Dictionary it) + { + return Models.Oauth2Authorize.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Start the OAuth2 Device Authorization Grant. Returns the device code, user + /// code, verification URL, expiration, and polling interval. + /// + /// + public Task CreateDeviceAuthorization(string? clientId = null, string? scope = null, string? authorizationDetails = null, string? resource = null, string? audience = null) + { + var apiPath = "/oauth2/{project_id}/device_authorization" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "client_id", clientId }, + { "scope", scope }, + { "authorization_details", authorizationDetails }, + { "resource", resource }, + { "audience", audience } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2DeviceAuthorization Convert(Dictionary it) + { + return Models.Oauth2DeviceAuthorization.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Exchange a device flow user code for an OAuth2 grant. The authenticated + /// user is bound to the pending grant. Pass the returned grant ID to the get + /// grant endpoint to render the consent screen, then to the approve or reject + /// endpoint to complete the flow. + /// + /// + public Task CreateGrant(string userCode) + { + var apiPath = "/oauth2/{project_id}/grants" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "user_code", userCode } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Grant Convert(Dictionary it) + { + return Models.Oauth2Grant.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an OAuth2 grant by its ID. Used by the consent screen to display the + /// details of the authorization the user is being asked to approve. A grant + /// can only be read by the user it belongs to, or by server SDK. + /// + /// + public Task GetGrant(string grantId) + { + var apiPath = "/oauth2/{project_id}/grants/{grant_id}" + .Replace("{project_id}", _client.GetConfig("project")) + .Replace("{grant_id}", grantId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "accept", "application/json" } + }; + + + static Models.Oauth2Grant Convert(Dictionary it) + { + return Models.Oauth2Grant.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List the organizations the OAuth2 access token can access. Resolves the + /// token's `organization` authorization details, expanding the `*` wildcard + /// into the concrete set of organizations the user can see. + /// + /// + public Task ListOrganizations(long? limit = null, long? offset = null, string? search = null) + { + var apiPath = "/oauth2/{project_id}/organizations" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "limit", limit }, + { "offset", offset }, + { "search", search } + }; + + var apiHeaders = new Dictionary() + { + { "accept", "application/json" } + }; + + + static Models.Oauth2OrganizationList Convert(Dictionary it) + { + return Models.Oauth2OrganizationList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Store an OAuth2 authorization request server-side and receive a short-lived + /// request_uri handle for the authorize endpoint. + /// + /// + public Task CreatePAR(string clientId, string redirectUri, string responseType, string? scope = null, string? state = null, string? nonce = null, string? codeChallenge = null, string? codeChallengeMethod = null, string? prompt = null, long? maxAge = null, string? authorizationDetails = null, string? resource = null, string? audience = null) + { + var apiPath = "/oauth2/{project_id}/par" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "client_id", clientId }, + { "redirect_uri", redirectUri }, + { "response_type", responseType }, + { "scope", scope }, + { "state", state }, + { "nonce", nonce }, + { "code_challenge", codeChallenge }, + { "code_challenge_method", codeChallengeMethod }, + { "prompt", prompt }, + { "max_age", maxAge }, + { "authorization_details", authorizationDetails }, + { "resource", resource }, + { "audience", audience } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2PAR Convert(Dictionary it) + { + return Models.Oauth2PAR.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// List the projects the OAuth2 access token can access. Resolves the token's + /// `project` authorization details, expanding the `*` wildcard into the + /// concrete set of projects the user can see. + /// + /// + public Task ListProjects(long? limit = null, long? offset = null, string? search = null) + { + var apiPath = "/oauth2/{project_id}/projects" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "limit", limit }, + { "offset", offset }, + { "search", search } + }; + + var apiHeaders = new Dictionary() + { + { "accept", "application/json" } + }; + + + static Models.Oauth2ProjectList Convert(Dictionary it) + { + return Models.Oauth2ProjectList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Reject an OAuth2 grant when the user denies consent. Returns the + /// `redirectUrl` the end user should be sent to with an `access_denied` error. + /// You can pass Accept header of `application/json` to receive a JSON response + /// instead of a redirect. + /// + /// + public Task Reject(string grantId) + { + var apiPath = "/oauth2/{project_id}/reject" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "grant_id", grantId } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Reject Convert(Dictionary it) + { + return Models.Oauth2Reject.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Revoke an OAuth2 access token or refresh token. + /// + /// + public Task Revoke(string token, string? tokenTypeHint = null, string? clientId = null, string? clientSecret = null) + { + var apiPath = "/oauth2/{project_id}/revoke" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "token", token }, + { "token_type_hint", tokenTypeHint }, + { "client_id", clientId }, + { "client_secret", clientSecret } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// Exchange an OAuth2 authorization code, refresh token, or device code for + /// access and refresh tokens. + /// + /// + public Task CreateToken(string grantType, string? code = null, string? refreshToken = null, string? deviceCode = null, string? clientId = null, string? clientSecret = null, string? codeVerifier = null, string? redirectUri = null, string? resource = null, string? audience = null) + { + var apiPath = "/oauth2/{project_id}/token" + .Replace("{project_id}", _client.GetConfig("project")); + + var apiParameters = new Dictionary() + { + { "grant_type", grantType }, + { "code", code }, + { "refresh_token", refreshToken }, + { "device_code", deviceCode }, + { "client_id", clientId }, + { "client_secret", clientSecret }, + { "code_verifier", codeVerifier }, + { "redirect_uri", redirectUri }, + { "resource", resource }, + { "audience", audience } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.Oauth2Token Convert(Dictionary it) + { + return Models.Oauth2Token.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + } +} diff --git a/Appwrite/Services/Organization.cs b/Appwrite/Services/Organization.cs index be43215d..91e2ceb4 100644 --- a/Appwrite/Services/Organization.cs +++ b/Appwrite/Services/Organization.cs @@ -102,6 +102,186 @@ public Task Delete() + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// List app installations on the organization. Any organization member can + /// read installations. + /// + /// + public Task ListInstallations(List? queries = null, bool? total = null) + { + var apiPath = "/organization/installations"; + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppInstallationList Convert(Dictionary it) + { + return Models.AppInstallationList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Install an app on the organization. Only organization members with the + /// owner role can install apps. The installation is granted the scopes the app + /// currently requests. + /// + /// + public Task CreateInstallation(string appId, string? authorizationDetails = null) + { + var apiPath = "/organization/installations"; + + var apiParameters = new Dictionary() + { + { "appId", appId }, + { "authorizationDetails", authorizationDetails } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an app installation on the organization by its unique ID. Any + /// organization member can read installations. + /// + /// + public Task GetInstallation(string installationId) + { + var apiPath = "/organization/installations/{installationId}" + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Update an app installation on the organization. Only organization members + /// with the owner role can update installations. The installation's granted + /// scopes are refreshed to the scopes the app currently requests; previously + /// issued installation access tokens are revoked. + /// + /// + public Task UpdateInstallation(string installationId, string? authorizationDetails = null) + { + var apiPath = "/organization/installations/{installationId}" + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + { "authorizationDetails", authorizationDetails } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "PUT", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Uninstall an app from the organization by its installation ID. Only + /// organization members with the owner role can remove installations. + /// Previously issued installation access tokens are revoked. + /// + /// + public Task DeleteInstallation(string installationId) + { + var apiPath = "/organization/installations/{installationId}" + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + return _client.Call( method: "DELETE", path: apiPath, diff --git a/Appwrite/Services/Project.cs b/Appwrite/Services/Project.cs index a3c7d922..e8512f23 100644 --- a/Appwrite/Services/Project.cs +++ b/Appwrite/Services/Project.cs @@ -582,7 +582,7 @@ static Models.OAuth2ProviderList Convert(Dictionary it) /// Update the OAuth2 server (OIDC provider) configuration. /// /// - public Task UpdateOAuth2Server(bool enabled, string authorizationUrl, List? scopes = null, List? authorizationDetailsTypes = null, long? accessTokenDuration = null, long? refreshTokenDuration = null, long? publicAccessTokenDuration = null, long? publicRefreshTokenDuration = null, bool? confidentialPkce = null, string? verificationUrl = null, long? userCodeLength = null, string? userCodeFormat = null, long? deviceCodeDuration = null, List? defaultScopes = null) + public Task UpdateOAuth2Server(bool enabled, string authorizationUrl, List? scopes = null, List? authorizationDetailsTypes = null, long? accessTokenDuration = null, long? refreshTokenDuration = null, long? publicAccessTokenDuration = null, long? publicRefreshTokenDuration = null, long? installationAccessTokenDuration = null, bool? confidentialPkce = null, string? verificationUrl = null, long? userCodeLength = null, string? userCodeFormat = null, long? deviceCodeDuration = null, List? defaultScopes = null) { var apiPath = "/project/oauth2-server"; @@ -596,6 +596,7 @@ static Models.OAuth2ProviderList Convert(Dictionary it) { "refreshTokenDuration", refreshTokenDuration }, { "publicAccessTokenDuration", publicAccessTokenDuration }, { "publicRefreshTokenDuration", publicRefreshTokenDuration }, + { "installationAccessTokenDuration", installationAccessTokenDuration }, { "confidentialPkce", confidentialPkce }, { "verificationUrl", verificationUrl }, { "userCodeLength", userCodeLength }, diff --git a/Appwrite/Services/Sites.cs b/Appwrite/Services/Sites.cs index 4cd3038c..b088f975 100644 --- a/Appwrite/Services/Sites.cs +++ b/Appwrite/Services/Sites.cs @@ -613,7 +613,7 @@ public Task DeleteDeployment(string siteId, string deploymentId) /// browser to start downloading the file to user downloads directory. /// /// - public Task GetDeploymentDownload(string siteId, string deploymentId, Appwrite.Enums.DeploymentDownloadType? type = null) + public Task GetDeploymentDownload(string siteId, string deploymentId, Appwrite.Enums.DeploymentDownloadType? type = null, string? token = null) { var apiPath = "/sites/{siteId}/deployments/{deploymentId}/download" .Replace("{siteId}", siteId) @@ -621,7 +621,8 @@ public Task GetDeploymentDownload(string siteId, string deploymentId, Ap var apiParameters = new Dictionary() { - { "type", type?.Value } + { "type", type?.Value }, + { "token", token } }; var apiHeaders = new Dictionary() diff --git a/Appwrite/Services/TablesDB.cs b/Appwrite/Services/TablesDB.cs index 5b9eda7c..698efe09 100644 --- a/Appwrite/Services/TablesDB.cs +++ b/Appwrite/Services/TablesDB.cs @@ -55,7 +55,7 @@ static Models.DatabaseList Convert(Dictionary it) /// /// /// - public Task Create(string databaseId, string name, bool? enabled = null, string? specification = null) + public Task Create(string databaseId, string name, bool? enabled = null, string? specification = null, long? replicas = null) { var apiPath = "/tablesdb"; @@ -64,7 +64,8 @@ static Models.DatabaseList Convert(Dictionary it) { "databaseId", databaseId }, { "name", name }, { "enabled", enabled }, - { "specification", specification } + { "specification", specification }, + { "replicas", replicas } }; var apiHeaders = new Dictionary() @@ -89,6 +90,41 @@ static Models.Database Convert(Dictionary it) } + /// + /// List the dedicated database specifications available on the current plan. + /// Each specification reports its resource limits, pricing, and whether it is + /// enabled for the organization. + /// + /// + public Task ListSpecifications() + { + var apiPath = "/tablesdb/specifications"; + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.DedicatedDatabaseSpecificationList Convert(Dictionary it) + { + return Models.DedicatedDatabaseSpecificationList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + /// /// List transactions across all databases. /// @@ -333,7 +369,7 @@ static Models.Database Convert(Dictionary it) /// Update a database by its unique ID. /// /// - public Task Update(string databaseId, string? name = null, bool? enabled = null) + public Task Update(string databaseId, string? name = null, bool? enabled = null, long? replicas = null) { var apiPath = "/tablesdb/{databaseId}" .Replace("{databaseId}", databaseId); @@ -341,7 +377,8 @@ static Models.Database Convert(Dictionary it) var apiParameters = new Dictionary() { { "name", name }, - { "enabled", enabled } + { "enabled", enabled }, + { "replicas", replicas } }; var apiHeaders = new Dictionary() @@ -396,6 +433,115 @@ public Task Delete(string databaseId) } + /// + /// Trigger a manual failover for a dedicated database with high availability + /// enabled. Promotes a replica to primary. The failover runs asynchronously; + /// poll the database document for status updates. + /// + /// + public Task CreateFailover(string databaseId, string? targetReplicaId = null) + { + var apiPath = "/tablesdb/{databaseId}/failovers" + .Replace("{databaseId}", databaseId); + + var apiParameters = new Dictionary() + { + { "targetReplicaId", targetReplicaId } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.DedicatedDatabase Convert(Dictionary it) + { + return Models.DedicatedDatabase.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get high availability status for a dedicated database. Returns replica + /// statuses, replication lag, and sync mode. + /// + /// + public Task GetReplicas(string databaseId) + { + var apiPath = "/tablesdb/{databaseId}/replicas" + .Replace("{databaseId}", databaseId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.DedicatedDatabaseReplicas Convert(Dictionary it) + { + return Models.DedicatedDatabaseReplicas.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get real-time health and status information for a dedicated database. + /// Returns health status, readiness, uptime, connection info, replica status, + /// and volume information. + /// + /// + public Task GetStatus(string databaseId) + { + var apiPath = "/tablesdb/{databaseId}/status" + .Replace("{databaseId}", databaseId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.DatabaseStatus Convert(Dictionary it) + { + return Models.DatabaseStatus.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + /// /// Get a list of all tables that belong to the provided databaseId. You can /// use the search parameter to filter your results. diff --git a/Appwrite/Services/Teams.cs b/Appwrite/Services/Teams.cs index 4710d6af..f47c7630 100644 --- a/Appwrite/Services/Teams.cs +++ b/Appwrite/Services/Teams.cs @@ -181,6 +181,191 @@ public Task Delete(string teamId) + return _client.Call( + method: "DELETE", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + + } + + /// + /// List app installations on a team. Any team member can read installations. + /// + /// + public Task ListInstallations(string teamId, List? queries = null, bool? total = null) + { + var apiPath = "/teams/{teamId}/installations" + .Replace("{teamId}", teamId); + + var apiParameters = new Dictionary() + { + { "queries", queries }, + { "total", total } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppInstallationList Convert(Dictionary it) + { + return Models.AppInstallationList.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Install an app on a team. When authenticated as a user, only team members + /// with the owner role can install apps. Requests using an API key or in admin + /// mode can install apps on any team. The installation is granted the scopes + /// the app currently requests. + /// + /// + public Task CreateInstallation(string teamId, string appId, string? authorizationDetails = null) + { + var apiPath = "/teams/{teamId}/installations" + .Replace("{teamId}", teamId); + + var apiParameters = new Dictionary() + { + { "appId", appId }, + { "authorizationDetails", authorizationDetails } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "POST", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Get an app installation on a team by its unique ID. Any team member can + /// read installations. + /// + /// + public Task GetInstallation(string teamId, string installationId) + { + var apiPath = "/teams/{teamId}/installations/{installationId}" + .Replace("{teamId}", teamId) + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Update an app installation on a team. Only team members with the owner role + /// can update installations. The installation's granted scopes are refreshed + /// to the scopes the app currently requests; previously issued installation + /// access tokens are revoked. + /// + /// + public Task UpdateInstallation(string teamId, string installationId, string? authorizationDetails = null) + { + var apiPath = "/teams/{teamId}/installations/{installationId}" + .Replace("{teamId}", teamId) + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + { "authorizationDetails", authorizationDetails } + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + static Models.AppInstallation Convert(Dictionary it) + { + return Models.AppInstallation.From(map: it); + } + + return _client.Call( + method: "PUT", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + + /// + /// Uninstall an app from a team by its installation ID. Only team members with + /// the owner role can remove installations. Previously issued installation + /// access tokens are revoked. + /// + /// + public Task DeleteInstallation(string teamId, string installationId) + { + var apiPath = "/teams/{teamId}/installations/{installationId}" + .Replace("{teamId}", teamId) + .Replace("{installationId}", installationId); + + var apiParameters = new Dictionary() + { + }; + + var apiHeaders = new Dictionary() + { + { "X-Appwrite-Project", _client.GetConfig("project") }, + { "content-type", "application/json" }, + { "accept", "application/json" } + }; + + + return _client.Call( method: "DELETE", path: apiPath, diff --git a/CHANGELOG.md b/CHANGELOG.md index 30de9067..ebaa0a63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 6.1.0 + +* Added: `Apps` service for managing OAuth2 applications, keys, and installations +* Added: `OAuth2` service with authorize, grant, device authorization, and consent flows +* Added: `Account` OAuth2 consent methods `ListConsents`, `GetConsent`, `DeleteConsent`, and consent token methods +* Added: app installation management methods to `Organization` and `Teams` services +* Added: `installationAccessTokenDuration` parameter to `Project.UpdateOAuth2Server` +* Added: `token` parameter to `Sites.GetDeploymentDownload` +* Added: `oauth2.introspect` and organization installation key scopes + ## 6.0.0 * Breaking: Removed `Health` service with all its models and enums diff --git a/README.md b/README.md index e1163250..403299bf 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,17 @@ Appwrite is an open-source backend as a service server that abstracts and simpli 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 6.0.0 +Install-Package Appwrite -Version 6.1.0 # or .NET CLI -dotnet add package Appwrite --version 6.0.0 +dotnet add package Appwrite --version 6.1.0 ``` diff --git a/docs/examples/account/delete-consent-token.md b/docs/examples/account/delete-consent-token.md new file mode 100644 index 00000000..a99b4f30 --- /dev/null +++ b/docs/examples/account/delete-consent-token.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +await account.DeleteConsentToken( + consentId: "", + tokenId: "" +);``` diff --git a/docs/examples/account/delete-consent.md b/docs/examples/account/delete-consent.md new file mode 100644 index 00000000..9b053f70 --- /dev/null +++ b/docs/examples/account/delete-consent.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +await account.DeleteConsent( + consentId: "" +);``` diff --git a/docs/examples/account/get-consent-token.md b/docs/examples/account/get-consent-token.md new file mode 100644 index 00000000..2cb00b16 --- /dev/null +++ b/docs/examples/account/get-consent-token.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Oauth2ConsentToken result = await account.GetConsentToken( + consentId: "", + tokenId: "" +);``` diff --git a/docs/examples/account/get-consent.md b/docs/examples/account/get-consent.md new file mode 100644 index 00000000..cb364047 --- /dev/null +++ b/docs/examples/account/get-consent.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Oauth2Consent result = await account.GetConsent( + consentId: "" +);``` diff --git a/docs/examples/account/list-consent-tokens.md b/docs/examples/account/list-consent-tokens.md new file mode 100644 index 00000000..451b8f21 --- /dev/null +++ b/docs/examples/account/list-consent-tokens.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Oauth2ConsentTokenList result = await account.ListConsentTokens( + consentId: "", + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/account/list-consents.md b/docs/examples/account/list-consents.md new file mode 100644 index 00000000..b9ebfcef --- /dev/null +++ b/docs/examples/account/list-consents.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Oauth2ConsentList result = await account.ListConsents( + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/apps/create-installation-token.md b/docs/examples/apps/create-installation-token.md new file mode 100644 index 00000000..9205d289 --- /dev/null +++ b/docs/examples/apps/create-installation-token.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +Apps apps = new Apps(client); + +Oauth2Token result = await apps.CreateInstallationToken( + appId: "", + installationId: "" +);``` diff --git a/docs/examples/apps/create-key.md b/docs/examples/apps/create-key.md new file mode 100644 index 00000000..e8089591 --- /dev/null +++ b/docs/examples/apps/create-key.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppKey result = await apps.CreateKey( + appId: "" +);``` diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md new file mode 100644 index 00000000..d5204290 --- /dev/null +++ b/docs/examples/apps/create-secret.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppSecretPlaintext result = await apps.CreateSecret( + appId: "" +);``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md new file mode 100644 index 00000000..596b31cc --- /dev/null +++ b/docs/examples/apps/create.md @@ -0,0 +1,33 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +App result = await apps.Create( + appId: "", + name: "", + redirectUris: new List(), + description: "", // optional + clientUri: "https://example.com", // optional + logoUri: "https://example.com", // optional + privacyPolicyUrl: "https://example.com", // optional + termsUrl: "https://example.com", // optional + contacts: new List(), // optional + tagline: "", // optional + tags: new List(), // optional + images: new List(), // optional + supportUrl: "https://example.com", // optional + dataDeletionUrl: "https://example.com", // optional + postLogoutRedirectUris: new List(), // optional + enabled: false, // optional + type: "public", // optional + deviceFlow: false, // optional + teamId: "" // optional +);``` diff --git a/docs/examples/apps/delete-key.md b/docs/examples/apps/delete-key.md new file mode 100644 index 00000000..352e036f --- /dev/null +++ b/docs/examples/apps/delete-key.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +await apps.DeleteKey( + appId: "", + keyId: "" +);``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md new file mode 100644 index 00000000..c97148a7 --- /dev/null +++ b/docs/examples/apps/delete-secret.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +await apps.DeleteSecret( + appId: "", + secretId: "" +);``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md new file mode 100644 index 00000000..ebe444be --- /dev/null +++ b/docs/examples/apps/delete-tokens.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +await apps.DeleteTokens( + appId: "" +);``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md new file mode 100644 index 00000000..0942bb2f --- /dev/null +++ b/docs/examples/apps/delete.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +await apps.Delete( + appId: "" +);``` diff --git a/docs/examples/apps/get-installation.md b/docs/examples/apps/get-installation.md new file mode 100644 index 00000000..1a353ec1 --- /dev/null +++ b/docs/examples/apps/get-installation.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +Apps apps = new Apps(client); + +AppInstallation result = await apps.GetInstallation( + appId: "", + installationId: "" +);``` diff --git a/docs/examples/apps/get-key.md b/docs/examples/apps/get-key.md new file mode 100644 index 00000000..17adf20f --- /dev/null +++ b/docs/examples/apps/get-key.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppKey result = await apps.GetKey( + appId: "", + keyId: "" +);``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md new file mode 100644 index 00000000..3e8b9925 --- /dev/null +++ b/docs/examples/apps/get-secret.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppSecret result = await apps.GetSecret( + appId: "", + secretId: "" +);``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md new file mode 100644 index 00000000..a9ee6a0f --- /dev/null +++ b/docs/examples/apps/get.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +App result = await apps.Get( + appId: "" +);``` diff --git a/docs/examples/apps/list-installation-scopes.md b/docs/examples/apps/list-installation-scopes.md new file mode 100644 index 00000000..72aaa4fa --- /dev/null +++ b/docs/examples/apps/list-installation-scopes.md @@ -0,0 +1,14 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppScopeList result = await apps.ListInstallationScopes(); +``` diff --git a/docs/examples/apps/list-installations.md b/docs/examples/apps/list-installations.md new file mode 100644 index 00000000..fbb59ab0 --- /dev/null +++ b/docs/examples/apps/list-installations.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +Apps apps = new Apps(client); + +AppInstallationList result = await apps.ListInstallations( + appId: "", + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/apps/list-keys.md b/docs/examples/apps/list-keys.md new file mode 100644 index 00000000..6d164d32 --- /dev/null +++ b/docs/examples/apps/list-keys.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppKeyList result = await apps.ListKeys( + appId: "", + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/apps/list-o-auth-2-scopes.md b/docs/examples/apps/list-o-auth-2-scopes.md new file mode 100644 index 00000000..f9382134 --- /dev/null +++ b/docs/examples/apps/list-o-auth-2-scopes.md @@ -0,0 +1,14 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppScopeList result = await apps.ListOAuth2Scopes(); +``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md new file mode 100644 index 00000000..fe394026 --- /dev/null +++ b/docs/examples/apps/list-secrets.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppSecretList result = await apps.ListSecrets( + appId: "", + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md new file mode 100644 index 00000000..1dffb6a0 --- /dev/null +++ b/docs/examples/apps/list.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +AppsList result = await apps.List( + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/apps/update-labels.md b/docs/examples/apps/update-labels.md new file mode 100644 index 00000000..ac99b7b8 --- /dev/null +++ b/docs/examples/apps/update-labels.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +Apps apps = new Apps(client); + +App result = await apps.UpdateLabels( + appId: "", + labels: new List() +);``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md new file mode 100644 index 00000000..18084338 --- /dev/null +++ b/docs/examples/apps/update-team.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +App result = await apps.UpdateTeam( + appId: "", + teamId: "" +);``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md new file mode 100644 index 00000000..d6af16a9 --- /dev/null +++ b/docs/examples/apps/update.md @@ -0,0 +1,34 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Apps apps = new Apps(client); + +App result = await apps.Update( + appId: "", + name: "", + description: "", // optional + clientUri: "https://example.com", // optional + logoUri: "https://example.com", // optional + privacyPolicyUrl: "https://example.com", // optional + termsUrl: "https://example.com", // optional + contacts: new List(), // optional + tagline: "", // optional + tags: new List(), // optional + images: new List(), // optional + supportUrl: "https://example.com", // optional + dataDeletionUrl: "https://example.com", // optional + enabled: false, // optional + redirectUris: new List(), // optional + postLogoutRedirectUris: new List(), // optional + type: "public", // optional + deviceFlow: false, // optional + installationScopes: new List(), // optional + installationRedirectUrl: "https://example.com" // optional +);``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index 25de7452..80ec86a1 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -15,6 +15,5 @@ BackupRestoration result = await backups.CreateRestoration( archiveId: "", services: new List<BackupServices> { BackupServices.Databases }, newResourceId: "", // optional - newResourceName: "", // optional - newSpecification: "serverless" // optional + newResourceName: "" // optional );``` diff --git a/docs/examples/oauth2/approve.md b/docs/examples/oauth2/approve.md new file mode 100644 index 00000000..887fab55 --- /dev/null +++ b/docs/examples/oauth2/approve.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Approve result = await oauth2.Approve( + grant_id: "", + authorization_details: "", // optional + scope: "" // optional +);``` diff --git a/docs/examples/oauth2/authorize-post.md b/docs/examples/oauth2/authorize-post.md new file mode 100644 index 00000000..72f43d1a --- /dev/null +++ b/docs/examples/oauth2/authorize-post.md @@ -0,0 +1,28 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Authorize result = await oauth2.AuthorizePost( + client_id: "", // optional + redirect_uri: "https://example.com", // optional + response_type: "", // optional + scope: "", // optional + state: "", // optional + nonce: "", // optional + code_challenge: "", // optional + code_challenge_method: "s256", // optional + prompt: "", // optional + max_age: 0, // optional + authorization_details: "", // optional + resource: "", // optional + audience: "", // optional + request_uri: "" // optional +);``` diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md new file mode 100644 index 00000000..10d68bd1 --- /dev/null +++ b/docs/examples/oauth2/authorize.md @@ -0,0 +1,28 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Authorize result = await oauth2.Authorize( + client_id: "", // optional + redirect_uri: "https://example.com", // optional + response_type: "", // optional + scope: "", // optional + state: "", // optional + nonce: "", // optional + code_challenge: "", // optional + code_challenge_method: "s256", // optional + prompt: "", // optional + max_age: 0, // optional + authorization_details: "", // optional + resource: "", // optional + audience: "", // optional + request_uri: "" // optional +);``` diff --git a/docs/examples/oauth2/create-device-authorization.md b/docs/examples/oauth2/create-device-authorization.md new file mode 100644 index 00000000..248fbf89 --- /dev/null +++ b/docs/examples/oauth2/create-device-authorization.md @@ -0,0 +1,19 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2DeviceAuthorization result = await oauth2.CreateDeviceAuthorization( + client_id: "", // optional + scope: "", // optional + authorization_details: "", // optional + resource: "", // optional + audience: "" // optional +);``` diff --git a/docs/examples/oauth2/create-grant.md b/docs/examples/oauth2/create-grant.md new file mode 100644 index 00000000..627e290d --- /dev/null +++ b/docs/examples/oauth2/create-grant.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Grant result = await oauth2.CreateGrant( + user_code: "" +);``` diff --git a/docs/examples/oauth2/create-par.md b/docs/examples/oauth2/create-par.md new file mode 100644 index 00000000..306c995c --- /dev/null +++ b/docs/examples/oauth2/create-par.md @@ -0,0 +1,27 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2PAR result = await oauth2.CreatePAR( + client_id: "", + redirect_uri: "https://example.com", + response_type: "code", + scope: "", // optional + state: "", // optional + nonce: "", // optional + code_challenge: "", // optional + code_challenge_method: "s256", // optional + prompt: "", // optional + max_age: 0, // optional + authorization_details: "", // optional + resource: "", // optional + audience: "" // optional +);``` diff --git a/docs/examples/oauth2/create-token.md b/docs/examples/oauth2/create-token.md new file mode 100644 index 00000000..6afac7ed --- /dev/null +++ b/docs/examples/oauth2/create-token.md @@ -0,0 +1,24 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Token result = await oauth2.CreateToken( + grant_type: "", + code: "", // optional + refresh_token: "", // optional + device_code: "", // optional + client_id: "", // optional + client_secret: "", // optional + code_verifier: "", // optional + redirect_uri: "https://example.com", // optional + resource: "", // optional + audience: "" // optional +);``` diff --git a/docs/examples/oauth2/get-grant.md b/docs/examples/oauth2/get-grant.md new file mode 100644 index 00000000..a7cf5f9a --- /dev/null +++ b/docs/examples/oauth2/get-grant.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Grant result = await oauth2.GetGrant( + grant_id: "" +);``` diff --git a/docs/examples/oauth2/list-organizations.md b/docs/examples/oauth2/list-organizations.md new file mode 100644 index 00000000..59a30b97 --- /dev/null +++ b/docs/examples/oauth2/list-organizations.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2OrganizationList result = await oauth2.ListOrganizations( + limit: 1, // optional + offset: 0, // optional + search: "" // optional +);``` diff --git a/docs/examples/oauth2/list-projects.md b/docs/examples/oauth2/list-projects.md new file mode 100644 index 00000000..cfe7b8ca --- /dev/null +++ b/docs/examples/oauth2/list-projects.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2ProjectList result = await oauth2.ListProjects( + limit: 1, // optional + offset: 0, // optional + search: "" // optional +);``` diff --git a/docs/examples/oauth2/reject.md b/docs/examples/oauth2/reject.md new file mode 100644 index 00000000..bf32913e --- /dev/null +++ b/docs/examples/oauth2/reject.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + +Oauth2Reject result = await oauth2.Reject( + grant_id: "" +);``` diff --git a/docs/examples/oauth2/revoke.md b/docs/examples/oauth2/revoke.md new file mode 100644 index 00000000..322ba30a --- /dev/null +++ b/docs/examples/oauth2/revoke.md @@ -0,0 +1,18 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetProject(""); // Your project ID + +Oauth2 oauth2 = new Oauth2(client); + + result = await oauth2.Revoke( + token: "", + token_type_hint: "access_token", // optional + client_id: "", // optional + client_secret: "" // optional +);``` diff --git a/docs/examples/organization/create-installation.md b/docs/examples/organization/create-installation.md new file mode 100644 index 00000000..1545dc73 --- /dev/null +++ b/docs/examples/organization/create-installation.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Organization organization = new Organization(client); + +AppInstallation result = await organization.CreateInstallation( + appId: "", + authorizationDetails: "" // optional +);``` diff --git a/docs/examples/organization/delete-installation.md b/docs/examples/organization/delete-installation.md new file mode 100644 index 00000000..d295bbd5 --- /dev/null +++ b/docs/examples/organization/delete-installation.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Organization organization = new Organization(client); + +await organization.DeleteInstallation( + installationId: "" +);``` diff --git a/docs/examples/organization/get-installation.md b/docs/examples/organization/get-installation.md new file mode 100644 index 00000000..13de6238 --- /dev/null +++ b/docs/examples/organization/get-installation.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Organization organization = new Organization(client); + +AppInstallation result = await organization.GetInstallation( + installationId: "" +);``` diff --git a/docs/examples/organization/list-installations.md b/docs/examples/organization/list-installations.md new file mode 100644 index 00000000..843302a7 --- /dev/null +++ b/docs/examples/organization/list-installations.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Organization organization = new Organization(client); + +AppInstallationList result = await organization.ListInstallations( + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/organization/update-installation.md b/docs/examples/organization/update-installation.md new file mode 100644 index 00000000..9799ebfa --- /dev/null +++ b/docs/examples/organization/update-installation.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Organization organization = new Organization(client); + +AppInstallation result = await organization.UpdateInstallation( + installationId: "", + authorizationDetails: "" // optional +);``` diff --git a/docs/examples/project/update-o-auth-2-server.md b/docs/examples/project/update-o-auth-2-server.md index a43abfd3..5c66be76 100644 --- a/docs/examples/project/update-o-auth-2-server.md +++ b/docs/examples/project/update-o-auth-2-server.md @@ -19,6 +19,7 @@ Project result = await project.UpdateOAuth2Server( refreshTokenDuration: 60, // optional publicAccessTokenDuration: 60, // optional publicRefreshTokenDuration: 60, // optional + installationAccessTokenDuration: 60, // optional confidentialPkce: false, // optional verificationUrl: "https://example.com", // optional userCodeLength: 6, // optional diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index 25bc376b..457f1532 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -14,5 +14,6 @@ Sites sites = new Sites(client); byte[] result = await sites.GetDeploymentDownload( siteId: "", deploymentId: "", - type: DeploymentDownloadType.Source // optional + type: DeploymentDownloadType.Source, // optional + token: "" // optional );``` diff --git a/docs/examples/tablesdb/create-failover.md b/docs/examples/tablesdb/create-failover.md new file mode 100644 index 00000000..897e9df9 --- /dev/null +++ b/docs/examples/tablesdb/create-failover.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +DedicatedDatabase result = await tablesDB.CreateFailover( + databaseId: "", + targetReplicaId: "" // optional +);``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 03f9ab32..a5a42f36 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -14,5 +14,6 @@ Database result = await tablesDB.Create( databaseId: "", name: "", enabled: false, // optional - specification: "serverless" // optional + specification: "serverless", // optional + replicas: 0 // optional );``` diff --git a/docs/examples/tablesdb/get-replicas.md b/docs/examples/tablesdb/get-replicas.md new file mode 100644 index 00000000..1001b30e --- /dev/null +++ b/docs/examples/tablesdb/get-replicas.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +DedicatedDatabaseReplicas result = await tablesDB.GetReplicas( + databaseId: "" +);``` diff --git a/docs/examples/tablesdb/get-status.md b/docs/examples/tablesdb/get-status.md new file mode 100644 index 00000000..73917886 --- /dev/null +++ b/docs/examples/tablesdb/get-status.md @@ -0,0 +1,15 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +DatabaseStatus result = await tablesDB.GetStatus( + databaseId: "" +);``` diff --git a/docs/examples/tablesdb/list-specifications.md b/docs/examples/tablesdb/list-specifications.md new file mode 100644 index 00000000..4672e263 --- /dev/null +++ b/docs/examples/tablesdb/list-specifications.md @@ -0,0 +1,14 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +TablesDB tablesDB = new TablesDB(client); + +DedicatedDatabaseSpecificationList result = await tablesDB.ListSpecifications(); +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index e03329dd..ebd66bec 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -13,5 +13,6 @@ TablesDB tablesDB = new TablesDB(client); Database result = await tablesDB.Update( databaseId: "", name: "", // optional - enabled: false // optional + enabled: false, // optional + replicas: 0 // optional );``` diff --git a/docs/examples/teams/create-installation.md b/docs/examples/teams/create-installation.md new file mode 100644 index 00000000..8cc34ef6 --- /dev/null +++ b/docs/examples/teams/create-installation.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +AppInstallation result = await teams.CreateInstallation( + teamId: "", + appId: "", + authorizationDetails: "" // optional +);``` diff --git a/docs/examples/teams/delete-installation.md b/docs/examples/teams/delete-installation.md new file mode 100644 index 00000000..b2a63291 --- /dev/null +++ b/docs/examples/teams/delete-installation.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +await teams.DeleteInstallation( + teamId: "", + installationId: "" +);``` diff --git a/docs/examples/teams/get-installation.md b/docs/examples/teams/get-installation.md new file mode 100644 index 00000000..48546fe8 --- /dev/null +++ b/docs/examples/teams/get-installation.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +AppInstallation result = await teams.GetInstallation( + teamId: "", + installationId: "" +);``` diff --git a/docs/examples/teams/list-installations.md b/docs/examples/teams/list-installations.md new file mode 100644 index 00000000..7f29bdca --- /dev/null +++ b/docs/examples/teams/list-installations.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +AppInstallationList result = await teams.ListInstallations( + teamId: "", + queries: new List(), // optional + total: false // optional +);``` diff --git a/docs/examples/teams/update-installation.md b/docs/examples/teams/update-installation.md new file mode 100644 index 00000000..d64faf09 --- /dev/null +++ b/docs/examples/teams/update-installation.md @@ -0,0 +1,17 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +AppInstallation result = await teams.UpdateInstallation( + teamId: "", + installationId: "", + authorizationDetails: "" // optional +);```