Skip to content

Commit 5e3b2fd

Browse files
authored
Merge pull request #50 from appwrite/dev
Update attributes
2 parents e0ca491 + 1c75191 commit 5e3b2fd

14 files changed

+59
-36
lines changed

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;net461</TargetFrameworks>
44
<PackageId>Appwrite</PackageId>
5-
<Version>0.9.0</Version>
5+
<Version>0.10.0</Version>
66
<Authors>Appwrite Team</Authors>
77
<Company>Appwrite Team</Company>
88
<Description>

Appwrite/Client.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ public Client(
6969
_headers = new Dictionary<string, string>()
7070
{
7171
{ "content-type", "application/json" },
72-
{ "user-agent" , "AppwriteDotNetSDK/0.9.0 (${Environment.OSVersion.Platform}; ${Environment.OSVersion.VersionString})"},
72+
{ "user-agent" , "AppwriteDotNetSDK/0.10.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", "0.9.0"}, { "X-Appwrite-Response-Format", "1.6.0" }
76+
{ "x-sdk-version", "0.10.0"},
77+
{ "X-Appwrite-Response-Format", "1.6.0" }
7778
};
7879

7980
_config = new Dictionary<string, string>();

Appwrite/Services/Databases.cs

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ static Models.AttributeBoolean Convert(Dictionary<string, object> it) =>
448448
/// already existing documents.
449449
/// </para>
450450
/// </summary>
451-
public Task<Models.AttributeBoolean> UpdateBooleanAttribute(string databaseId, string collectionId, string key, bool required, bool xdefault)
451+
public Task<Models.AttributeBoolean> UpdateBooleanAttribute(string databaseId, string collectionId, string key, bool required, bool xdefault, string? newKey = null)
452452
{
453453
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}"
454454
.Replace("{databaseId}", databaseId)
@@ -458,7 +458,8 @@ static Models.AttributeBoolean Convert(Dictionary<string, object> it) =>
458458
var apiParameters = new Dictionary<string, object?>()
459459
{
460460
{ "required", required },
461-
{ "default", xdefault }
461+
{ "default", xdefault },
462+
{ "newKey", newKey }
462463
};
463464

464465
var apiHeaders = new Dictionary<string, string>()
@@ -524,7 +525,7 @@ static Models.AttributeDatetime Convert(Dictionary<string, object> it) =>
524525
/// already existing documents.
525526
/// </para>
526527
/// </summary>
527-
public Task<Models.AttributeDatetime> UpdateDatetimeAttribute(string databaseId, string collectionId, string key, bool required, string xdefault)
528+
public Task<Models.AttributeDatetime> UpdateDatetimeAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null)
528529
{
529530
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}"
530531
.Replace("{databaseId}", databaseId)
@@ -534,7 +535,8 @@ static Models.AttributeDatetime Convert(Dictionary<string, object> it) =>
534535
var apiParameters = new Dictionary<string, object?>()
535536
{
536537
{ "required", required },
537-
{ "default", xdefault }
538+
{ "default", xdefault },
539+
{ "newKey", newKey }
538540
};
539541

540542
var apiHeaders = new Dictionary<string, string>()
@@ -602,7 +604,7 @@ static Models.AttributeEmail Convert(Dictionary<string, object> it) =>
602604
///
603605
/// </para>
604606
/// </summary>
605-
public Task<Models.AttributeEmail> UpdateEmailAttribute(string databaseId, string collectionId, string key, bool required, string xdefault)
607+
public Task<Models.AttributeEmail> UpdateEmailAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null)
606608
{
607609
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}"
608610
.Replace("{databaseId}", databaseId)
@@ -612,7 +614,8 @@ static Models.AttributeEmail Convert(Dictionary<string, object> it) =>
612614
var apiParameters = new Dictionary<string, object?>()
613615
{
614616
{ "required", required },
615-
{ "default", xdefault }
617+
{ "default", xdefault },
618+
{ "newKey", newKey }
616619
};
617620

618621
var apiHeaders = new Dictionary<string, string>()
@@ -682,7 +685,7 @@ static Models.AttributeEnum Convert(Dictionary<string, object> it) =>
682685
///
683686
/// </para>
684687
/// </summary>
685-
public Task<Models.AttributeEnum> UpdateEnumAttribute(string databaseId, string collectionId, string key, List<string> elements, bool required, string xdefault)
688+
public Task<Models.AttributeEnum> UpdateEnumAttribute(string databaseId, string collectionId, string key, List<string> elements, bool required, string xdefault, string? newKey = null)
686689
{
687690
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}"
688691
.Replace("{databaseId}", databaseId)
@@ -693,7 +696,8 @@ static Models.AttributeEnum Convert(Dictionary<string, object> it) =>
693696
{
694697
{ "elements", elements },
695698
{ "required", required },
696-
{ "default", xdefault }
699+
{ "default", xdefault },
700+
{ "newKey", newKey }
697701
};
698702

699703
var apiHeaders = new Dictionary<string, string>()
@@ -764,7 +768,7 @@ static Models.AttributeFloat Convert(Dictionary<string, object> it) =>
764768
///
765769
/// </para>
766770
/// </summary>
767-
public Task<Models.AttributeFloat> UpdateFloatAttribute(string databaseId, string collectionId, string key, bool required, double min, double max, double xdefault)
771+
public Task<Models.AttributeFloat> UpdateFloatAttribute(string databaseId, string collectionId, string key, bool required, double min, double max, double xdefault, string? newKey = null)
768772
{
769773
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}"
770774
.Replace("{databaseId}", databaseId)
@@ -776,7 +780,8 @@ static Models.AttributeFloat Convert(Dictionary<string, object> it) =>
776780
{ "required", required },
777781
{ "min", min },
778782
{ "max", max },
779-
{ "default", xdefault }
783+
{ "default", xdefault },
784+
{ "newKey", newKey }
780785
};
781786

782787
var apiHeaders = new Dictionary<string, string>()
@@ -847,7 +852,7 @@ static Models.AttributeInteger Convert(Dictionary<string, object> it) =>
847852
///
848853
/// </para>
849854
/// </summary>
850-
public Task<Models.AttributeInteger> UpdateIntegerAttribute(string databaseId, string collectionId, string key, bool required, long min, long max, long xdefault)
855+
public Task<Models.AttributeInteger> UpdateIntegerAttribute(string databaseId, string collectionId, string key, bool required, long min, long max, long xdefault, string? newKey = null)
851856
{
852857
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}"
853858
.Replace("{databaseId}", databaseId)
@@ -859,7 +864,8 @@ static Models.AttributeInteger Convert(Dictionary<string, object> it) =>
859864
{ "required", required },
860865
{ "min", min },
861866
{ "max", max },
862-
{ "default", xdefault }
867+
{ "default", xdefault },
868+
{ "newKey", newKey }
863869
};
864870

865871
var apiHeaders = new Dictionary<string, string>()
@@ -927,7 +933,7 @@ static Models.AttributeIp Convert(Dictionary<string, object> it) =>
927933
///
928934
/// </para>
929935
/// </summary>
930-
public Task<Models.AttributeIp> UpdateIpAttribute(string databaseId, string collectionId, string key, bool required, string xdefault)
936+
public Task<Models.AttributeIp> UpdateIpAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null)
931937
{
932938
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}"
933939
.Replace("{databaseId}", databaseId)
@@ -937,7 +943,8 @@ static Models.AttributeIp Convert(Dictionary<string, object> it) =>
937943
var apiParameters = new Dictionary<string, object?>()
938944
{
939945
{ "required", required },
940-
{ "default", xdefault }
946+
{ "default", xdefault },
947+
{ "newKey", newKey }
941948
};
942949

943950
var apiHeaders = new Dictionary<string, string>()
@@ -1049,7 +1056,7 @@ static Models.AttributeString Convert(Dictionary<string, object> it) =>
10491056
///
10501057
/// </para>
10511058
/// </summary>
1052-
public Task<Models.AttributeString> UpdateStringAttribute(string databaseId, string collectionId, string key, bool required, string xdefault)
1059+
public Task<Models.AttributeString> UpdateStringAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, long? size = null, string? newKey = null)
10531060
{
10541061
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}"
10551062
.Replace("{databaseId}", databaseId)
@@ -1059,7 +1066,9 @@ static Models.AttributeString Convert(Dictionary<string, object> it) =>
10591066
var apiParameters = new Dictionary<string, object?>()
10601067
{
10611068
{ "required", required },
1062-
{ "default", xdefault }
1069+
{ "default", xdefault },
1070+
{ "size", size },
1071+
{ "newKey", newKey }
10631072
};
10641073

10651074
var apiHeaders = new Dictionary<string, string>()
@@ -1127,7 +1136,7 @@ static Models.AttributeUrl Convert(Dictionary<string, object> it) =>
11271136
///
11281137
/// </para>
11291138
/// </summary>
1130-
public Task<Models.AttributeUrl> UpdateUrlAttribute(string databaseId, string collectionId, string key, bool required, string xdefault)
1139+
public Task<Models.AttributeUrl> UpdateUrlAttribute(string databaseId, string collectionId, string key, bool required, string xdefault, string? newKey = null)
11311140
{
11321141
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}"
11331142
.Replace("{databaseId}", databaseId)
@@ -1137,7 +1146,8 @@ static Models.AttributeUrl Convert(Dictionary<string, object> it) =>
11371146
var apiParameters = new Dictionary<string, object?>()
11381147
{
11391148
{ "required", required },
1140-
{ "default", xdefault }
1149+
{ "default", xdefault },
1150+
{ "newKey", newKey }
11411151
};
11421152

11431153
var apiHeaders = new Dictionary<string, string>()
@@ -1230,7 +1240,7 @@ public Task<object> DeleteAttribute(string databaseId, string collectionId, stri
12301240
///
12311241
/// </para>
12321242
/// </summary>
1233-
public Task<Models.AttributeRelationship> UpdateRelationshipAttribute(string databaseId, string collectionId, string key, Appwrite.Enums.RelationMutate? onDelete = null)
1243+
public Task<Models.AttributeRelationship> UpdateRelationshipAttribute(string databaseId, string collectionId, string key, Appwrite.Enums.RelationMutate? onDelete = null, string? newKey = null)
12341244
{
12351245
var apiPath = "/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship"
12361246
.Replace("{databaseId}", databaseId)
@@ -1239,7 +1249,8 @@ public Task<object> DeleteAttribute(string databaseId, string collectionId, stri
12391249

12401250
var apiParameters = new Dictionary<string, object?>()
12411251
{
1242-
{ "onDelete", onDelete }
1252+
{ "onDelete", onDelete },
1253+
{ "newKey", newKey }
12431254
};
12441255

12451256
var apiHeaders = new Dictionary<string, string>()

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ Appwrite is an open-source backend as a service server that abstract and simplif
1717
Add this reference to your project's `.csproj` file:
1818

1919
```xml
20-
<PackageReference Include="Appwrite" Version="0.9.0" />
20+
<PackageReference Include="Appwrite" Version="0.10.0" />
2121
```
2222

2323
You can install packages from the command line:
2424

2525
```powershell
2626
# Package Manager
27-
Install-Package Appwrite -Version 0.9.0
27+
Install-Package Appwrite -Version 0.10.0
2828
2929
# or .NET CLI
30-
dotnet add package Appwrite --version 0.9.0
30+
dotnet add package Appwrite --version 0.10.0
3131
```
3232

3333

docs/examples/databases/update-boolean-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ AttributeBoolean result = await databases.UpdateBooleanAttribute(
1414
collectionId: "<COLLECTION_ID>",
1515
key: "",
1616
required: false,
17-
default: false
17+
default: false,
18+
newKey: "" // optional
1819
);

docs/examples/databases/update-datetime-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ AttributeDatetime result = await databases.UpdateDatetimeAttribute(
1414
collectionId: "<COLLECTION_ID>",
1515
key: "",
1616
required: false,
17-
default: ""
17+
default: "",
18+
newKey: "" // optional
1819
);

docs/examples/databases/update-email-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ AttributeEmail result = await databases.UpdateEmailAttribute(
1414
collectionId: "<COLLECTION_ID>",
1515
key: "",
1616
required: false,
17-
default: "[email protected]"
17+
default: "[email protected]",
18+
newKey: "" // optional
1819
);

docs/examples/databases/update-enum-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ AttributeEnum result = await databases.UpdateEnumAttribute(
1515
key: "",
1616
elements: new List<string>(),
1717
required: false,
18-
default: "<DEFAULT>"
18+
default: "<DEFAULT>",
19+
newKey: "" // optional
1920
);

docs/examples/databases/update-float-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ AttributeFloat result = await databases.UpdateFloatAttribute(
1616
required: false,
1717
min: 0,
1818
max: 0,
19-
default: 0
19+
default: 0,
20+
newKey: "" // optional
2021
);

docs/examples/databases/update-integer-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ AttributeInteger result = await databases.UpdateIntegerAttribute(
1616
required: false,
1717
min: 0,
1818
max: 0,
19-
default: 0
19+
default: 0,
20+
newKey: "" // optional
2021
);

docs/examples/databases/update-ip-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ AttributeIp result = await databases.UpdateIpAttribute(
1414
collectionId: "<COLLECTION_ID>",
1515
key: "",
1616
required: false,
17-
default: ""
17+
default: "",
18+
newKey: "" // optional
1819
);

docs/examples/databases/update-relationship-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ AttributeRelationship result = await databases.UpdateRelationshipAttribute(
1414
databaseId: "<DATABASE_ID>",
1515
collectionId: "<COLLECTION_ID>",
1616
key: "",
17-
onDelete: RelationMutate.Cascade // optional
17+
onDelete: RelationMutate.Cascade, // optional
18+
newKey: "" // optional
1819
);

docs/examples/databases/update-string-attribute.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ AttributeString result = await databases.UpdateStringAttribute(
1414
collectionId: "<COLLECTION_ID>",
1515
key: "",
1616
required: false,
17-
default: "<DEFAULT>"
17+
default: "<DEFAULT>",
18+
size: 0, // optional
19+
newKey: "" // optional
1820
);

docs/examples/databases/update-url-attribute.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ AttributeUrl result = await databases.UpdateUrlAttribute(
1414
collectionId: "<COLLECTION_ID>",
1515
key: "",
1616
required: false,
17-
default: "https://example.com"
17+
default: "https://example.com",
18+
newKey: "" // optional
1819
);

0 commit comments

Comments
 (0)