Skip to content
Merged
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.25.0</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.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" }
};

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

This file was deleted.

18 changes: 18 additions & 0 deletions Appwrite/Enums/Roles.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
70 changes: 70 additions & 0 deletions Appwrite/Enums/Scopes.cs
Original file line number Diff line number Diff line change
@@ -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");
}
}
88 changes: 88 additions & 0 deletions Appwrite/Models/AttributeLongtext.cs
Original file line number Diff line number Diff line change
@@ -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<string, object> 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<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "key", Key },
{ "type", Type },
{ "status", Status.Value },
{ "error", Error },
{ "required", Required },
{ "array", Array },
{ "$createdAt", CreatedAt },
{ "$updatedAt", UpdatedAt },
{ "default", Default }
};
}
}
88 changes: 88 additions & 0 deletions Appwrite/Models/AttributeMediumtext.cs
Original file line number Diff line number Diff line change
@@ -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<string, object> 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<string, object?> ToMap() => new Dictionary<string, object?>()
{
{ "key", Key },
{ "type", Type },
{ "status", Status.Value },
{ "error", Error },
{ "required", Required },
{ "array", Array },
{ "$createdAt", CreatedAt },
{ "$updatedAt", UpdatedAt },
{ "default", Default }
};
}
}
Loading