Skip to content

Commit

Permalink
Merge pull request #593 from PinguApps/clients-rename
Browse files Browse the repository at this point in the history
Renamed all usable objects from each lib
  • Loading branch information
pingu2k4 authored Dec 28, 2024
2 parents be8a952 + a7e05a0 commit 434429e
Show file tree
Hide file tree
Showing 36 changed files with 138 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
namespace PinguApps.Appwrite.Client;

/// <inheritdoc/>
public class AccountClient : SessionAwareClientBase, IAccountClient
public class ClientAccountClient : SessionAwareClientBase, IClientAccountClient
{
private readonly IAccountApi _accountApi;
private readonly Config _config;

internal AccountClient(IAccountApi accountApi, [FromKeyedServices("Client")] Config config)
internal ClientAccountClient(IAccountApi accountApi, [FromKeyedServices("Client")] Config config)
{
_accountApi = accountApi;
_config = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
namespace PinguApps.Appwrite.Client;

/// <inheritdoc/>
public class AppwriteClient : IAppwriteClient, ISessionAware
public class ClientAppwriteClient : IClientAppwriteClient, ISessionAware
{
/// <inheritdoc/>
public IAccountClient Account { get; }
public IClientAccountClient Account { get; }

/// <inheritdoc/>
public ITeamsClient Teams { get; }
public IClientTeamsClient Teams { get; }

/// <inheritdoc/>
public IDatabasesClient Databases { get; }
public IClientDatabasesClient Databases { get; }

public AppwriteClient(IAccountClient accountClient, ITeamsClient teams, IDatabasesClient databasesClient)
public ClientAppwriteClient(IClientAccountClient accountClient, IClientTeamsClient teams, IClientDatabasesClient databasesClient)
{
Account = accountClient;
Teams = teams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
namespace PinguApps.Appwrite.Client.Clients;

/// <inheritdoc/>
public class DatabasesClient : SessionAwareClientBase, IDatabasesClient
public class ClientDatabasesClient : SessionAwareClientBase, IClientDatabasesClient
{
private readonly IDatabasesApi _databasesApi;

internal DatabasesClient(IDatabasesApi databasesApi)
internal ClientDatabasesClient(IDatabasesApi databasesApi)
{
_databasesApi = databasesApi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
namespace PinguApps.Appwrite.Client.Clients;

/// <inheritdoc/>
public class TeamsClient : SessionAwareClientBase, ITeamsClient
public class ClientTeamsClient : SessionAwareClientBase, IClientTeamsClient
{
private readonly ITeamsApi _teamsApi;
private readonly Config _config;

internal TeamsClient(ITeamsApi teamsApi, [FromKeyedServices("Client")] Config config)
internal ClientTeamsClient(ITeamsApi teamsApi, [FromKeyedServices("Client")] Config config)
{
_teamsApi = teamsApi;
_config = config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace PinguApps.Appwrite.Client;
/// <para>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.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/client-rest/account">Appwrite Docs</see></para>
/// </summary>
public interface IAccountClient
public interface IClientAccountClient
{
/// <summary>
/// Get the currently logged in user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ namespace PinguApps.Appwrite.Client;
/// <summary>
/// The root of the Client SDK. Access all API sections from here
/// </summary>
public interface IAppwriteClient
public interface IClientAppwriteClient
{
/// <summary>
/// <para>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.</para>
/// <para>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.</para>
/// <para>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.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/client-rest/account">Appwrite Docs</see></para>
/// </summary>
IAccountClient Account { get; }
IClientAccountClient Account { get; }

/// <summary>
/// Set the session of the logged in user
Expand All @@ -31,7 +31,7 @@ public interface IAppwriteClient
/// <para>Each user who creates a team becomes the team owner and can delegate the ownership role by inviting a new team member. Only team owners can invite new users to their team.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/client-rest/teams">Appwrite Docs</see></para>
/// </summary>
ITeamsClient Teams { get; }
IClientTeamsClient Teams { get; }

/// <summary>
/// <para>The Databases service allows you to create structured collections of documents, query and filter lists of documents, and manage an advanced set of read and write access permissions.</para>
Expand All @@ -40,5 +40,5 @@ public interface IAppwriteClient
/// <para>Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (any). You can learn more about <see href="https://appwrite.io/docs/products/databases/permissions">how Appwrite handles permissions and access control</see>.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/client-rest/databases">Appwrite Docs</see></para>
/// </summary>
IDatabasesClient Databases { get; }
IClientDatabasesClient Databases { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace PinguApps.Appwrite.Client.Clients;
/// <para>Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (any). You can learn more about <see href="https://appwrite.io/docs/products/databases/permissions">how Appwrite handles permissions and access control</see>.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/client-rest/databases">Appwrite Docs</see></para>
/// </summary>
public interface IDatabasesClient
public interface IClientDatabasesClient
{
/// <summary>
/// Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PinguApps.Appwrite.Client.Clients;
/// <para>Each user who creates a team becomes the team owner and can delegate the ownership role by inviting a new team member. Only team owners can invite new users to their team.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/client-rest/teams">Appwrite Docs</see></para>
/// </summary>
public interface ITeamsClient
public interface IClientTeamsClient
{
/// <summary>
/// Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
namespace PinguApps.Appwrite.Client.Handlers;
internal class ClientCookieSessionHandler : DelegatingHandler
{
private readonly Lazy<IAppwriteClient> _appwriteClient;
private readonly Lazy<IClientAppwriteClient> _appwriteClient;

public ClientCookieSessionHandler(Lazy<IAppwriteClient> appwriteClient)
public ClientCookieSessionHandler(Lazy<IClientAppwriteClient> appwriteClient)
{
_appwriteClient = appwriteClient;
}

private IAppwriteClient AppwriteClient => _appwriteClient.Value;
private IClientAppwriteClient AppwriteClient => _appwriteClient.Value;

protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
Expand Down
30 changes: 15 additions & 15 deletions src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ public static IServiceCollection AddAppwriteClient(this IServiceCollection servi
.AddHttpMessageHandler<HeaderHandler>()
.AddHttpMessageHandler<ClientCookieSessionHandler>();

services.AddSingleton<IAccountClient>(sp =>
services.AddSingleton<IClientAccountClient>(sp =>
{
var api = sp.GetRequiredService<IAccountApi>();
var config = sp.GetRequiredKeyedService<Config>("Client");
return new AccountClient(api, config);
return new ClientAccountClient(api, config);
});
services.AddSingleton<ITeamsClient>(sp =>
services.AddSingleton<IClientTeamsClient>(sp =>
{
var api = sp.GetRequiredService<ITeamsApi>();
var config = sp.GetRequiredKeyedService<Config>("Client");
return new TeamsClient(api, config);
return new ClientTeamsClient(api, config);
});
services.AddSingleton<IDatabasesClient>(sp =>
services.AddSingleton<IClientDatabasesClient>(sp =>
{
var api = sp.GetRequiredService<IDatabasesApi>();
return new DatabasesClient(api);
return new ClientDatabasesClient(api);
});
services.AddSingleton<IAppwriteClient, AppwriteClient>();
services.AddSingleton(x => new Lazy<IAppwriteClient>(() => x.GetRequiredService<IAppwriteClient>()));
services.AddSingleton<IClientAppwriteClient, ClientAppwriteClient>();
services.AddSingleton(x => new Lazy<IClientAppwriteClient>(() => x.GetRequiredService<IClientAppwriteClient>()));

return services;
}
Expand Down Expand Up @@ -102,24 +102,24 @@ public static IServiceCollection AddAppwriteClientForServer(this IServiceCollect
.AddHttpMessageHandler<HeaderHandler>()
.ConfigurePrimaryHttpMessageHandler(ConfigurePrimaryHttpMessageHandler);

services.AddSingleton<IAccountClient>(sp =>
services.AddSingleton<IClientAccountClient>(sp =>
{
var api = sp.GetRequiredService<IAccountApi>();
var config = sp.GetRequiredKeyedService<Config>("Client");
return new AccountClient(api, config);
return new ClientAccountClient(api, config);
});
services.AddSingleton<ITeamsClient>(sp =>
services.AddSingleton<IClientTeamsClient>(sp =>
{
var api = sp.GetRequiredService<ITeamsApi>();
var config = sp.GetRequiredKeyedService<Config>("Client");
return new TeamsClient(api, config);
return new ClientTeamsClient(api, config);
});
services.AddSingleton<IDatabasesClient>(sp =>
services.AddSingleton<IClientDatabasesClient>(sp =>
{
var api = sp.GetRequiredService<IDatabasesApi>();
return new DatabasesClient(api);
return new ClientDatabasesClient(api);
});
services.AddSingleton<IAppwriteClient, AppwriteClient>();
services.AddSingleton<IClientAppwriteClient, ClientAppwriteClient>();

return services;
}
Expand Down
6 changes: 3 additions & 3 deletions src/PinguApps.Appwrite.Playground/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace PinguApps.Appwrite.Playground;
internal class App
{
private readonly Client.IAppwriteClient _client;
private readonly Server.Clients.IAppwriteClient _server;
private readonly Client.IClientAppwriteClient _client;
private readonly Server.Clients.IServerAppwriteClient _server;
private readonly string? _session;

public App(Client.IAppwriteClient client, Server.Clients.IAppwriteClient server, IConfiguration config)
public App(Client.IClientAppwriteClient client, Server.Clients.IServerAppwriteClient server, IConfiguration config)
{
_client = client;
_server = server;
Expand Down
25 changes: 0 additions & 25 deletions src/PinguApps.Appwrite.Server/Clients/AppwriteClient.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PinguApps.Appwrite.Server.Clients;
/// <para>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.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/account">Appwrite Docs</see></para>
/// </summary>
public interface IAccountClient
public interface IServerAccountClient
{
/// <summary>
/// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
/// <summary>
/// The root of the Client SDK. Access all API sections from here
/// </summary>
public interface IAppwriteClient
public interface IServerAppwriteClient
{
/// <summary>
/// <para>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.</para>
/// <para>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.</para>
/// <para>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.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/account">Appwrite Docs</see></para>
/// </summary>
IAccountClient Account { get; }
IServerAccountClient Account { get; }

/// <summary>
/// The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info.
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/users">Appwrite Docs</see></para>
/// </summary>
IUsersClient Users { get; }
IServerUsersClient Users { get; }

/// <summary>
/// <para>The Teams service allows you to group users of your project and to enable them to share <see href="https://appwrite.io/docs/advanced/platform/permissions">read and write</see> access to your project resources, such as database documents or storage files.</para>
/// <para>Each user who creates a team becomes the team owner and can delegate the ownership role by inviting a new team member. Only team owners can invite new users to their team.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/teams">Appwrite Docs</see></para>
/// </summary>
ITeamsClient Teams { get; }
IServerTeamsClient Teams { get; }

/// <summary>
/// <para>The Databases service allows you to create structured collections of documents, query and filter lists of documents, and manage an advanced set of read and write access permissions.</para>
Expand All @@ -33,5 +33,5 @@ public interface IAppwriteClient
/// <para>Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (any). You can learn more about <see href="https://appwrite.io/docs/products/databases/permissions">how Appwrite handles permissions and access control</see>.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/databases">Appwrite Docs</see></para>
/// </summary>
IDatabasesClient Databases { get; }
IServerDatabasesClient Databases { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace PinguApps.Appwrite.Server.Clients;
/// <para>Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (any). You can learn more about <see href="https://appwrite.io/docs/products/databases/permissions">how Appwrite handles permissions and access control</see>.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/databases">Appwrite Docs</see></para>
/// </summary>
public interface IDatabasesClient
public interface IServerDatabasesClient
{
/// <summary>
/// Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PinguApps.Appwrite.Server.Clients;
/// <para>Each user who creates a team becomes the team owner and can delegate the ownership role by inviting a new team member. Only team owners can invite new users to their team.</para>
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/teams">Appwrite Docs</see></para>
/// </summary>
public interface ITeamsClient
public interface IServerTeamsClient
{
/// <summary>
/// Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace PinguApps.Appwrite.Server.Clients;
/// The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info.
/// <para><see href="https://appwrite.io/docs/references/1.6.x/server-rest/users">Appwrite Docs</see></para>
/// </summary>
public interface IUsersClient
public interface IServerUsersClient
{
/// <summary>
/// Get a list of all the project's users. You can use the query params to filter your results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
namespace PinguApps.Appwrite.Server.Clients;

/// <inheritdoc/>
public class AccountClient : IAccountClient
public class ServerAccountClient : IServerAccountClient
{
private readonly IAccountApi _accountApi;

private readonly Config _config;

internal AccountClient(IAccountApi accountApi, [FromKeyedServices("Server")] Config config)
internal ServerAccountClient(IAccountApi accountApi, [FromKeyedServices("Server")] Config config)
{
_accountApi = accountApi;
_config = config;
Expand Down
25 changes: 25 additions & 0 deletions src/PinguApps.Appwrite.Server/Clients/ServerAppwriteClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace PinguApps.Appwrite.Server.Clients;

/// <inheritdoc/>
public class ServerAppwriteClient : IServerAppwriteClient
{
/// <inheritdoc/>
public IServerAccountClient Account { get; }

/// <inheritdoc/>
public IServerUsersClient Users { get; }

/// <inheritdoc/>
public IServerTeamsClient Teams { get; }

/// <inheritdoc/>
public IServerDatabasesClient Databases { get; }

public ServerAppwriteClient(IServerAccountClient accountClient, IServerUsersClient usersClient, IServerTeamsClient teamsClient, IServerDatabasesClient databasesClient)
{
Account = accountClient;
Users = usersClient;
Teams = teamsClient;
Databases = databasesClient;
}
}
Loading

0 comments on commit 434429e

Please sign in to comment.