Skip to content

Commit 59bcf85

Browse files
authored
Merge pull request #78 from appwrite/dev
feat: .NET SDK update for version 0.21.2
2 parents a72f69a + b8a1874 commit 59bcf85

File tree

127 files changed

+229
-90
lines changed

Some content is hidden

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

127 files changed

+229
-90
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;net462</TargetFrameworks>
44
<PackageId>Appwrite</PackageId>
5-
<Version>0.21.1</Version>
5+
<Version>0.21.2</Version>
66
<Authors>Appwrite Team</Authors>
77
<Company>Appwrite Team</Company>
88
<Description>

Appwrite/Client.cs

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

Appwrite/Extensions/Extensions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections;
33
using System.Collections.Generic;
4+
using System.Linq;
45
using System.Text.Json;
56

67
namespace Appwrite.Extensions
@@ -12,6 +13,18 @@ public static string ToJson(this Dictionary<string, object?> dict)
1213
return JsonSerializer.Serialize(dict, Client.SerializerOptions);
1314
}
1415

16+
public static List<T> ConvertToList<T>(this object value)
17+
{
18+
return value switch
19+
{
20+
JsonElement jsonElement => jsonElement.Deserialize<List<T>>() ?? throw new InvalidCastException($"Cannot deserialize {jsonElement} to List<{typeof(T)}>."),
21+
object[] objArray => objArray.Cast<T>().ToList(),
22+
List<T> list => list,
23+
IEnumerable<T> enumerable => enumerable.ToList(),
24+
_ => throw new InvalidCastException($"Cannot convert {value.GetType()} to List<{typeof(T)}>")
25+
};
26+
}
27+
1528
public static string ToQueryString(this Dictionary<string, object?> parameters)
1629
{
1730
var query = new List<string>();

Appwrite/Models/AlgoArgon2.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

Appwrite/Models/AlgoBcrypt.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

Appwrite/Models/AlgoMd5.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

Appwrite/Models/AlgoPhpass.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

Appwrite/Models/AlgoScrypt.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

Appwrite/Models/AlgoScryptModified.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

Appwrite/Models/AlgoSha.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.Json;
66
using System.Text.Json.Serialization;
77
using Appwrite.Enums;
8+
using Appwrite.Extensions;
89

910
namespace Appwrite.Models
1011
{

0 commit comments

Comments
 (0)