diff --git a/Appwrite/Appwrite.csproj b/Appwrite/Appwrite.csproj index 1cfdf35c..a764f824 100644 --- a/Appwrite/Appwrite.csproj +++ b/Appwrite/Appwrite.csproj @@ -2,11 +2,11 @@ netstandard2.0;net462 Appwrite - 0.24.0 + 0.25.0 Appwrite Team Appwrite Team - Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API + Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API icon.png README.md diff --git a/Appwrite/Client.cs b/Appwrite/Client.cs index 57f98e72..fd3cef30 100644 --- a/Appwrite/Client.cs +++ b/Appwrite/Client.cs @@ -69,11 +69,11 @@ public Client( _headers = new Dictionary() { { "content-type", "application/json" }, - { "user-agent" , $"AppwriteDotNetSDK/0.24.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"}, + { "user-agent" , $"AppwriteDotNetSDK/0.25.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"}, { "x-sdk-name", ".NET" }, { "x-sdk-platform", "server" }, { "x-sdk-language", "dotnet" }, - { "x-sdk-version", "0.24.0"}, + { "x-sdk-version", "0.25.0"}, { "X-Appwrite-Response-Format", "1.8.0" } }; diff --git a/Appwrite/Enums/BrowserPermission.cs b/Appwrite/Enums/BrowserPermission.cs new file mode 100644 index 00000000..1cdf6cf2 --- /dev/null +++ b/Appwrite/Enums/BrowserPermission.cs @@ -0,0 +1,35 @@ +using System; + +namespace Appwrite.Enums +{ + public class BrowserPermission : IEnum + { + public string Value { get; private set; } + + public BrowserPermission(string value) + { + Value = value; + } + + public static BrowserPermission Geolocation => new BrowserPermission("geolocation"); + public static BrowserPermission Camera => new BrowserPermission("camera"); + public static BrowserPermission Microphone => new BrowserPermission("microphone"); + public static BrowserPermission Notifications => new BrowserPermission("notifications"); + public static BrowserPermission Midi => new BrowserPermission("midi"); + public static BrowserPermission Push => new BrowserPermission("push"); + public static BrowserPermission ClipboardRead => new BrowserPermission("clipboard-read"); + public static BrowserPermission ClipboardWrite => new BrowserPermission("clipboard-write"); + public static BrowserPermission PaymentHandler => new BrowserPermission("payment-handler"); + public static BrowserPermission Usb => new BrowserPermission("usb"); + public static BrowserPermission Bluetooth => new BrowserPermission("bluetooth"); + public static BrowserPermission Accelerometer => new BrowserPermission("accelerometer"); + public static BrowserPermission Gyroscope => new BrowserPermission("gyroscope"); + public static BrowserPermission Magnetometer => new BrowserPermission("magnetometer"); + public static BrowserPermission AmbientLightSensor => new BrowserPermission("ambient-light-sensor"); + public static BrowserPermission BackgroundSync => new BrowserPermission("background-sync"); + public static BrowserPermission PersistentStorage => new BrowserPermission("persistent-storage"); + public static BrowserPermission ScreenWakeLock => new BrowserPermission("screen-wake-lock"); + public static BrowserPermission WebShare => new BrowserPermission("web-share"); + public static BrowserPermission XrSpatialTracking => new BrowserPermission("xr-spatial-tracking"); + } +} diff --git a/Appwrite/Enums/DeploymentStatus.cs b/Appwrite/Enums/DeploymentStatus.cs index 70584f7b..074b193a 100644 --- a/Appwrite/Enums/DeploymentStatus.cs +++ b/Appwrite/Enums/DeploymentStatus.cs @@ -15,6 +15,7 @@ public DeploymentStatus(string value) public static DeploymentStatus Processing => new DeploymentStatus("processing"); public static DeploymentStatus Building => new DeploymentStatus("building"); public static DeploymentStatus Ready => new DeploymentStatus("ready"); + public static DeploymentStatus Canceled => new DeploymentStatus("canceled"); public static DeploymentStatus Failed => new DeploymentStatus("failed"); } } diff --git a/Appwrite/Enums/Name.cs b/Appwrite/Enums/Name.cs index 61a33523..e3f6df2f 100644 --- a/Appwrite/Enums/Name.cs +++ b/Appwrite/Enums/Name.cs @@ -21,6 +21,7 @@ public Name(string value) public static Name V1Webhooks => new Name("v1-webhooks"); public static Name V1Certificates => new Name("v1-certificates"); public static Name V1Builds => new Name("v1-builds"); + public static Name V1Screenshots => new Name("v1-screenshots"); public static Name V1Messaging => new Name("v1-messaging"); public static Name V1Migrations => new Name("v1-migrations"); } diff --git a/Appwrite/Enums/OAuthProvider.cs b/Appwrite/Enums/OAuthProvider.cs index 6ca58b12..bac7ce78 100644 --- a/Appwrite/Enums/OAuthProvider.cs +++ b/Appwrite/Enums/OAuthProvider.cs @@ -50,6 +50,5 @@ public OAuthProvider(string value) public static OAuthProvider Yandex => new OAuthProvider("yandex"); public static OAuthProvider Zoho => new OAuthProvider("zoho"); public static OAuthProvider Zoom => new OAuthProvider("zoom"); - public static OAuthProvider Mock => new OAuthProvider("mock"); } } diff --git a/Appwrite/Enums/OrderBy.cs b/Appwrite/Enums/OrderBy.cs new file mode 100644 index 00000000..2bd4a16a --- /dev/null +++ b/Appwrite/Enums/OrderBy.cs @@ -0,0 +1,17 @@ +using System; + +namespace Appwrite.Enums +{ + public class OrderBy : IEnum + { + public string Value { get; private set; } + + public OrderBy(string value) + { + Value = value; + } + + public static OrderBy Asc => new OrderBy("asc"); + public static OrderBy Desc => new OrderBy("desc"); + } +} diff --git a/Appwrite/Enums/Output.cs b/Appwrite/Enums/Output.cs deleted file mode 100644 index 73cb1ef9..00000000 --- a/Appwrite/Enums/Output.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Appwrite.Enums -{ - public class Output : IEnum - { - public string Value { get; private set; } - - public Output(string value) - { - Value = value; - } - - public static Output Jpg => new Output("jpg"); - public static Output Jpeg => new Output("jpeg"); - public static Output Png => new Output("png"); - public static Output Webp => new Output("webp"); - public static Output Heic => new Output("heic"); - public static Output Avif => new Output("avif"); - public static Output Gif => new Output("gif"); - } -} diff --git a/Appwrite/Enums/Roles.cs b/Appwrite/Enums/Roles.cs new file mode 100644 index 00000000..35d6e088 --- /dev/null +++ b/Appwrite/Enums/Roles.cs @@ -0,0 +1,18 @@ +using System; + +namespace Appwrite.Enums +{ + public class Roles : IEnum + { + public string Value { get; private set; } + + public Roles(string value) + { + Value = value; + } + + public static Roles Admin => new Roles("admin"); + public static Roles Developer => new Roles("developer"); + public static Roles Owner => new Roles("owner"); + } +} diff --git a/Appwrite/Enums/Scopes.cs b/Appwrite/Enums/Scopes.cs new file mode 100644 index 00000000..df64383d --- /dev/null +++ b/Appwrite/Enums/Scopes.cs @@ -0,0 +1,70 @@ +using System; + +namespace Appwrite.Enums +{ + public class Scopes : IEnum + { + public string Value { get; private set; } + + public Scopes(string value) + { + Value = value; + } + + public static Scopes SessionsWrite => new Scopes("sessions.write"); + public static Scopes UsersRead => new Scopes("users.read"); + public static Scopes UsersWrite => new Scopes("users.write"); + public static Scopes TeamsRead => new Scopes("teams.read"); + public static Scopes TeamsWrite => new Scopes("teams.write"); + public static Scopes DatabasesRead => new Scopes("databases.read"); + public static Scopes DatabasesWrite => new Scopes("databases.write"); + public static Scopes CollectionsRead => new Scopes("collections.read"); + public static Scopes CollectionsWrite => new Scopes("collections.write"); + public static Scopes TablesRead => new Scopes("tables.read"); + public static Scopes TablesWrite => new Scopes("tables.write"); + public static Scopes AttributesRead => new Scopes("attributes.read"); + public static Scopes AttributesWrite => new Scopes("attributes.write"); + public static Scopes ColumnsRead => new Scopes("columns.read"); + public static Scopes ColumnsWrite => new Scopes("columns.write"); + public static Scopes IndexesRead => new Scopes("indexes.read"); + public static Scopes IndexesWrite => new Scopes("indexes.write"); + public static Scopes DocumentsRead => new Scopes("documents.read"); + public static Scopes DocumentsWrite => new Scopes("documents.write"); + public static Scopes RowsRead => new Scopes("rows.read"); + public static Scopes RowsWrite => new Scopes("rows.write"); + public static Scopes FilesRead => new Scopes("files.read"); + public static Scopes FilesWrite => new Scopes("files.write"); + public static Scopes BucketsRead => new Scopes("buckets.read"); + public static Scopes BucketsWrite => new Scopes("buckets.write"); + public static Scopes FunctionsRead => new Scopes("functions.read"); + public static Scopes FunctionsWrite => new Scopes("functions.write"); + public static Scopes SitesRead => new Scopes("sites.read"); + public static Scopes SitesWrite => new Scopes("sites.write"); + public static Scopes LogRead => new Scopes("log.read"); + public static Scopes LogWrite => new Scopes("log.write"); + public static Scopes ExecutionRead => new Scopes("execution.read"); + public static Scopes ExecutionWrite => new Scopes("execution.write"); + public static Scopes LocaleRead => new Scopes("locale.read"); + public static Scopes AvatarsRead => new Scopes("avatars.read"); + public static Scopes HealthRead => new Scopes("health.read"); + public static Scopes ProvidersRead => new Scopes("providers.read"); + public static Scopes ProvidersWrite => new Scopes("providers.write"); + public static Scopes MessagesRead => new Scopes("messages.read"); + public static Scopes MessagesWrite => new Scopes("messages.write"); + public static Scopes TopicsRead => new Scopes("topics.read"); + public static Scopes TopicsWrite => new Scopes("topics.write"); + public static Scopes SubscribersRead => new Scopes("subscribers.read"); + public static Scopes SubscribersWrite => new Scopes("subscribers.write"); + public static Scopes TargetsRead => new Scopes("targets.read"); + public static Scopes TargetsWrite => new Scopes("targets.write"); + public static Scopes RulesRead => new Scopes("rules.read"); + public static Scopes RulesWrite => new Scopes("rules.write"); + public static Scopes MigrationsRead => new Scopes("migrations.read"); + public static Scopes MigrationsWrite => new Scopes("migrations.write"); + public static Scopes VcsRead => new Scopes("vcs.read"); + public static Scopes VcsWrite => new Scopes("vcs.write"); + public static Scopes AssistantRead => new Scopes("assistant.read"); + public static Scopes TokensRead => new Scopes("tokens.read"); + public static Scopes TokensWrite => new Scopes("tokens.write"); + } +} diff --git a/Appwrite/Models/AttributeLongtext.cs b/Appwrite/Models/AttributeLongtext.cs new file mode 100644 index 00000000..6fee316f --- /dev/null +++ b/Appwrite/Models/AttributeLongtext.cs @@ -0,0 +1,88 @@ + +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 AttributeLongtext + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public AttributeStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public AttributeLongtext( + string key, + string type, + AttributeStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Default = xdefault; + } + + public static AttributeLongtext From(Dictionary map) => new AttributeLongtext( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new AttributeStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/AttributeMediumtext.cs b/Appwrite/Models/AttributeMediumtext.cs new file mode 100644 index 00000000..34cf36ab --- /dev/null +++ b/Appwrite/Models/AttributeMediumtext.cs @@ -0,0 +1,88 @@ + +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 AttributeMediumtext + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public AttributeStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public AttributeMediumtext( + string key, + string type, + AttributeStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Default = xdefault; + } + + public static AttributeMediumtext From(Dictionary map) => new AttributeMediumtext( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new AttributeStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/AttributeText.cs b/Appwrite/Models/AttributeText.cs new file mode 100644 index 00000000..a53091da --- /dev/null +++ b/Appwrite/Models/AttributeText.cs @@ -0,0 +1,88 @@ + +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 AttributeText + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public AttributeStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public AttributeText( + string key, + string type, + AttributeStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Default = xdefault; + } + + public static AttributeText From(Dictionary map) => new AttributeText( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new AttributeStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/AttributeVarchar.cs b/Appwrite/Models/AttributeVarchar.cs new file mode 100644 index 00000000..d4be3902 --- /dev/null +++ b/Appwrite/Models/AttributeVarchar.cs @@ -0,0 +1,95 @@ + +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 AttributeVarchar + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public AttributeStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("size")] + public long Size { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public AttributeVarchar( + string key, + string type, + AttributeStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + long size, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Size = size; + Default = xdefault; + } + + public static AttributeVarchar From(Dictionary map) => new AttributeVarchar( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new AttributeStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + size: Convert.ToInt64(map["size"]), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "size", Size }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/Bucket.cs b/Appwrite/Models/Bucket.cs index 79de11d6..b5a3aa9f 100644 --- a/Appwrite/Models/Bucket.cs +++ b/Appwrite/Models/Bucket.cs @@ -50,6 +50,9 @@ public class Bucket [JsonPropertyName("transformations")] public bool Transformations { get; private set; } + [JsonPropertyName("totalSize")] + public long TotalSize { get; private set; } + public Bucket( string id, string createdAt, @@ -63,7 +66,8 @@ public Bucket( string compression, bool encryption, bool antivirus, - bool transformations + bool transformations, + long totalSize ) { Id = id; CreatedAt = createdAt; @@ -78,6 +82,7 @@ bool transformations Encryption = encryption; Antivirus = antivirus; Transformations = transformations; + TotalSize = totalSize; } public static Bucket From(Dictionary map) => new Bucket( @@ -93,7 +98,8 @@ bool transformations compression: map["compression"].ToString(), encryption: (bool)map["encryption"], antivirus: (bool)map["antivirus"], - transformations: (bool)map["transformations"] + transformations: (bool)map["transformations"], + totalSize: Convert.ToInt64(map["totalSize"]) ); public Dictionary ToMap() => new Dictionary() @@ -110,7 +116,8 @@ bool transformations { "compression", Compression }, { "encryption", Encryption }, { "antivirus", Antivirus }, - { "transformations", Transformations } + { "transformations", Transformations }, + { "totalSize", TotalSize } }; } } diff --git a/Appwrite/Models/ColumnLongtext.cs b/Appwrite/Models/ColumnLongtext.cs new file mode 100644 index 00000000..64fc4a08 --- /dev/null +++ b/Appwrite/Models/ColumnLongtext.cs @@ -0,0 +1,88 @@ + +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 ColumnLongtext + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public ColumnStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public ColumnLongtext( + string key, + string type, + ColumnStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Default = xdefault; + } + + public static ColumnLongtext From(Dictionary map) => new ColumnLongtext( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new ColumnStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/ColumnMediumtext.cs b/Appwrite/Models/ColumnMediumtext.cs new file mode 100644 index 00000000..c97a816c --- /dev/null +++ b/Appwrite/Models/ColumnMediumtext.cs @@ -0,0 +1,88 @@ + +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 ColumnMediumtext + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public ColumnStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public ColumnMediumtext( + string key, + string type, + ColumnStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Default = xdefault; + } + + public static ColumnMediumtext From(Dictionary map) => new ColumnMediumtext( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new ColumnStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/ColumnText.cs b/Appwrite/Models/ColumnText.cs new file mode 100644 index 00000000..193721f9 --- /dev/null +++ b/Appwrite/Models/ColumnText.cs @@ -0,0 +1,88 @@ + +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 ColumnText + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public ColumnStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public ColumnText( + string key, + string type, + ColumnStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Default = xdefault; + } + + public static ColumnText From(Dictionary map) => new ColumnText( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new ColumnStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/ColumnVarchar.cs b/Appwrite/Models/ColumnVarchar.cs new file mode 100644 index 00000000..03256f37 --- /dev/null +++ b/Appwrite/Models/ColumnVarchar.cs @@ -0,0 +1,95 @@ + +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 ColumnVarchar + { + [JsonPropertyName("key")] + public string Key { get; private set; } + + [JsonPropertyName("type")] + public string Type { get; private set; } + + [JsonPropertyName("status")] + public ColumnStatus Status { get; private set; } + + [JsonPropertyName("error")] + public string Error { get; private set; } + + [JsonPropertyName("required")] + public bool Required { get; private set; } + + [JsonPropertyName("array")] + public bool? Array { get; private set; } + + [JsonPropertyName("$createdAt")] + public string CreatedAt { get; private set; } + + [JsonPropertyName("$updatedAt")] + public string UpdatedAt { get; private set; } + + [JsonPropertyName("size")] + public long Size { get; private set; } + + [JsonPropertyName("default")] + public string? Default { get; private set; } + + public ColumnVarchar( + string key, + string type, + ColumnStatus status, + string error, + bool required, + bool? array, + string createdAt, + string updatedAt, + long size, + string? xdefault + ) { + Key = key; + Type = type; + Status = status; + Error = error; + Required = required; + Array = array; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + Size = size; + Default = xdefault; + } + + public static ColumnVarchar From(Dictionary map) => new ColumnVarchar( + key: map["key"].ToString(), + type: map["type"].ToString(), + status: new ColumnStatus(map["status"].ToString()!), + error: map["error"].ToString(), + required: (bool)map["required"], + array: (bool?)map["array"], + createdAt: map["$createdAt"].ToString(), + updatedAt: map["$updatedAt"].ToString(), + size: Convert.ToInt64(map["size"]), + xdefault: map.TryGetValue("default", out var xdefault) ? xdefault?.ToString() : null + ); + + public Dictionary ToMap() => new Dictionary() + { + { "key", Key }, + { "type", Type }, + { "status", Status.Value }, + { "error", Error }, + { "required", Required }, + { "array", Array }, + { "$createdAt", CreatedAt }, + { "$updatedAt", UpdatedAt }, + { "size", Size }, + { "default", Default } + }; + } +} diff --git a/Appwrite/Models/File.cs b/Appwrite/Models/File.cs index b0649f03..d992ed52 100644 --- a/Appwrite/Models/File.cs +++ b/Appwrite/Models/File.cs @@ -44,6 +44,12 @@ public class File [JsonPropertyName("chunksUploaded")] public long ChunksUploaded { get; private set; } + [JsonPropertyName("encryption")] + public bool Encryption { get; private set; } + + [JsonPropertyName("compression")] + public string Compression { get; private set; } + public File( string id, string bucketId, @@ -55,7 +61,9 @@ public File( string mimeType, long sizeOriginal, long chunksTotal, - long chunksUploaded + long chunksUploaded, + bool encryption, + string compression ) { Id = id; BucketId = bucketId; @@ -68,6 +76,8 @@ long chunksUploaded SizeOriginal = sizeOriginal; ChunksTotal = chunksTotal; ChunksUploaded = chunksUploaded; + Encryption = encryption; + Compression = compression; } public static File From(Dictionary map) => new File( @@ -81,7 +91,9 @@ long chunksUploaded mimeType: map["mimeType"].ToString(), sizeOriginal: Convert.ToInt64(map["sizeOriginal"]), chunksTotal: Convert.ToInt64(map["chunksTotal"]), - chunksUploaded: Convert.ToInt64(map["chunksUploaded"]) + chunksUploaded: Convert.ToInt64(map["chunksUploaded"]), + encryption: (bool)map["encryption"], + compression: map["compression"].ToString() ); public Dictionary ToMap() => new Dictionary() @@ -96,7 +108,9 @@ long chunksUploaded { "mimeType", MimeType }, { "sizeOriginal", SizeOriginal }, { "chunksTotal", ChunksTotal }, - { "chunksUploaded", ChunksUploaded } + { "chunksUploaded", ChunksUploaded }, + { "encryption", Encryption }, + { "compression", Compression } }; } } diff --git a/Appwrite/Models/HealthStatusList.cs b/Appwrite/Models/HealthStatusList.cs new file mode 100644 index 00000000..a4cca580 --- /dev/null +++ b/Appwrite/Models/HealthStatusList.cs @@ -0,0 +1,39 @@ + +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 HealthStatusList + { + [JsonPropertyName("total")] + public long Total { get; private set; } + + [JsonPropertyName("statuses")] + public List Statuses { get; private set; } + + public HealthStatusList( + long total, + List statuses + ) { + Total = total; + Statuses = statuses; + } + + public static HealthStatusList From(Dictionary map) => new HealthStatusList( + total: Convert.ToInt64(map["total"]), + statuses: map["statuses"].ConvertToList>().Select(it => HealthStatus.From(map: it)).ToList() + ); + + public Dictionary ToMap() => new Dictionary() + { + { "total", Total }, + { "statuses", Statuses.Select(it => it.ToMap()) } + }; + } +} diff --git a/Appwrite/Query.cs b/Appwrite/Query.cs index a4bb12c7..d47fcdbd 100644 --- a/Appwrite/Query.cs +++ b/Appwrite/Query.cs @@ -4,7 +4,6 @@ using System.Text.Json; using System.Text.Json.Serialization; - namespace Appwrite { public class Query @@ -56,6 +55,17 @@ public static string NotEqual(string attribute, object value) return new Query("notEqual", attribute, value).ToString(); } + /// + /// Filter resources where attribute matches a regular expression pattern. + /// + /// The attribute to filter on. + /// The regular expression pattern to match. + /// The query string. + public static string Regex(string attribute, string pattern) + { + return new Query("regex", attribute, pattern).ToString(); + } + public static string LessThan(string attribute, object value) { return new Query("lessThan", attribute, value).ToString(); @@ -91,6 +101,26 @@ public static string IsNotNull(string attribute) return new Query("isNotNull", attribute, null).ToString(); } + /// + /// Filter resources where the specified attributes exist. + /// + /// The list of attributes that must exist. + /// The query string. + public static string Exists(List attributes) + { + return new Query("exists", null, attributes).ToString(); + } + + /// + /// Filter resources where the specified attributes do not exist. + /// + /// The list of attributes that must not exist. + /// The query string. + public static string NotExists(List attributes) + { + return new Query("notExists", null, attributes).ToString(); + } + public static string StartsWith(string attribute, string value) { return new Query("startsWith", attribute, value).ToString(); @@ -214,6 +244,19 @@ public static string And(List queries) { return new Query("and", null, queries.Select(q => JsonSerializer.Deserialize(q, Client.DeserializerOptions)).ToList()).ToString(); } + /// + /// Filter array elements where at least one element matches all the specified queries. + /// + /// The attribute containing the array to filter on. + /// The list of query strings to match against array elements. + /// The query string. + public static string ElemMatch(string attribute, List queries) { + var parsed = queries + .Select(q => JsonSerializer.Deserialize(q, Client.DeserializerOptions) as object) + .ToList(); + return new Query("elemMatch", attribute, parsed).ToString(); + } + public static string DistanceEqual(string attribute, object values, double distance, bool meters = true) { return new Query("distanceEqual", attribute, new List { new List { values, distance, meters } }).ToString(); diff --git a/Appwrite/Services/Account.cs b/Appwrite/Services/Account.cs index 6954033d..94a69e85 100644 --- a/Appwrite/Services/Account.cs +++ b/Appwrite/Services/Account.cs @@ -189,12 +189,13 @@ public Task DeleteIdentity(string identityId) /// frame. /// /// - public Task CreateJWT() + public Task CreateJWT(long? duration = null) { var apiPath = "/account/jwts"; var apiParameters = new Dictionary() { + { "duration", duration } }; var apiHeaders = new Dictionary() diff --git a/Appwrite/Services/Avatars.cs b/Appwrite/Services/Avatars.cs index b04836a5..a534dfb0 100644 --- a/Appwrite/Services/Avatars.cs +++ b/Appwrite/Services/Avatars.cs @@ -289,7 +289,7 @@ public Task GetQR(string text, long? size = null, long? margin = null, b /// dimensions are not specified, the default viewport size is 1280x720px. /// /// - public Task GetScreenshot(string url, object? headers = null, long? viewportWidth = null, long? viewportHeight = null, double? scale = null, Appwrite.Enums.Theme? theme = null, string? userAgent = null, bool? fullpage = null, string? locale = null, Appwrite.Enums.Timezone? timezone = null, double? latitude = null, double? longitude = null, double? accuracy = null, bool? touch = null, List? permissions = null, long? sleep = null, long? width = null, long? height = null, long? quality = null, Appwrite.Enums.Output? output = null) + public Task GetScreenshot(string url, object? headers = null, long? viewportWidth = null, long? viewportHeight = null, double? scale = null, Appwrite.Enums.Theme? theme = null, string? userAgent = null, bool? fullpage = null, string? locale = null, Appwrite.Enums.Timezone? timezone = null, double? latitude = null, double? longitude = null, double? accuracy = null, bool? touch = null, List? permissions = null, long? sleep = null, long? width = null, long? height = null, long? quality = null, Appwrite.Enums.ImageFormat? output = null) { var apiPath = "/avatars/screenshots"; @@ -309,7 +309,7 @@ public Task GetScreenshot(string url, object? headers = null, long? view { "longitude", longitude }, { "accuracy", accuracy }, { "touch", touch }, - { "permissions", permissions }, + { "permissions", permissions?.Select(e => e.Value).ToList() }, { "sleep", sleep }, { "width", width }, { "height", height }, diff --git a/Appwrite/Services/Databases.cs b/Appwrite/Services/Databases.cs index 4d8cab0d..978e54ba 100644 --- a/Appwrite/Services/Databases.cs +++ b/Appwrite/Services/Databases.cs @@ -304,7 +304,7 @@ static Models.Database Convert(Dictionary it) => /// /// [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead.")] - public Task Update(string databaseId, string name, bool? enabled = null) + public Task Update(string databaseId, string? name = null, bool? enabled = null) { var apiPath = "/databases/{databaseId}" .Replace("{databaseId}", databaseId); @@ -478,7 +478,7 @@ static Models.Collection Convert(Dictionary it) => /// /// [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead.")] - public Task UpdateCollection(string databaseId, string collectionId, string name, List? permissions = null, bool? documentSecurity = null, bool? enabled = null) + public Task UpdateCollection(string databaseId, string collectionId, string? name = null, List? permissions = null, bool? documentSecurity = null, bool? enabled = null) { var apiPath = "/databases/{databaseId}/collections/{collectionId}" .Replace("{databaseId}", databaseId) @@ -1198,6 +1198,156 @@ static Models.AttributeLine Convert(Dictionary it) => } + /// + /// Create a longtext attribute. + /// + /// + /// + public Task CreateLongtextAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/longtext" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeLongtext Convert(Dictionary it) => + Models.AttributeLongtext.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); + + } + + /// + /// Update a longtext attribute. Changing the `default` value will not update + /// already existing documents. + /// + /// + /// + public Task UpdateLongtextAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeLongtext Convert(Dictionary it) => + Models.AttributeLongtext.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); + + } + + /// + /// Create a mediumtext attribute. + /// + /// + /// + public Task CreateMediumtextAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeMediumtext Convert(Dictionary it) => + Models.AttributeMediumtext.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); + + } + + /// + /// Update a mediumtext attribute. Changing the `default` value will not update + /// already existing documents. + /// + /// + /// + public Task UpdateMediumtextAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeMediumtext Convert(Dictionary it) => + Models.AttributeMediumtext.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); + + } + /// /// Create a geometric point attribute. /// @@ -1467,6 +1617,81 @@ static Models.AttributeString Convert(Dictionary it) => } + /// + /// Create a text attribute. + /// + /// + /// + public Task CreateTextAttribute(string databaseId, string collectionId, string key, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/text" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeText Convert(Dictionary it) => + Models.AttributeText.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); + + } + + /// + /// Update a text attribute. Changing the `default` value will not update + /// already existing documents. + /// + /// + /// + public Task UpdateTextAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeText Convert(Dictionary it) => + Models.AttributeText.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); + + } + /// /// Create a URL attribute. /// @@ -1544,6 +1769,83 @@ static Models.AttributeUrl Convert(Dictionary it) => } + /// + /// Create a varchar attribute. + /// + /// + /// + public Task CreateVarcharAttribute(string databaseId, string collectionId, string key, long size, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/varchar" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "size", size }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeVarchar Convert(Dictionary it) => + Models.AttributeVarchar.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); + + } + + /// + /// Update a varchar attribute. Changing the `default` value will not update + /// already existing documents. + /// + /// + /// + public Task UpdateVarcharAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, long? size = null, string? newKey = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "size", size }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeVarchar Convert(Dictionary it) => + Models.AttributeVarchar.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); + + } + /// /// Get attribute by ID. /// @@ -1565,12 +1867,15 @@ public Task GetAttribute(string databaseId, string collectionId, string }; + static object Convert(Dictionary it) => + it; return _client.Call( method: "GET", path: apiPath, headers: apiHeaders, - parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); } @@ -1914,7 +2219,7 @@ static Models.Document Convert(Dictionary it) => /// /// [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead.")] - public Task UpsertDocument(string databaseId, string collectionId, string documentId, object data, List? permissions = null, string? transactionId = null) + public Task UpsertDocument(string databaseId, string collectionId, string documentId, object? data = null, List? permissions = null, string? transactionId = null) { var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents/{documentId}" .Replace("{databaseId}", databaseId) @@ -2133,7 +2438,7 @@ static Models.IndexList Convert(Dictionary it) => /// /// [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead.")] - public Task CreateIndex(string databaseId, string collectionId, string key, Appwrite.Enums.IndexType type, List attributes, List? orders = null, List? lengths = null) + public Task CreateIndex(string databaseId, string collectionId, string key, Appwrite.Enums.IndexType type, List attributes, List? orders = null, List? lengths = null) { var apiPath = "/databases/{databaseId}/collections/{collectionId}/indexes" .Replace("{databaseId}", databaseId) @@ -2144,7 +2449,7 @@ static Models.IndexList Convert(Dictionary it) => { "key", key }, { "type", type?.Value }, { "attributes", attributes }, - { "orders", orders }, + { "orders", orders?.Select(e => e.Value).ToList() }, { "lengths", lengths } }; diff --git a/Appwrite/Services/Functions.cs b/Appwrite/Services/Functions.cs index 317b9ab7..12e6b4e6 100644 --- a/Appwrite/Services/Functions.cs +++ b/Appwrite/Services/Functions.cs @@ -54,7 +54,7 @@ static Models.FunctionList Convert(Dictionary it) => /// API. /// /// - public Task Create(string functionId, string name, Appwrite.Enums.Runtime runtime, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null, bool? logging = null, string? entrypoint = null, string? commands = null, List? scopes = null, string? installationId = null, string? providerRepositoryId = null, string? providerBranch = null, bool? providerSilentMode = null, string? providerRootDirectory = null, string? specification = null) + public Task Create(string functionId, string name, Appwrite.Enums.Runtime runtime, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null, bool? logging = null, string? entrypoint = null, string? commands = null, List? scopes = null, string? installationId = null, string? providerRepositoryId = null, string? providerBranch = null, bool? providerSilentMode = null, string? providerRootDirectory = null, string? specification = null) { var apiPath = "/functions"; @@ -71,7 +71,7 @@ static Models.FunctionList Convert(Dictionary it) => { "logging", logging }, { "entrypoint", entrypoint }, { "commands", commands }, - { "scopes", scopes }, + { "scopes", scopes?.Select(e => e.Value).ToList() }, { "installationId", installationId }, { "providerRepositoryId", providerRepositoryId }, { "providerBranch", providerBranch }, @@ -190,7 +190,7 @@ static Models.Function Convert(Dictionary it) => /// Update function by its unique ID. /// /// - public Task Update(string functionId, string name, Appwrite.Enums.Runtime? runtime = null, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null, bool? logging = null, string? entrypoint = null, string? commands = null, List? scopes = null, string? installationId = null, string? providerRepositoryId = null, string? providerBranch = null, bool? providerSilentMode = null, string? providerRootDirectory = null, string? specification = null) + public Task Update(string functionId, string name, Appwrite.Enums.Runtime? runtime = null, List? execute = null, List? events = null, string? schedule = null, long? timeout = null, bool? enabled = null, bool? logging = null, string? entrypoint = null, string? commands = null, List? scopes = null, string? installationId = null, string? providerRepositoryId = null, string? providerBranch = null, bool? providerSilentMode = null, string? providerRootDirectory = null, string? specification = null) { var apiPath = "/functions/{functionId}" .Replace("{functionId}", functionId); @@ -207,7 +207,7 @@ static Models.Function Convert(Dictionary it) => { "logging", logging }, { "entrypoint", entrypoint }, { "commands", commands }, - { "scopes", scopes }, + { "scopes", scopes?.Select(e => e.Value).ToList() }, { "installationId", installationId }, { "providerRepositoryId", providerRepositoryId }, { "providerBranch", providerBranch }, diff --git a/Appwrite/Services/Health.cs b/Appwrite/Services/Health.cs index 7df4892d..5b0840c4 100644 --- a/Appwrite/Services/Health.cs +++ b/Appwrite/Services/Health.cs @@ -77,7 +77,7 @@ static Models.HealthAntivirus Convert(Dictionary it) => /// successful. /// /// - public Task GetCache() + public Task GetCache() { var apiPath = "/health/cache"; @@ -90,10 +90,10 @@ static Models.HealthAntivirus Convert(Dictionary it) => }; - static Models.HealthStatus Convert(Dictionary it) => - Models.HealthStatus.From(map: it); + static Models.HealthStatusList Convert(Dictionary it) => + Models.HealthStatusList.From(map: it); - return _client.Call( + return _client.Call( method: "GET", path: apiPath, headers: apiHeaders, @@ -136,7 +136,7 @@ static Models.HealthCertificate Convert(Dictionary it) => /// Check the Appwrite database servers are up and connection is successful. /// /// - public Task GetDB() + public Task GetDB() { var apiPath = "/health/db"; @@ -149,10 +149,10 @@ static Models.HealthCertificate Convert(Dictionary it) => }; - static Models.HealthStatus Convert(Dictionary it) => - Models.HealthStatus.From(map: it); + static Models.HealthStatusList Convert(Dictionary it) => + Models.HealthStatusList.From(map: it); - return _client.Call( + return _client.Call( method: "GET", path: apiPath, headers: apiHeaders, @@ -165,7 +165,7 @@ static Models.HealthStatus Convert(Dictionary it) => /// Check the Appwrite pub-sub servers are up and connection is successful. /// /// - public Task GetPubSub() + public Task GetPubSub() { var apiPath = "/health/pubsub"; @@ -178,10 +178,41 @@ static Models.HealthStatus Convert(Dictionary it) => }; - static Models.HealthStatus Convert(Dictionary it) => - Models.HealthStatus.From(map: it); + static Models.HealthStatusList Convert(Dictionary it) => + Models.HealthStatusList.From(map: it); - return _client.Call( + 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 the number of audit logs that are waiting to be processed in the + /// Appwrite internal queue server. + /// + /// + public Task GetQueueAudits(long? threshold = null) + { + var apiPath = "/health/queue/audits"; + + var apiParameters = new Dictionary() + { + { "threshold", threshold } + }; + + var apiHeaders = new Dictionary() + { + }; + + + static Models.HealthQueue Convert(Dictionary it) => + Models.HealthQueue.From(map: it); + + return _client.Call( method: "GET", path: apiPath, headers: apiHeaders, diff --git a/Appwrite/Services/TablesDB.cs b/Appwrite/Services/TablesDB.cs index 85d78aa1..cc052cec 100644 --- a/Appwrite/Services/TablesDB.cs +++ b/Appwrite/Services/TablesDB.cs @@ -300,7 +300,7 @@ static Models.Database Convert(Dictionary it) => /// Update a database by its unique ID. /// /// - public Task Update(string databaseId, string name, bool? enabled = null) + public Task Update(string databaseId, string? name = null, bool? enabled = null) { var apiPath = "/tablesdb/{databaseId}" .Replace("{databaseId}", databaseId); @@ -469,7 +469,7 @@ static Models.Table Convert(Dictionary it) => /// Update a table by its unique ID. /// /// - public Task UpdateTable(string databaseId, string tableId, string name, List? permissions = null, bool? rowSecurity = null, bool? enabled = null) + public Task UpdateTable(string databaseId, string tableId, string? name = null, List? permissions = null, bool? rowSecurity = null, bool? enabled = null) { var apiPath = "/tablesdb/{databaseId}/tables/{tableId}" .Replace("{databaseId}", databaseId) @@ -1170,6 +1170,156 @@ static Models.ColumnLine Convert(Dictionary it) => } + /// + /// Create a longtext column. + /// + /// + /// + public Task CreateLongtextColumn(string databaseId, string tableId, string key, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/longtext" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnLongtext Convert(Dictionary it) => + Models.ColumnLongtext.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); + + } + + /// + /// Update a longtext column. Changing the `default` value will not update + /// already existing rows. + /// + /// + /// + public Task UpdateLongtextColumn(string databaseId, string tableId, string key, bool required, string xdefault, string? newKey = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnLongtext Convert(Dictionary it) => + Models.ColumnLongtext.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); + + } + + /// + /// Create a mediumtext column. + /// + /// + /// + public Task CreateMediumtextColumn(string databaseId, string tableId, string key, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnMediumtext Convert(Dictionary it) => + Models.ColumnMediumtext.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); + + } + + /// + /// Update a mediumtext column. Changing the `default` value will not update + /// already existing rows. + /// + /// + /// + public Task UpdateMediumtextColumn(string databaseId, string tableId, string key, bool required, string xdefault, string? newKey = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnMediumtext Convert(Dictionary it) => + Models.ColumnMediumtext.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); + + } + /// /// Create a geometric point column. /// @@ -1359,6 +1509,7 @@ static Models.ColumnRelationship Convert(Dictionary it) => /// /// /// + [Obsolete("This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead.")] public Task CreateStringColumn(string databaseId, string tableId, string key, long size, bool required, string? xdefault = null, bool? array = null, bool? encrypt = null) { var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/string" @@ -1399,6 +1550,7 @@ static Models.ColumnString Convert(Dictionary it) => /// /// /// + [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead.")] public Task UpdateStringColumn(string databaseId, string tableId, string key, bool required, string xdefault, long? size = null, string? newKey = null) { var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}" @@ -1432,6 +1584,81 @@ static Models.ColumnString Convert(Dictionary it) => } + /// + /// Create a text column. + /// + /// + /// + public Task CreateTextColumn(string databaseId, string tableId, string key, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/text" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnText Convert(Dictionary it) => + Models.ColumnText.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); + + } + + /// + /// Update a text column. Changing the `default` value will not update already + /// existing rows. + /// + /// + /// + public Task UpdateTextColumn(string databaseId, string tableId, string key, bool required, string xdefault, string? newKey = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnText Convert(Dictionary it) => + Models.ColumnText.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); + + } + /// /// Create a URL column. /// @@ -1507,6 +1734,83 @@ static Models.ColumnUrl Convert(Dictionary it) => } + /// + /// Create a varchar column. + /// + /// + /// + public Task CreateVarcharColumn(string databaseId, string tableId, string key, long size, bool required, string? xdefault = null, bool? array = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/varchar" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId); + + var apiParameters = new Dictionary() + { + { "key", key }, + { "size", size }, + { "required", required }, + { "default", xdefault }, + { "array", array } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnVarchar Convert(Dictionary it) => + Models.ColumnVarchar.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); + + } + + /// + /// Update a varchar column. Changing the `default` value will not update + /// already existing rows. + /// + /// + /// + public Task UpdateVarcharColumn(string databaseId, string tableId, string key, bool required, string xdefault, long? size = null, string? newKey = null) + { + var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{tableId}", tableId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "required", required }, + { "default", xdefault }, + { "size", size }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.ColumnVarchar Convert(Dictionary it) => + Models.ColumnVarchar.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); + + } + /// /// Get column by ID. /// @@ -1527,12 +1831,15 @@ public Task GetColumn(string databaseId, string tableId, string key) }; + static object Convert(Dictionary it) => + it; return _client.Call( method: "GET", path: apiPath, headers: apiHeaders, - parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!); + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); } @@ -1642,7 +1949,7 @@ static Models.ColumnIndexList Convert(Dictionary it) => /// Type can be `key`, `fulltext`, or `unique`. /// /// - public Task CreateIndex(string databaseId, string tableId, string key, Appwrite.Enums.IndexType type, List columns, List? orders = null, List? lengths = null) + public Task CreateIndex(string databaseId, string tableId, string key, Appwrite.Enums.IndexType type, List columns, List? orders = null, List? lengths = null) { var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/indexes" .Replace("{databaseId}", databaseId) @@ -1653,7 +1960,7 @@ static Models.ColumnIndexList Convert(Dictionary it) => { "key", key }, { "type", type?.Value }, { "columns", columns }, - { "orders", orders }, + { "orders", orders?.Select(e => e.Value).ToList() }, { "lengths", lengths } }; diff --git a/Appwrite/Services/Teams.cs b/Appwrite/Services/Teams.cs index 54b719b8..1ab360e1 100644 --- a/Appwrite/Services/Teams.cs +++ b/Appwrite/Services/Teams.cs @@ -232,7 +232,7 @@ static Models.MembershipList Convert(Dictionary it) => /// /// /// - public Task CreateMembership(string teamId, List roles, string? email = null, string? userId = null, string? phone = null, string? url = null, string? name = null) + public Task CreateMembership(string teamId, List roles, string? email = null, string? userId = null, string? phone = null, string? url = null, string? name = null) { var apiPath = "/teams/{teamId}/memberships" .Replace("{teamId}", teamId); @@ -242,7 +242,7 @@ static Models.MembershipList Convert(Dictionary it) => { "email", email }, { "userId", userId }, { "phone", phone }, - { "roles", roles }, + { "roles", roles?.Select(e => e.Value).ToList() }, { "url", url }, { "name", name } }; @@ -305,7 +305,7 @@ static Models.Membership Convert(Dictionary it) => /// /// /// - public Task UpdateMembership(string teamId, string membershipId, List roles) + public Task UpdateMembership(string teamId, string membershipId, List roles) { var apiPath = "/teams/{teamId}/memberships/{membershipId}" .Replace("{teamId}", teamId) @@ -313,7 +313,7 @@ static Models.Membership Convert(Dictionary it) => var apiParameters = new Dictionary() { - { "roles", roles } + { "roles", roles?.Select(e => e.Value).ToList() } }; var apiHeaders = new Dictionary() diff --git a/CHANGELOG.md b/CHANGELOG.md index 092bfc1e..b6a07e12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 0.25.0 + +* Add array-based enum parameters (e.g., `permissions: IReadOnlyList`). +* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. +* Add `getQueueAudits` support to `Health` service. +* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. + ## 0.24.0 * Added ability to create columns and indexes synchronously while creating a table @@ -97,4 +104,4 @@ You can find the new syntax for breaking changes in the [Appwrite API references * Renamed `templateBranch` to `templateVersion` in `createFunction()`. * Renamed `downloadDeployment()` to `getDeploymentDownload()` -> **Please note: This version is compatible with Appwrite 1.6 and later only. If you do not update your Appwrite SDK, old SDKs will not break your app. Appwrite APIs are backwards compatible.** +> **Please note: This version is compatible with Appwrite 1.6 and later only. If you do not update your Appwrite SDK, old SDKs will not break your app. Appwrite APIs are backwards compatible.** \ No newline at end of file diff --git a/LICENSE b/LICENSE index c1602fcd..6f8702b5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index f2c59f43..8c737f50 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Appwrite .NET SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-dotnet.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.8.1-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) **This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dotnet/releases).** -Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the .NET SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the .NET SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ## Installation @@ -17,21 +17,20 @@ Appwrite is an open-source backend as a service server that abstract and simplif Add this reference to your project's `.csproj` file: ```xml - + ``` You can install packages from the command line: ```powershell # Package Manager -Install-Package Appwrite -Version 0.24.0 +Install-Package Appwrite -Version 0.25.0 # or .NET CLI -dotnet add package Appwrite --version 0.24.0 +dotnet add package Appwrite --version 0.25.0 ``` - ## Getting Started ### Initialize & Make API Request diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 9572d690..d3e1348f 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -9,4 +9,6 @@ Client client = new Client() Account account = new Account(client); -JWT result = await account.CreateJWT(); +JWT result = await account.CreateJWT( + duration: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 58e6e426..eb827d51 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -19,19 +19,19 @@ byte[] result = await avatars.GetScreenshot( viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: Theme.Light, // optional + theme: Theme.Dark, // optional userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15", // optional fullpage: true, // optional locale: "en-US", // optional - timezone: Timezone.AfricaAbidjan, // optional + timezone: Timezone.AmericaNewYork, // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional touch: true, // optional - permissions: ["geolocation","notifications"], // optional + permissions: new List<BrowserPermission> { BrowserPermission.Geolocation, BrowserPermission.Notifications }, // optional sleep: 3, // optional width: 800, // optional height: 600, // optional quality: 85, // optional - output: Output.Jpg // optional + output: ImageFormat.Jpeg // optional ); \ No newline at end of file diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index ae5583c6..c1867ce6 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -16,6 +16,6 @@ Index result = await databases.CreateIndex( key: "", type: IndexType.Key, attributes: new List(), - orders: new List(), // optional + orders: new List<OrderBy> { OrderBy.Asc }, // optional lengths: new List() // optional ); \ No newline at end of file diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 00000000..5e9b4aa4 --- /dev/null +++ b/docs/examples/databases/create-longtext-attribute.md @@ -0,0 +1,19 @@ +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 + +Databases databases = new Databases(client); + +AttributeLongtext result = await databases.CreateLongtextAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 00000000..672bd1b5 --- /dev/null +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -0,0 +1,19 @@ +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 + +Databases databases = new Databases(client); + +AttributeMediumtext result = await databases.CreateMediumtextAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 00000000..80d5e4fc --- /dev/null +++ b/docs/examples/databases/create-text-attribute.md @@ -0,0 +1,19 @@ +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 + +Databases databases = new Databases(client); + +AttributeText result = await databases.CreateTextAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 00000000..c86beb26 --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.md @@ -0,0 +1,20 @@ +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 + +Databases databases = new Databases(client); + +AttributeVarchar result = await databases.CreateVarcharAttribute( + databaseId: "", + collectionId: "", + key: "", + size: 1, + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index d9e02e36..024f14fb 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -9,7 +9,7 @@ Client client = new Client() Databases databases = new Databases(client); - result = await databases.GetAttribute( +AttributeBoolean result = await databases.GetAttribute( databaseId: "", collectionId: "", key: "" diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 5448723b..05648d9a 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -12,7 +12,7 @@ Databases databases = new Databases(client); Collection result = await databases.UpdateCollection( databaseId: "", collectionId: "", - name: "", + name: "", // optional permissions: new List { Permission.Read(Role.Any()) }, // optional documentSecurity: false, // optional enabled: false // optional diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 85f3ba5d..8bebfdfd 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -13,7 +13,13 @@ Document result = await databases.UpdateDocument( databaseId: "", collectionId: "", documentId: "", - data: [object], // optional + data: new { + username = "walter.obrien", + email = "walter.obrien@example.com", + fullName = "Walter O'Brien", + age = 33, + isAdmin = false + }, // optional permissions: new List { Permission.Read(Role.Any()) }, // optional transactionId: "" // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index 077ec04d..d7788b43 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -12,7 +12,13 @@ Databases databases = new Databases(client); DocumentList result = await databases.UpdateDocuments( databaseId: "", collectionId: "", - data: [object], // optional + data: new { + username = "walter.obrien", + email = "walter.obrien@example.com", + fullName = "Walter O'Brien", + age = 33, + isAdmin = false + }, // optional queries: new List(), // optional transactionId: "" // optional ); \ No newline at end of file diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 00000000..970e6b31 --- /dev/null +++ b/docs/examples/databases/update-longtext-attribute.md @@ -0,0 +1,19 @@ +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 + +Databases databases = new Databases(client); + +AttributeLongtext result = await databases.UpdateLongtextAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 00000000..f26b4e49 --- /dev/null +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -0,0 +1,19 @@ +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 + +Databases databases = new Databases(client); + +AttributeMediumtext result = await databases.UpdateMediumtextAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 00000000..2133c6de --- /dev/null +++ b/docs/examples/databases/update-text-attribute.md @@ -0,0 +1,19 @@ +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 + +Databases databases = new Databases(client); + +AttributeText result = await databases.UpdateTextAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 00000000..ce7f331d --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.md @@ -0,0 +1,20 @@ +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 + +Databases databases = new Databases(client); + +AttributeVarchar result = await databases.UpdateVarcharAttribute( + databaseId: "", + collectionId: "", + key: "", + required: false, + default: "", + size: 1, // optional + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index d4dd28aa..75db2a55 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -11,6 +11,6 @@ Databases databases = new Databases(client); Database result = await databases.Update( databaseId: "", - name: "", + name: "", // optional enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 9ebcafe8..c54bcfc5 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -13,7 +13,13 @@ Document result = await databases.UpsertDocument( databaseId: "", collectionId: "", documentId: "", - data: [object], + data: new { + username = "walter.obrien", + email = "walter.obrien@example.com", + fullName = "Walter O'Brien", + age = 30, + isAdmin = false + }, // optional permissions: new List { Permission.Read(Role.Any()) }, // optional transactionId: "" // optional ); \ No newline at end of file diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 7d26480d..447ad5ce 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -22,7 +22,7 @@ Function result = await functions.Create( logging: false, // optional entrypoint: "", // optional commands: "", // optional - scopes: new List(), // optional + scopes: new List<Scopes> { Scopes.SessionsWrite }, // optional installationId: "", // optional providerRepositoryId: "", // optional providerBranch: "", // optional diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index a41a0fd3..cb1a251c 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -22,7 +22,7 @@ Function result = await functions.Update( logging: false, // optional entrypoint: "", // optional commands: "", // optional - scopes: new List(), // optional + scopes: new List<Scopes> { Scopes.SessionsWrite }, // optional installationId: "", // optional providerRepositoryId: "", // optional providerBranch: "", // optional diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 0c5ec37c..bf66405c 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -9,4 +9,4 @@ Client client = new Client() Health health = new Health(client); -HealthStatus result = await health.GetCache(); +HealthStatusList result = await health.GetCache(); diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md index 7ae8b148..ab7a8ff6 100644 --- a/docs/examples/health/get-db.md +++ b/docs/examples/health/get-db.md @@ -9,4 +9,4 @@ Client client = new Client() Health health = new Health(client); -HealthStatus result = await health.GetDB(); +HealthStatusList result = await health.GetDB(); diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index 4ffdd7e5..2ddf3963 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -9,4 +9,4 @@ Client client = new Client() Health health = new Health(client); -HealthStatus result = await health.GetPubSub(); +HealthStatusList result = await health.GetPubSub(); diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 00000000..24ff6ad0 --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,14 @@ +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 + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueAudits( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index 3b19981e..65a9973b 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -16,6 +16,6 @@ ColumnIndex result = await tablesDB.CreateIndex( key: "", type: IndexType.Key, columns: new List(), - orders: new List(), // optional + orders: new List<OrderBy> { OrderBy.Asc }, // optional lengths: new List() // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 00000000..86e5bca1 --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,19 @@ +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); + +ColumnLongtext result = await tablesDB.CreateLongtextColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 00000000..54e3bea5 --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,19 @@ +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); + +ColumnMediumtext result = await tablesDB.CreateMediumtextColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 00000000..b1487e7d --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,19 @@ +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); + +ColumnText result = await tablesDB.CreateTextColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 00000000..86c3a78d --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -0,0 +1,20 @@ +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); + +ColumnVarchar result = await tablesDB.CreateVarcharColumn( + databaseId: "", + tableId: "", + key: "", + size: 1, + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index 70089aa0..e4c17807 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -9,7 +9,7 @@ Client client = new Client() TablesDB tablesDB = new TablesDB(client); - result = await tablesDB.GetColumn( +ColumnBoolean result = await tablesDB.GetColumn( databaseId: "", tableId: "", key: "" diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 00000000..b73907bf --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,19 @@ +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); + +ColumnLongtext result = await tablesDB.UpdateLongtextColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 00000000..3bd20fac --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,19 @@ +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); + +ColumnMediumtext result = await tablesDB.UpdateMediumtextColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 32846992..31dfd9dd 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -13,7 +13,13 @@ Row result = await tablesDB.UpdateRow( databaseId: "", tableId: "", rowId: "", - data: [object], // optional + data: new { + username = "walter.obrien", + email = "walter.obrien@example.com", + fullName = "Walter O'Brien", + age = 33, + isAdmin = false + }, // optional permissions: new List { Permission.Read(Role.Any()) }, // optional transactionId: "" // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 368977a0..ddd88e04 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -12,7 +12,13 @@ TablesDB tablesDB = new TablesDB(client); RowList result = await tablesDB.UpdateRows( databaseId: "", tableId: "", - data: [object], // optional + data: new { + username = "walter.obrien", + email = "walter.obrien@example.com", + fullName = "Walter O'Brien", + age = 33, + isAdmin = false + }, // optional queries: new List(), // optional transactionId: "" // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index 24948fd8..9e2e5672 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -12,7 +12,7 @@ TablesDB tablesDB = new TablesDB(client); Table result = await tablesDB.UpdateTable( databaseId: "", tableId: "", - name: "", + name: "", // optional permissions: new List { Permission.Read(Role.Any()) }, // optional rowSecurity: false, // optional enabled: false // optional diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 00000000..6a88a543 --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,19 @@ +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); + +ColumnText result = await tablesDB.UpdateTextColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 00000000..87bbed38 --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -0,0 +1,20 @@ +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); + +ColumnVarchar result = await tablesDB.UpdateVarcharColumn( + databaseId: "", + tableId: "", + key: "", + required: false, + default: "", + size: 1, // optional + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index 920866ba..e254acb4 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -11,6 +11,6 @@ TablesDB tablesDB = new TablesDB(client); Database result = await tablesDB.Update( databaseId: "", - name: "", + name: "", // optional enabled: false // optional ); \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 88ef7146..f4860bc9 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -13,7 +13,13 @@ Row result = await tablesDB.UpsertRow( databaseId: "", tableId: "", rowId: "", - data: [object], // optional + data: new { + username = "walter.obrien", + email = "walter.obrien@example.com", + fullName = "Walter O'Brien", + age = 33, + isAdmin = false + }, // optional permissions: new List { Permission.Read(Role.Any()) }, // optional transactionId: "" // optional ); \ No newline at end of file diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index f3f5682c..787d595e 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,4 +1,5 @@ using Appwrite; +using Appwrite.Enums; using Appwrite.Models; using Appwrite.Services; @@ -11,7 +12,7 @@ Teams teams = new Teams(client); Membership result = await teams.CreateMembership( teamId: "", - roles: new List(), + roles: new List<Roles> { Roles.Admin }, email: "email@example.com", // optional userId: "", // optional phone: "+12065550100", // optional diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 3583b4d0..dd942cc8 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,4 +1,5 @@ using Appwrite; +using Appwrite.Enums; using Appwrite.Models; using Appwrite.Services; @@ -12,5 +13,5 @@ Teams teams = new Teams(client); Membership result = await teams.UpdateMembership( teamId: "", membershipId: "", - roles: new List() + roles: new List<Roles> { Roles.Admin } ); \ No newline at end of file