From 79aee373f43ba3523c61458fbcb6e7849ca5c63f Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 03:49:27 +0100 Subject: [PATCH 01/20] Added intellisense to service collection extensions in client --- .../ServiceCollectionExtensions.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs index 2f1a8a25..a94ba92f 100644 --- a/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs +++ b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs @@ -7,6 +7,14 @@ namespace PinguApps.Appwrite.Client; public static class ServiceCollectionExtensions { + /// + /// Adds all necessary components for the Client SDK to work as a singleton. Best used on client-side + /// + /// The service collection to add to + /// Your Appwrite Project ID + /// Your Appwrite Endpoint. Defaults to the cloud endpoint. + /// Custom refit settings to customise the SDK. + /// The service collection, enabling chaining public static IServiceCollection AddAppwriteClient(this IServiceCollection services, string projectId, string endpoint = "https://cloud.appwrite.io/v1", RefitSettings? refitSettings = null) { services.AddSingleton(sp => new HeaderHandler(projectId)); @@ -21,6 +29,14 @@ public static IServiceCollection AddAppwriteClient(this IServiceCollection servi return services; } + /// + /// Adds all necessary components for the Client SDK in a transient state. Best used on server-side to perform client SDK abilities on behalf of users + /// + /// The service collection to add to + /// Your Appwrite Project ID + /// Your Appwrite Endpoint. Defaults to the could endpoint. + /// Custom refit settings to customise the SDK. + /// The service collection, enabling chaining public static IServiceCollection AddAppwriteClientForServer(this IServiceCollection services, string projectId, string endpoint = "https://cloud.appwrite.io/v1", RefitSettings? refitSettings = null) { services.AddSingleton(sp => new HeaderHandler(projectId)); From d9be892cd94f1f23d199dac983afa28f90a48dd5 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 03:50:30 +0100 Subject: [PATCH 02/20] added intellisense to class --- src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs index a94ba92f..339b00bd 100644 --- a/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs +++ b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs @@ -5,6 +5,10 @@ using Refit; namespace PinguApps.Appwrite.Client; + +/// +/// Provides extenions to IServiceCollection, to enable adding the SDK to your DI container +/// public static class ServiceCollectionExtensions { /// From 4402d9799324919f3f2af13c55de380d077183ef Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:15:43 +0100 Subject: [PATCH 03/20] Ensured that ISessionAware is intenrnal --- src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs | 2 +- src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs | 6 ++---- src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs | 4 +++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs index 2d1bb3c4..38b56580 100644 --- a/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs @@ -1,7 +1,7 @@ using PinguApps.Appwrite.Client.Clients; namespace PinguApps.Appwrite.Client; -public class AppwriteClient : IAppwriteClient +public class AppwriteClient : IAppwriteClient, ISessionAware { public IAccountClient Account { get; } diff --git a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs index ccea18ce..f2128f50 100644 --- a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs @@ -1,8 +1,6 @@ -using PinguApps.Appwrite.Client.Clients; +namespace PinguApps.Appwrite.Client; -namespace PinguApps.Appwrite.Client; - -public interface IAppwriteClient : ISessionAware +public interface IAppwriteClient { IAccountClient Account { get; } diff --git a/src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs b/src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs index bed10cf6..60672b1d 100644 --- a/src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs +++ b/src/PinguApps.Appwrite.Client/Clients/ISessionAware.cs @@ -1,6 +1,8 @@ namespace PinguApps.Appwrite.Client.Clients; -public interface ISessionAware + +internal interface ISessionAware { public string? Session { get; protected set; } + public void UpdateSession(string? session) => Session = session; } From 80b8159ab18cd2608d0bc1b14b07bee037f4526c Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:18:46 +0100 Subject: [PATCH 04/20] added intellisense to IAppwriteClient --- .../Clients/IAppwriteClient.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs index f2128f50..7f7552b7 100644 --- a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs @@ -1,8 +1,19 @@ namespace PinguApps.Appwrite.Client; +/// +/// The root of the Client SDK. Access all API sections from here +/// public interface IAppwriteClient { + /// + /// The Account API. + /// Appwrite Docs + /// IAccountClient Account { get; } + /// + /// Set the session of your logged in user + /// + /// The session token void SetSession(string? session); } From f14ad26f552a9ca6b902e1bb54399fc2c8941b6d Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:26:06 +0100 Subject: [PATCH 05/20] Changed summary of Account --- src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs index 7f7552b7..9e006a27 100644 --- a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs @@ -6,7 +6,9 @@ public interface IAppwriteClient { /// - /// The Account API. + /// The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity. + /// Register new user accounts with the Create Account, Create Magic URL session, or Create Phone session endpoint.You can authenticate the user account by using multiple sign-in methods available.Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings. + /// This service also exposes an endpoint to save and read the user preferences as a key-value object. This feature is handy if you want to allow extra customization in your app.Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme. /// Appwrite Docs /// IAccountClient Account { get; } From 1f65256f2a8e87f7e8df9b4dc2020f361cd5906f Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:26:21 +0100 Subject: [PATCH 06/20] added intellisense to accountClient --- .../Clients/IAccountClient.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/PinguApps.Appwrite.Client/Clients/IAccountClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAccountClient.cs index 7b1b32a1..0f9624cf 100644 --- a/src/PinguApps.Appwrite.Client/Clients/IAccountClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/IAccountClient.cs @@ -4,8 +4,27 @@ using PinguApps.Appwrite.Shared.Responses; namespace PinguApps.Appwrite.Client; + +/// +/// The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity. +/// Register new user accounts with the Create Account, Create Magic URL session, or Create Phone session endpoint.You can authenticate the user account by using multiple sign-in methods available.Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings. +/// This service also exposes an endpoint to save and read the user preferences as a key-value object. This feature is handy if you want to allow extra customization in your app.Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme. +/// Appwrite Docs +/// public interface IAccountClient { + /// + /// Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the /account/verfication route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new account session. + /// Appwrite Docs + /// + /// The request content + /// The created user Task> Create(CreateAccountRequest request); + + /// + /// Get the currently logged in user. + /// Appwrite Docs + /// + /// The user Task> Get(); } From 4287dd68512514248f4913bfe5345a4be136f2c7 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:28:33 +0100 Subject: [PATCH 07/20] added server service intellisense --- .../ServiceCollectionExtensions.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs b/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs index 92e17d7c..a5bad40c 100644 --- a/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs +++ b/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs @@ -6,8 +6,21 @@ using Refit; namespace PinguApps.Appwrite.Server; + +/// +/// Provides extenions to IServiceCollection, to enable adding the SDK to your DI container +/// public static class ServiceCollectionExtensions { + /// + /// Adds all necessary components for the Server SDK + /// + /// The service collection to add to + /// Your Appwrite Project ID + /// Your Appwrite Api Key + /// Your Appwrite Endpoint. Defaults to the cloud endpoint. + /// Custom refit settings to customise the SDK. + /// The service collection, enabling chaining public static IServiceCollection AddAppwriteServer(this IServiceCollection services, string projectId, string apiKey, string endpoint = "https://cloud.appwrite.io/v1", RefitSettings? refitSettings = null) { services.AddSingleton(sp => new HeaderHandler(projectId, apiKey)); From 2207bced6782f7419f2e94988f409f10e1c3dd94 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:30:08 +0100 Subject: [PATCH 08/20] added intellisense to server sqk root --- .../Servers/IAppwriteServer.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/PinguApps.Appwrite.Server/Servers/IAppwriteServer.cs b/src/PinguApps.Appwrite.Server/Servers/IAppwriteServer.cs index 3fdd19e6..db525f1c 100644 --- a/src/PinguApps.Appwrite.Server/Servers/IAppwriteServer.cs +++ b/src/PinguApps.Appwrite.Server/Servers/IAppwriteServer.cs @@ -1,6 +1,15 @@ namespace PinguApps.Appwrite.Server.Servers; +/// +/// The root of the Client SDK. Access all API sections from here +/// public interface IAppwriteServer { + /// + /// The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity. + /// Register new user accounts with the Create Account, Create Magic URL session, or Create Phone session endpoint.You can authenticate the user account by using multiple sign-in methods available.Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings. + /// This service also exposes an endpoint to save and read the user preferences as a key-value object. This feature is handy if you want to allow extra customization in your app.Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme. + /// Appwrite Docs + /// IAccountServer Account { get; } -} \ No newline at end of file +} From 82ba8619327fc499a25f6c67ea4250724614861d Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:31:20 +0100 Subject: [PATCH 09/20] added intellisense to account server --- .../Servers/IAccountServer.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PinguApps.Appwrite.Server/Servers/IAccountServer.cs b/src/PinguApps.Appwrite.Server/Servers/IAccountServer.cs index 1e2b6607..a9b63d56 100644 --- a/src/PinguApps.Appwrite.Server/Servers/IAccountServer.cs +++ b/src/PinguApps.Appwrite.Server/Servers/IAccountServer.cs @@ -4,7 +4,20 @@ using PinguApps.Appwrite.Shared.Responses; namespace PinguApps.Appwrite.Server.Servers; + +/// +/// The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity. +/// Register new user accounts with the Create Account, Create Magic URL session, or Create Phone session endpoint.You can authenticate the user account by using multiple sign-in methods available.Once the user is authenticated, a new session object will be created to allow the user to access his or her private data and settings. +/// This service also exposes an endpoint to save and read the user preferences as a key-value object. This feature is handy if you want to allow extra customization in your app.Common usage for this feature may include saving the user's preferred locale, timezone, or custom app theme. +/// Appwrite Docs +/// public interface IAccountServer { + /// + /// Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the /account/verfication route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new account session. + /// Appwrite Docs + /// + /// The request content + /// The created user Task> Create(CreateAccountRequest request); } From 8124083543c91918e9095a09296fa2a42d2902b6 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:37:35 +0100 Subject: [PATCH 10/20] Added inheridocs --- src/PinguApps.Appwrite.Client/Clients/AccountClient.cs | 3 +++ src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs | 3 +++ src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs | 7 ++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/PinguApps.Appwrite.Client/Clients/AccountClient.cs b/src/PinguApps.Appwrite.Client/Clients/AccountClient.cs index 732400a5..3e72d624 100644 --- a/src/PinguApps.Appwrite.Client/Clients/AccountClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/AccountClient.cs @@ -8,6 +8,7 @@ using PinguApps.Appwrite.Shared.Responses; namespace PinguApps.Appwrite.Client; + public class AccountClient : IAccountClient, ISessionAware { private readonly IAccountApi _accountApi; @@ -31,6 +32,7 @@ public AccountClient(IAccountApi accountApi) return _sessionAware.Session; } + /// public async Task> Get() { try @@ -46,6 +48,7 @@ public async Task> Get() } } + /// public async Task> Create(CreateAccountRequest request) { try diff --git a/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs index 38b56580..53f727c3 100644 --- a/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs @@ -3,6 +3,7 @@ namespace PinguApps.Appwrite.Client; public class AppwriteClient : IAppwriteClient, ISessionAware { + /// public IAccountClient Account { get; } public AppwriteClient(IAccountClient accountClient) @@ -13,6 +14,7 @@ public AppwriteClient(IAccountClient accountClient) string? ISessionAware.Session { get; set; } ISessionAware? _sessionAware; + /// public string? Session => GetSession(); private string? GetSession() { @@ -24,6 +26,7 @@ public AppwriteClient(IAccountClient accountClient) return _sessionAware.Session; } + /// public void SetSession(string? session) { (this as ISessionAware).UpdateSession(session); diff --git a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs index 9e006a27..139d953b 100644 --- a/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs +++ b/src/PinguApps.Appwrite.Client/Clients/IAppwriteClient.cs @@ -14,8 +14,13 @@ public interface IAppwriteClient IAccountClient Account { get; } /// - /// Set the session of your logged in user + /// Set the session of the logged in user /// /// The session token void SetSession(string? session); + + /// + /// The sessio of the currently logged in user + /// + string? Session { get; } } From 7f8a6b968a9928a255357e386435fe5367a3b883 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:39:50 +0100 Subject: [PATCH 11/20] added intellisense to internalerror --- src/PinguApps.Appwrite.Common/InternalError.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/InternalError.cs b/src/PinguApps.Appwrite.Common/InternalError.cs index 89023dc8..14517c4d 100644 --- a/src/PinguApps.Appwrite.Common/InternalError.cs +++ b/src/PinguApps.Appwrite.Common/InternalError.cs @@ -1,4 +1,9 @@ namespace PinguApps.Appwrite.Shared; + +/// +/// An internal error, indicating a fault within the SDK rather than Appwrite +/// +/// The message of any thrown exception public record InternalError( string Message ); From 7d087a03515b9842474cf850b24408304210897f Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:43:56 +0100 Subject: [PATCH 12/20] added intellisense to appwrite reuslt --- .../AppwriteResult.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/AppwriteResult.cs b/src/PinguApps.Appwrite.Common/AppwriteResult.cs index 76502edc..d0a04fc5 100644 --- a/src/PinguApps.Appwrite.Common/AppwriteResult.cs +++ b/src/PinguApps.Appwrite.Common/AppwriteResult.cs @@ -1,6 +1,11 @@ using OneOf; namespace PinguApps.Appwrite.Shared; + +/// +/// The result of all API calls +/// +/// the type of response expected on success public class AppwriteResult { public AppwriteResult(OneOf result) @@ -8,9 +13,28 @@ public AppwriteResult(OneOf result) Result = result; } + /// + /// The result of making the API call. Can be , or depending on what happened + /// public OneOf Result { get; } + + /// + /// Indicates the API call was successful + /// public bool Success => Result.IsT0; + + /// + /// Indicates there is an error + /// public bool IsError => Result.IsT1 || Result.IsT2; + + /// + /// Indicates that there was an error thrown within Appwrite + /// public bool IsAppwriteError => Result.IsT1; + + /// + /// Indicates that there was an error thrown within the SDK + /// public bool IsInternalError => Result.IsT2; } From ec3bc1f06d89a56e9f9333dd7708aac14dde3a7d Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:45:08 +0100 Subject: [PATCH 13/20] added intellisense to appwrite error --- src/PinguApps.Appwrite.Common/AppwriteError.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/AppwriteError.cs b/src/PinguApps.Appwrite.Common/AppwriteError.cs index 7fba2bff..8c57337f 100644 --- a/src/PinguApps.Appwrite.Common/AppwriteError.cs +++ b/src/PinguApps.Appwrite.Common/AppwriteError.cs @@ -1,6 +1,14 @@ using System.Text.Json.Serialization; namespace PinguApps.Appwrite.Shared; + +/// +/// An error thrown from Appwrite +/// +/// The message returned from Appwrite +/// Http Status Code of the response +/// The type of error thrown +/// The version of Appwrite throwing the error public record AppwriteError( [property: JsonPropertyName("message")] string Message, [property: JsonPropertyName("code")] int Code, From 274114e83a5f2e73d5f080a3634518dc92704c02 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:47:40 +0100 Subject: [PATCH 14/20] added intellisense to IdUtils --- src/PinguApps.Appwrite.Common/Utils/IdUtils.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/PinguApps.Appwrite.Common/Utils/IdUtils.cs b/src/PinguApps.Appwrite.Common/Utils/IdUtils.cs index b698e1c8..25c9fe6f 100644 --- a/src/PinguApps.Appwrite.Common/Utils/IdUtils.cs +++ b/src/PinguApps.Appwrite.Common/Utils/IdUtils.cs @@ -2,10 +2,18 @@ using System.Linq; namespace PinguApps.Appwrite.Shared.Utils; + +/// +/// Utilities for Appwrite Id properties +/// public static class IdUtils { - private static readonly Random _random = new Random(); + private static readonly Random _random = new(); + /// + /// Generates a Hex Timestamp, used in Id's + /// + /// a string of the hex timestamp for UTC now public static string GetHexTimestamp() { var dt = DateTimeOffset.UtcNow; @@ -15,6 +23,11 @@ public static string GetHexTimestamp() return sec.ToString("x") + msec.ToString("x").PadLeft(5, '0'); } + /// + /// Generates a unique Id under the same rules that Appwrite uses to generate unique Ids + /// + /// The padding to use - defaults to 7 + /// A unique Id, in line with Appwrite Id generation rules public static string GenerateUniqueId(int padding = 7) { var baseId = GetHexTimestamp(); From 5799dd57fadaffb1eb74a468638fdb0a6a706def Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:54:04 +0100 Subject: [PATCH 15/20] Added intellisense to user obj --- .../Responses/User.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/Responses/User.cs b/src/PinguApps.Appwrite.Common/Responses/User.cs index 1d1affee..34a3d019 100644 --- a/src/PinguApps.Appwrite.Common/Responses/User.cs +++ b/src/PinguApps.Appwrite.Common/Responses/User.cs @@ -3,6 +3,30 @@ using System.Text.Json.Serialization; namespace PinguApps.Appwrite.Shared.Responses; + +/// +/// An Appwrite User object +/// +/// User ID +/// User creation date in ISO 8601 format +/// User update date in ISO 8601 format +/// User name +/// Hashed user password +/// Password hashing algorithm +/// Password hashing algorithm configuration. Can be one of: +/// AlgoArgon2 model, AlgoScrypt model, AlgoScryptModified model, AlgoBcrypt model, AlgoPHPass model, AlgoSHA model, AlgoMD5 model +/// User registration date in ISO 8601 format +/// User status. Pass `true` for enabled and `false` for disabled +/// Labels for the user +/// Password update time in ISO 8601 format +/// User email address +/// User phone number in E.164 format +/// Email verification status +/// Phone verification status +/// Multi factor authentication status +/// User preferences as a key-value object +/// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. Can be one of: +/// Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours public record User( [property: JsonPropertyName("$id")] string Id, [property: JsonPropertyName("$createdAt")] DateTime CreatedAt, From d15040030491ce35287b3421782ad7fb10e71f29 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:55:35 +0100 Subject: [PATCH 16/20] added intellisense to target --- src/PinguApps.Appwrite.Common/Responses/Target.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/Responses/Target.cs b/src/PinguApps.Appwrite.Common/Responses/Target.cs index 0e6c64cb..05200ac5 100644 --- a/src/PinguApps.Appwrite.Common/Responses/Target.cs +++ b/src/PinguApps.Appwrite.Common/Responses/Target.cs @@ -3,6 +3,17 @@ using PinguApps.Appwrite.Shared.Enums; namespace PinguApps.Appwrite.Shared.Responses; +/// +/// A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. +/// +/// Target ID +/// Target creation time in ISO 8601 format +/// Target update date in ISO 8601 format +/// Target Name +/// User ID +/// Provider ID +/// The target provider type. Can be one of the following: `email`, `sms` or `push` +/// The target identifier public record Target( [property: JsonPropertyName("$id")] string Id, [property: JsonPropertyName("$createdAt")] DateTime CreatedAt, From 9be8db8b18d0fdec6f78288d2dae826f0e7d2204 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:56:44 +0100 Subject: [PATCH 17/20] added intellisense to hashoptions --- src/PinguApps.Appwrite.Common/Responses/HashOptions.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/Responses/HashOptions.cs b/src/PinguApps.Appwrite.Common/Responses/HashOptions.cs index 9b68903f..dec12232 100644 --- a/src/PinguApps.Appwrite.Common/Responses/HashOptions.cs +++ b/src/PinguApps.Appwrite.Common/Responses/HashOptions.cs @@ -1,6 +1,14 @@ using System.Text.Json.Serialization; namespace PinguApps.Appwrite.Shared.Responses; + +/// +/// Password hashing algorithm information +/// +/// The hashing algorithm +/// The memory cost of the hash +/// The time cost of the hash +/// The threads used public record HashOptions( [property: JsonPropertyName("type")] string Type, [property: JsonPropertyName("memoryCost")] long MemoryCost, From f9a29c6304e4de97e36262ae1a8583fd20c1922a Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:58:46 +0100 Subject: [PATCH 18/20] added intellisense to create account request --- .../Requests/CreateAccountRequest.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/Requests/CreateAccountRequest.cs b/src/PinguApps.Appwrite.Common/Requests/CreateAccountRequest.cs index 79de3011..45ed939e 100644 --- a/src/PinguApps.Appwrite.Common/Requests/CreateAccountRequest.cs +++ b/src/PinguApps.Appwrite.Common/Requests/CreateAccountRequest.cs @@ -2,17 +2,33 @@ using PinguApps.Appwrite.Shared.Utils; namespace PinguApps.Appwrite.Shared.Requests; + +/// +/// The request for creating an account +/// public class CreateAccountRequest { + /// + /// User ID. Choose a custom ID or generate a random ID with . Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars + /// [JsonPropertyName("userId")] public string UserId { get; set; } = IdUtils.GenerateUniqueId(); + /// + /// User email + /// [JsonPropertyName("email")] public string Email { get; set; } = string.Empty; + /// + /// New user password. Must be between 8 and 256 chars + /// [JsonPropertyName("password")] public string Password { get; set; } = string.Empty; + /// + /// User name. Max length: 128 chars + /// [JsonPropertyName("name")] public string? Name { get; set; } } From 8640a4b75212d03d604d98604f21c74845b25658 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 04:59:22 +0100 Subject: [PATCH 19/20] added intellisense to target provider enum --- .../Enums/TargetProviderType.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PinguApps.Appwrite.Common/Enums/TargetProviderType.cs b/src/PinguApps.Appwrite.Common/Enums/TargetProviderType.cs index f39c7d25..c187dbc1 100644 --- a/src/PinguApps.Appwrite.Common/Enums/TargetProviderType.cs +++ b/src/PinguApps.Appwrite.Common/Enums/TargetProviderType.cs @@ -1,12 +1,25 @@ using System.Runtime.Serialization; namespace PinguApps.Appwrite.Shared.Enums; + +/// +/// The type of target +/// public enum TargetProviderType { + /// + /// Email + /// [EnumMember(Value = "email")] Email, + /// + /// Sms + /// [EnumMember(Value = "sms")] Sms, + /// + /// Push + /// [EnumMember(Value = "push")] Push } From 3dc57a26cdac960ecf35ec569f7d29491e3d5796 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sun, 7 Jul 2024 05:13:10 +0100 Subject: [PATCH 20/20] fixed failing tests by exposing internals to moq --- Directory.Build.targets | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Directory.Build.targets b/Directory.Build.targets index 331cc769..38d1648d 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -3,6 +3,10 @@ + + + <_Parameter1>DynamicProxyGenAssembly2 +