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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Appwrite/Appwrite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<PackageId>Appwrite</PackageId>
<Version>0.24.0</Version>
<Version>0.24.1</Version>
<Authors>Appwrite Team</Authors>
<Company>Appwrite Team</Company>
<Description>
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
</Description>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
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.24.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
{ "user-agent" , $"AppwriteDotNetSDK/0.24.1 ({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.24.1"},
{ "X-Appwrite-Response-Format", "1.8.0" }
};

Expand Down
3 changes: 0 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 Down
1 change: 1 addition & 0 deletions Appwrite/Enums/Name.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
1 change: 0 additions & 1 deletion Appwrite/Enums/OAuthProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
22 changes: 0 additions & 22 deletions Appwrite/Enums/Output.cs

This file was deleted.

3 changes: 0 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 Down
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 }
};
}
}
39 changes: 39 additions & 0 deletions Appwrite/Models/BackupPolicyList.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 BackupPolicyList
{
[JsonPropertyName("total")]
public long Total { get; private set; }

[JsonPropertyName("policies")]
public List<BackupPolicy> Policies { get; private set; }

public BackupPolicyList(
long total,
List<BackupPolicy> policies
) {
Total = total;
Policies = policies;
}

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

public Dictionary<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "total", Total },
{ "policies", Policies.Select(it => it.ToMap()) }
};
}
}
Loading