Skip to content

Commit 883292e

Browse files
authored
Merge pull request #88 from appwrite/dev
2 parents c95e61e + 618cff6 commit 883292e

44 files changed

Lines changed: 990 additions & 216 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Appwrite/Appwrite.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
44
<PackageId>Appwrite</PackageId>
5-
<Version>1.0.0</Version>
5+
<Version>2.0.0</Version>
66
<Authors>Appwrite Team</Authors>
77
<Company>Appwrite Team</Company>
88
<Description>

Appwrite/Client.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ public Client(
6969
_headers = new Dictionary<string, string>()
7070
{
7171
{ "content-type", "application/json" },
72-
{ "user-agent" , $"AppwriteDotNetSDK/1.0.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
72+
{ "user-agent" , $"AppwriteDotNetSDK/2.0.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
7373
{ "x-sdk-name", ".NET" },
7474
{ "x-sdk-platform", "server" },
7575
{ "x-sdk-language", "dotnet" },
76-
{ "x-sdk-version", "1.0.0"},
77-
{ "X-Appwrite-Response-Format", "1.8.0" }
76+
{ "x-sdk-version", "2.0.0"},
77+
{ "X-Appwrite-Response-Format", "1.9.0" }
7878
};
7979

8080
_config = new Dictionary<string, string>();
@@ -156,6 +156,30 @@ public Client SetForwardedUserAgent(string value) {
156156
return this;
157157
}
158158

159+
/// <summary>Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.</summary>
160+
public Client SetImpersonateUserId(string value) {
161+
_config.Add("impersonateUserId", value);
162+
AddHeader("X-Appwrite-Impersonate-User-Id", value);
163+
164+
return this;
165+
}
166+
167+
/// <summary>Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.</summary>
168+
public Client SetImpersonateUserEmail(string value) {
169+
_config.Add("impersonateUserEmail", value);
170+
AddHeader("X-Appwrite-Impersonate-User-Email", value);
171+
172+
return this;
173+
}
174+
175+
/// <summary>Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data.</summary>
176+
public Client SetImpersonateUserPhone(string value) {
177+
_config.Add("impersonateUserPhone", value);
178+
AddHeader("X-Appwrite-Impersonate-User-Phone", value);
179+
180+
return this;
181+
}
182+
159183
public Client AddHeader(string key, string value)
160184
{
161185
_headers.Add(key, value);

Appwrite/Enums/BackupServices.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public BackupServices(string value)
1212
}
1313

1414
public static BackupServices Databases => new BackupServices("databases");
15+
public static BackupServices Tablesdb => new BackupServices("tablesdb");
16+
public static BackupServices Documentsdb => new BackupServices("documentsdb");
17+
public static BackupServices Vectorsdb => new BackupServices("vectorsdb");
1518
public static BackupServices Functions => new BackupServices("functions");
1619
public static BackupServices Storage => new BackupServices("storage");
1720
}

Appwrite/Enums/DatabaseType.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ public DatabaseType(string value)
1313

1414
public static DatabaseType Legacy => new DatabaseType("legacy");
1515
public static DatabaseType Tablesdb => new DatabaseType("tablesdb");
16+
public static DatabaseType Documentsdb => new DatabaseType("documentsdb");
17+
public static DatabaseType Vectorsdb => new DatabaseType("vectorsdb");
1618
}
1719
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace Appwrite.Enums
4+
{
5+
public class DatabasesIndexType : IEnum
6+
{
7+
public string Value { get; private set; }
8+
9+
public DatabasesIndexType(string value)
10+
{
11+
Value = value;
12+
}
13+
14+
public static DatabasesIndexType Key => new DatabasesIndexType("key");
15+
public static DatabasesIndexType Fulltext => new DatabasesIndexType("fulltext");
16+
public static DatabasesIndexType Unique => new DatabasesIndexType("unique");
17+
public static DatabasesIndexType Spatial => new DatabasesIndexType("spatial");
18+
}
19+
}

Appwrite/Enums/IndexType.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

Appwrite/Enums/Scopes.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ public Scopes(string value)
6868
public static Scopes AssistantRead => new Scopes("assistant.read");
6969
public static Scopes TokensRead => new Scopes("tokens.read");
7070
public static Scopes TokensWrite => new Scopes("tokens.write");
71+
public static Scopes WebhooksRead => new Scopes("webhooks.read");
72+
public static Scopes WebhooksWrite => new Scopes("webhooks.write");
73+
public static Scopes ProjectRead => new Scopes("project.read");
74+
public static Scopes ProjectWrite => new Scopes("project.write");
7175
public static Scopes PoliciesWrite => new Scopes("policies.write");
7276
public static Scopes PoliciesRead => new Scopes("policies.read");
7377
public static Scopes ArchivesRead => new Scopes("archives.read");
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace Appwrite.Enums
4+
{
5+
public class TablesDBIndexType : IEnum
6+
{
7+
public string Value { get; private set; }
8+
9+
public TablesDBIndexType(string value)
10+
{
11+
Value = value;
12+
}
13+
14+
public static TablesDBIndexType Key => new TablesDBIndexType("key");
15+
public static TablesDBIndexType Fulltext => new TablesDBIndexType("fulltext");
16+
public static TablesDBIndexType Unique => new TablesDBIndexType("unique");
17+
public static TablesDBIndexType Spatial => new TablesDBIndexType("spatial");
18+
}
19+
}

Appwrite/Enums/TemplateReferenceType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public TemplateReferenceType(string value)
1111
Value = value;
1212
}
1313

14-
public static TemplateReferenceType Branch => new TemplateReferenceType("branch");
1514
public static TemplateReferenceType Commit => new TemplateReferenceType("commit");
15+
public static TemplateReferenceType Branch => new TemplateReferenceType("branch");
1616
public static TemplateReferenceType Tag => new TemplateReferenceType("tag");
1717
}
1818
}

Appwrite/Models/Document.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class Document
1515
public string Id { get; private set; }
1616

1717
[JsonPropertyName("$sequence")]
18-
public long Sequence { get; private set; }
18+
public string Sequence { get; private set; }
1919

2020
[JsonPropertyName("$collectionId")]
2121
public string CollectionId { get; private set; }
@@ -36,7 +36,7 @@ public class Document
3636

3737
public Document(
3838
string id,
39-
long sequence,
39+
string sequence,
4040
string collectionId,
4141
string databaseId,
4242
string createdAt,
@@ -56,7 +56,7 @@ Dictionary<string, object> data
5656

5757
public static Document From(Dictionary<string, object> map) => new Document(
5858
id: map["$id"].ToString(),
59-
sequence: Convert.ToInt64(map["$sequence"]),
59+
sequence: map["$sequence"].ToString(),
6060
collectionId: map["$collectionId"].ToString(),
6161
databaseId: map["$databaseId"].ToString(),
6262
createdAt: map["$createdAt"].ToString(),

0 commit comments

Comments
 (0)