Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Appwrite/Appwrite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<PackageId>Appwrite</PackageId>
<Version>0.25.0</Version>
<Version>0.25.1</Version>
<Authors>Appwrite Team</Authors>
<Company>Appwrite Team</Company>
<Description>
Expand Down
4 changes: 2 additions & 2 deletions Appwrite/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public Client(
_headers = new Dictionary<string, string>()
{
{ "content-type", "application/json" },
{ "user-agent" , $"AppwriteDotNetSDK/0.25.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
{ "user-agent" , $"AppwriteDotNetSDK/0.25.1 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
{ "x-sdk-name", ".NET" },
{ "x-sdk-platform", "server" },
{ "x-sdk-language", "dotnet" },
{ "x-sdk-version", "0.25.0"},
{ "x-sdk-version", "0.25.1"},
{ "X-Appwrite-Response-Format", "1.8.0" }
};

Expand Down
18 changes: 18 additions & 0 deletions Appwrite/Enums/BackupServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;

namespace Appwrite.Enums
{
public class BackupServices : IEnum
{
public string Value { get; private set; }

public BackupServices(string value)
{
Value = value;
}

public static BackupServices Databases => new BackupServices("databases");
public static BackupServices Functions => new BackupServices("functions");
public static BackupServices Storage => new BackupServices("storage");
}
}
5 changes: 2 additions & 3 deletions Appwrite/Enums/BuildRuntime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public BuildRuntime(string value)
public static BuildRuntime Python312 => new BuildRuntime("python-3.12");
public static BuildRuntime PythonMl311 => new BuildRuntime("python-ml-3.11");
public static BuildRuntime PythonMl312 => new BuildRuntime("python-ml-3.12");
public static BuildRuntime Deno121 => new BuildRuntime("deno-1.21");
public static BuildRuntime Deno124 => new BuildRuntime("deno-1.24");
public static BuildRuntime Deno135 => new BuildRuntime("deno-1.35");
public static BuildRuntime Deno140 => new BuildRuntime("deno-1.40");
public static BuildRuntime Deno146 => new BuildRuntime("deno-1.46");
public static BuildRuntime Deno20 => new BuildRuntime("deno-2.0");
Expand All @@ -50,6 +47,7 @@ public BuildRuntime(string value)
public static BuildRuntime Dart35 => new BuildRuntime("dart-3.5");
public static BuildRuntime Dart38 => new BuildRuntime("dart-3.8");
public static BuildRuntime Dart39 => new BuildRuntime("dart-3.9");
public static BuildRuntime Dart310 => new BuildRuntime("dart-3.10");
public static BuildRuntime Dotnet60 => new BuildRuntime("dotnet-6.0");
public static BuildRuntime Dotnet70 => new BuildRuntime("dotnet-7.0");
public static BuildRuntime Dotnet80 => new BuildRuntime("dotnet-8.0");
Expand Down Expand Up @@ -78,5 +76,6 @@ public BuildRuntime(string value)
public static BuildRuntime Flutter329 => new BuildRuntime("flutter-3.29");
public static BuildRuntime Flutter332 => new BuildRuntime("flutter-3.32");
public static BuildRuntime Flutter335 => new BuildRuntime("flutter-3.35");
public static BuildRuntime Flutter338 => new BuildRuntime("flutter-3.38");
}
}
2 changes: 2 additions & 0 deletions Appwrite/Enums/OAuthProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,7 @@ 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 GithubImagine => new OAuthProvider("githubImagine");
public static OAuthProvider GoogleImagine => new OAuthProvider("googleImagine");
}
}
18 changes: 0 additions & 18 deletions Appwrite/Enums/Roles.cs

This file was deleted.

5 changes: 2 additions & 3 deletions Appwrite/Enums/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public Runtime(string value)
public static Runtime Python312 => new Runtime("python-3.12");
public static Runtime PythonMl311 => new Runtime("python-ml-3.11");
public static Runtime PythonMl312 => new Runtime("python-ml-3.12");
public static Runtime Deno121 => new Runtime("deno-1.21");
public static Runtime Deno124 => new Runtime("deno-1.24");
public static Runtime Deno135 => new Runtime("deno-1.35");
public static Runtime Deno140 => new Runtime("deno-1.40");
public static Runtime Deno146 => new Runtime("deno-1.46");
public static Runtime Deno20 => new Runtime("deno-2.0");
Expand All @@ -50,6 +47,7 @@ public Runtime(string value)
public static Runtime Dart35 => new Runtime("dart-3.5");
public static Runtime Dart38 => new Runtime("dart-3.8");
public static Runtime Dart39 => new Runtime("dart-3.9");
public static Runtime Dart310 => new Runtime("dart-3.10");
public static Runtime Dotnet60 => new Runtime("dotnet-6.0");
public static Runtime Dotnet70 => new Runtime("dotnet-7.0");
public static Runtime Dotnet80 => new Runtime("dotnet-8.0");
Expand Down Expand Up @@ -78,5 +76,6 @@ public Runtime(string value)
public static Runtime Flutter329 => new Runtime("flutter-3.29");
public static Runtime Flutter332 => new Runtime("flutter-3.32");
public static Runtime Flutter335 => new Runtime("flutter-3.35");
public static Runtime Flutter338 => new Runtime("flutter-3.38");
}
}
8 changes: 8 additions & 0 deletions Appwrite/Enums/Scopes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,13 @@ public Scopes(string value)
public static Scopes AssistantRead => new Scopes("assistant.read");
public static Scopes TokensRead => new Scopes("tokens.read");
public static Scopes TokensWrite => new Scopes("tokens.write");
public static Scopes PoliciesWrite => new Scopes("policies.write");
public static Scopes PoliciesRead => new Scopes("policies.read");
public static Scopes ArchivesRead => new Scopes("archives.read");
public static Scopes ArchivesWrite => new Scopes("archives.write");
public static Scopes RestorationsRead => new Scopes("restorations.read");
public static Scopes RestorationsWrite => new Scopes("restorations.write");
public static Scopes DomainsRead => new Scopes("domains.read");
public static Scopes DomainsWrite => new Scopes("domains.write");
}
}
109 changes: 109 additions & 0 deletions Appwrite/Models/BackupArchive.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

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 BackupArchive
{
[JsonPropertyName("$id")]
public string Id { get; private set; }

[JsonPropertyName("$createdAt")]
public string CreatedAt { get; private set; }

[JsonPropertyName("$updatedAt")]
public string UpdatedAt { get; private set; }

[JsonPropertyName("policyId")]
public string PolicyId { get; private set; }

[JsonPropertyName("size")]
public long Size { get; private set; }

[JsonPropertyName("status")]
public string Status { get; private set; }

[JsonPropertyName("startedAt")]
public string StartedAt { get; private set; }

[JsonPropertyName("migrationId")]
public string MigrationId { get; private set; }

[JsonPropertyName("services")]
public List<string> Services { get; private set; }

[JsonPropertyName("resources")]
public List<string> Resources { get; private set; }

[JsonPropertyName("resourceId")]
public string? ResourceId { get; private set; }

[JsonPropertyName("resourceType")]
public string? ResourceType { get; private set; }

public BackupArchive(
string id,
string createdAt,
string updatedAt,
string policyId,
long size,
string status,
string startedAt,
string migrationId,
List<string> services,
List<string> resources,
string? resourceId,
string? resourceType
) {
Id = id;
CreatedAt = createdAt;
UpdatedAt = updatedAt;
PolicyId = policyId;
Size = size;
Status = status;
StartedAt = startedAt;
MigrationId = migrationId;
Services = services;
Resources = resources;
ResourceId = resourceId;
ResourceType = resourceType;
}

public static BackupArchive From(Dictionary<string, object> map) => new BackupArchive(
id: map["$id"].ToString(),
createdAt: map["$createdAt"].ToString(),
updatedAt: map["$updatedAt"].ToString(),
policyId: map["policyId"].ToString(),
size: Convert.ToInt64(map["size"]),
status: map["status"].ToString(),
startedAt: map["startedAt"].ToString(),
migrationId: map["migrationId"].ToString(),
services: map["services"].ConvertToList<string>(),
resources: map["resources"].ConvertToList<string>(),
resourceId: map.TryGetValue("resourceId", out var resourceId) ? resourceId?.ToString() : null,
resourceType: map.TryGetValue("resourceType", out var resourceType) ? resourceType?.ToString() : null
);

public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "$id", Id },
{ "$createdAt", CreatedAt },
{ "$updatedAt", UpdatedAt },
{ "policyId", PolicyId },
{ "size", Size },
{ "status", Status },
{ "startedAt", StartedAt },
{ "migrationId", MigrationId },
{ "services", Services },
{ "resources", Resources },
{ "resourceId", ResourceId },
{ "resourceType", ResourceType }
};
}
}
39 changes: 39 additions & 0 deletions Appwrite/Models/BackupArchiveList.cs
Original file line number Diff line number Diff line change
@@ -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 BackupArchiveList
{
[JsonPropertyName("total")]
public long Total { get; private set; }

[JsonPropertyName("archives")]
public List<BackupArchive> Archives { get; private set; }

public BackupArchiveList(
long total,
List<BackupArchive> archives
) {
Total = total;
Archives = archives;
}

public static BackupArchiveList From(Dictionary<string, object> map) => new BackupArchiveList(
total: Convert.ToInt64(map["total"]),
archives: map["archives"].ConvertToList<Dictionary<string, object>>().Select(it => BackupArchive.From(map: it)).ToList()
);

public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "total", Total },
{ "archives", Archives.Select(it => it.ToMap()) }
};
}
}
102 changes: 102 additions & 0 deletions Appwrite/Models/BackupPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

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 BackupPolicy
{
[JsonPropertyName("$id")]
public string Id { get; private set; }

[JsonPropertyName("name")]
public string Name { get; private set; }

[JsonPropertyName("$createdAt")]
public string CreatedAt { get; private set; }

[JsonPropertyName("$updatedAt")]
public string UpdatedAt { get; private set; }

[JsonPropertyName("services")]
public List<string> Services { get; private set; }

[JsonPropertyName("resources")]
public List<string> Resources { get; private set; }

[JsonPropertyName("resourceId")]
public string? ResourceId { get; private set; }

[JsonPropertyName("resourceType")]
public string? ResourceType { get; private set; }

[JsonPropertyName("retention")]
public long Retention { get; private set; }

[JsonPropertyName("schedule")]
public string Schedule { get; private set; }

[JsonPropertyName("enabled")]
public bool Enabled { get; private set; }

public BackupPolicy(
string id,
string name,
string createdAt,
string updatedAt,
List<string> services,
List<string> resources,
string? resourceId,
string? resourceType,
long retention,
string schedule,
bool enabled
) {
Id = id;
Name = name;
CreatedAt = createdAt;
UpdatedAt = updatedAt;
Services = services;
Resources = resources;
ResourceId = resourceId;
ResourceType = resourceType;
Retention = retention;
Schedule = schedule;
Enabled = enabled;
}

public static BackupPolicy From(Dictionary<string, object> map) => new BackupPolicy(
id: map["$id"].ToString(),
name: map["name"].ToString(),
createdAt: map["$createdAt"].ToString(),
updatedAt: map["$updatedAt"].ToString(),
services: map["services"].ConvertToList<string>(),
resources: map["resources"].ConvertToList<string>(),
resourceId: map.TryGetValue("resourceId", out var resourceId) ? resourceId?.ToString() : null,
resourceType: map.TryGetValue("resourceType", out var resourceType) ? resourceType?.ToString() : null,
retention: Convert.ToInt64(map["retention"]),
schedule: map["schedule"].ToString(),
enabled: (bool)map["enabled"]
);

public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "$id", Id },
{ "name", Name },
{ "$createdAt", CreatedAt },
{ "$updatedAt", UpdatedAt },
{ "services", Services },
{ "resources", Resources },
{ "resourceId", ResourceId },
{ "resourceType", ResourceType },
{ "retention", Retention },
{ "schedule", Schedule },
{ "enabled", Enabled }
};
}
}
Loading