diff --git a/Appwrite/Appwrite.csproj b/Appwrite/Appwrite.csproj index a5d8d3d0..0f4eba21 100644 --- a/Appwrite/Appwrite.csproj +++ b/Appwrite/Appwrite.csproj @@ -2,7 +2,7 @@ netstandard2.0;net462 Appwrite - 0.27.0 + 1.0.0 Appwrite Team Appwrite Team diff --git a/Appwrite/Client.cs b/Appwrite/Client.cs index ee93af48..5fa902be 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.27.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"}, + { "user-agent" , $"AppwriteDotNetSDK/1.0.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"}, { "x-sdk-name", ".NET" }, { "x-sdk-platform", "server" }, { "x-sdk-language", "dotnet" }, - { "x-sdk-version", "0.27.0"}, + { "x-sdk-version", "1.0.0"}, { "X-Appwrite-Response-Format", "1.8.0" } }; diff --git a/Appwrite/Services/Databases.cs b/Appwrite/Services/Databases.cs index 4b27a287..24faf620 100644 --- a/Appwrite/Services/Databases.cs +++ b/Appwrite/Services/Databases.cs @@ -1539,6 +1539,44 @@ static Models.AttributeRelationship Convert(Dictionary it) => } + /// + /// Update relationship attribute. [Learn more about relationship + /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + /// + /// + /// + [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.")] + public Task UpdateRelationshipAttribute(string databaseId, string collectionId, string key, Appwrite.Enums.RelationMutate? onDelete = null, string? newKey = null) + { + var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}" + .Replace("{databaseId}", databaseId) + .Replace("{collectionId}", collectionId) + .Replace("{key}", key); + + var apiParameters = new Dictionary() + { + { "onDelete", onDelete?.Value }, + { "newKey", newKey } + }; + + var apiHeaders = new Dictionary() + { + { "content-type", "application/json" } + }; + + + static Models.AttributeRelationship Convert(Dictionary it) => + Models.AttributeRelationship.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 string attribute. /// @@ -1914,51 +1952,13 @@ public Task DeleteAttribute(string databaseId, string collectionId, stri } - /// - /// Update relationship attribute. [Learn more about relationship - /// attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - /// - /// - /// - [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead.")] - public Task UpdateRelationshipAttribute(string databaseId, string collectionId, string key, Appwrite.Enums.RelationMutate? onDelete = null, string? newKey = null) - { - var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship" - .Replace("{databaseId}", databaseId) - .Replace("{collectionId}", collectionId) - .Replace("{key}", key); - - var apiParameters = new Dictionary() - { - { "onDelete", onDelete?.Value }, - { "newKey", newKey } - }; - - var apiHeaders = new Dictionary() - { - { "content-type", "application/json" } - }; - - - static Models.AttributeRelationship Convert(Dictionary it) => - Models.AttributeRelationship.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 a list of all the user's documents in a given collection. You can use /// the query params to filter your results. /// /// [Obsolete("This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead.")] - public Task ListDocuments(string databaseId, string collectionId, List? queries = null, string? transactionId = null, bool? total = null) + public Task ListDocuments(string databaseId, string collectionId, List? queries = null, string? transactionId = null, bool? total = null, long? ttl = null) { var apiPath = "/databases/{databaseId}/collections/{collectionId}/documents" .Replace("{databaseId}", databaseId) @@ -1968,7 +1968,8 @@ static Models.AttributeRelationship Convert(Dictionary it) => { { "queries", queries }, { "transactionId", transactionId }, - { "total", total } + { "total", total }, + { "ttl", ttl } }; var apiHeaders = new Dictionary() diff --git a/Appwrite/Services/Health.cs b/Appwrite/Services/Health.cs index ef8eca7b..20b5901a 100644 --- a/Appwrite/Services/Health.cs +++ b/Appwrite/Services/Health.cs @@ -132,6 +132,39 @@ static Models.HealthCertificate Convert(Dictionary it) => } + /// + /// Get console pausing health status. Monitors projects approaching the pause + /// threshold to detect potential issues with console access tracking. + /// + /// + /// + public Task GetConsolePausing(long? threshold = null, long? inactivityDays = null) + { + var apiPath = "/health/console-pausing"; + + var apiParameters = new Dictionary() + { + { "threshold", threshold }, + { "inactivityDays", inactivityDays } + }; + + var apiHeaders = new Dictionary() + { + }; + + + static Models.HealthStatus Convert(Dictionary it) => + Models.HealthStatus.From(map: it); + + return _client.Call( + method: "GET", + path: apiPath, + headers: apiHeaders, + parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!, + convert: Convert); + + } + /// /// Check the Appwrite database servers are up and connection is successful. /// diff --git a/Appwrite/Services/Sites.cs b/Appwrite/Services/Sites.cs index 26019877..5f12bd3f 100644 --- a/Appwrite/Services/Sites.cs +++ b/Appwrite/Services/Sites.cs @@ -333,7 +333,7 @@ static Models.DeploymentList Convert(Dictionary it) => /// need to update the site's deployment to use your new deployment ID. /// /// - public Task CreateDeployment(string siteId, InputFile code, bool activate, string? installCommand = null, string? buildCommand = null, string? outputDirectory = null, Action? onProgress = null) + public Task CreateDeployment(string siteId, InputFile code, string? installCommand = null, string? buildCommand = null, string? outputDirectory = null, bool? activate = null, Action? onProgress = null) { var apiPath = "/sites/{siteId}/deployments" .Replace("{siteId}", siteId); diff --git a/Appwrite/Services/TablesDB.cs b/Appwrite/Services/TablesDB.cs index b0ae6e50..2e49c22b 100644 --- a/Appwrite/Services/TablesDB.cs +++ b/Appwrite/Services/TablesDB.cs @@ -2053,7 +2053,7 @@ public Task DeleteIndex(string databaseId, string tableId, string key) /// params to filter your results. /// /// - public Task ListRows(string databaseId, string tableId, List? queries = null, string? transactionId = null, bool? total = null) + public Task ListRows(string databaseId, string tableId, List? queries = null, string? transactionId = null, bool? total = null, long? ttl = null) { var apiPath = "/tablesdb/{databaseId}/tables/{tableId}/rows" .Replace("{databaseId}", databaseId) @@ -2063,7 +2063,8 @@ public Task DeleteIndex(string databaseId, string tableId, string key) { { "queries", queries }, { "transactionId", transactionId }, - { "total", total } + { "total", total }, + { "ttl", ttl } }; var apiHeaders = new Dictionary() diff --git a/CHANGELOG.md b/CHANGELOG.md index a63cd25c..6637c1ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 1.0.0 + +* Breaking: Sites.CreateDeployment signature changed; 'activate' moved after outputDirectory. +* Breaking: Relationship API path updated; old path deprecated. +* Added GetConsolePausing health check method. +* Added ttl parameter to ListDocuments and ListRows. +* Updated deployment example to show activate parameter placement. + ## 0.27.0 * Added broad new runtime options across multiple languages (Node 23, 24, 25; PHP 8.4; Ruby 3.4 and 4.0; Python 3.13 and 3.14; Python ML 3.13 and 3.14; Deno 2.5 and 2.6; Go 1.23–1.26; Bun 1.2 and 1.3; Java 25; Kotlin 2.3; Swift 6.2; and Dotnet 10). diff --git a/README.md b/README.md index e8a63c12..30f17fca 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,17 @@ Appwrite is an open-source backend as a service server that abstracts and simpli Add this reference to your project's `.csproj` file: ```xml - + ``` You can install packages from the command line: ```powershell # Package Manager -Install-Package Appwrite -Version 0.27.0 +Install-Package Appwrite -Version 1.0.0 # or .NET CLI -dotnet add package Appwrite --version 0.27.0 +dotnet add package Appwrite --version 1.0.0 ``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index c5f69e3e..cb2d2dbe 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -15,5 +15,6 @@ DocumentList result = await databases.ListDocuments( collectionId: "", queries: new List(), // optional transactionId: "", // optional - total: false // optional + total: false, // optional + ttl: 0 // optional );``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md new file mode 100644 index 00000000..b57ee49e --- /dev/null +++ b/docs/examples/health/get-console-pausing.md @@ -0,0 +1,16 @@ +```csharp +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("") // Your project ID + .SetKey(""); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.GetConsolePausing( + threshold: 0, // optional + inactivityDays: 0 // optional +);``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index d9be1a1e..692d7743 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -13,8 +13,8 @@ Sites sites = new Sites(client); Deployment result = await sites.CreateDeployment( siteId: "", code: InputFile.FromPath("./path-to-files/image.jpg"), - activate: false, installCommand: "", // optional buildCommand: "", // optional - outputDirectory: "" // optional + outputDirectory: "", // optional + activate: false // optional );``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index a0f582fc..e9186378 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -15,5 +15,6 @@ RowList result = await tablesDB.ListRows( tableId: "", queries: new List(), // optional transactionId: "", // optional - total: false // optional + total: false, // optional + ttl: 0 // optional );```