PinguApps.Appwrite.Server
0.3.0
See the version list below for details.
dotnet add package PinguApps.Appwrite.Server --version 0.3.0
NuGet\Install-Package PinguApps.Appwrite.Server -Version 0.3.0
<PackageReference Include="PinguApps.Appwrite.Server" Version="0.3.0" />
paket add PinguApps.Appwrite.Server --version 0.3.0
#r "nuget: PinguApps.Appwrite.Server, 0.3.0"
// Install PinguApps.Appwrite.Server as a Cake Addin #addin nuget:?package=PinguApps.Appwrite.Server&version=0.3.0 // Install PinguApps.Appwrite.Server as a Cake Tool #tool nuget:?package=PinguApps.Appwrite.Server&version=0.3.0
Appwrite SDK
This repository contains the source to both the Client and Server .net implimentation for Appwrite API. This is not a first party SDK, rather a third party SDK.
🚧 Work in Progress
This is a work in progress. There are 2 SDK's - one for client and another for server.
🔧 Installation
It is recommended to install just the client SDK into client-side projects, and both the client and server SDK into server side projects.
Client SDK
Install-Package PinguApps.Appwrite.Client
or in the Nuget package manager, search for PinguApps.Appwrite.Client
(ensure you are searching for prerelease versions)
Server SDK
Install-Package PinguApps.Appwrite.Server
or in the Nuget package manager, search for PinguApps.Appwrite.Server
🚀 Usage
Once the package(s) are installed, you will need to add everything to your DI container. Thankfully, there's an extension method making this simple.
DI Container
Client SDK
There are 2 extension methods for the client SDK. One intended for client side usage, and the other for server side usage. The only difference is the lifetimes used in the DI container.
For client side:
services.AddAppwriteClient("Project_Id");
For Server side:
services.AddAppwriteClientForServer("Project_Id");
This will assume that you are using Appwrite in the cloud. If you are not, then you can specify your endpoint as the second parameter, which is optional. Additionally, for finer control, you can specify your own
RefitSettings
as the third parameter.
Server SDK
services.AddAppwriteServer("Project_Id", "Api_Key");
This will assume that you are using Appwrite in the cloud. If you are not, then you can specify your endpoint as the second parameter, which is optional. Additionally, for finer control, you can specify your own
RefitSettings
as the third parameter.
Injecting
To inject the SDK, you will need to request either an IAppwriteClient
or IAppwriteServer
, depending on which you are working with and need.
public class App
{
private readonly IAppwriteClient _client;
private readonly IAppwriteServer _server;
public App(IAppwriteClient client, IAppwriteServer server)
{
_client = client;
_server = server;
}
}
Sessions (Client only)
The Client SDK will manage sessions for you. You can set the current session with:
_client.SetSession("SessionToken");
Making Calls
Both SDK's are split up into sections, matching the Appwrite Docs.
To make a call to get the current logged in account on the client SDK, you can do this with:
var user = await _client.Account.Get();
To create an account with the Server SDK, it might look like this:
var request = new CreateAccountRequest
{
Email = "pingu@example.com",
Password = "MySuperSecretPassword",
Name = "Pingu"
};
var user = await _server.Account.Create(request);
Handling the result
The result object is made up of a Result
property, as well as some bool
's to assist in determining the success or failure. The Result
Property will be one of 3 different types, depending on what happened.
All following examples will be based on the following preceeding them:
var userResponse = await _client.Account.Get();
We can determine if the call we made was successful or not by checking userResponse.Success
. If this is true, the Result
will be an object of the type returned from the API, in this case it will be of type User
.
If userResponse.Success
is false, then userResponse.IsError
will be true (which we could also use to check the inverse).
If we have errored, then there might be 2 sources for the error. One would be Appwrite throwing an error, and the other would be internal - within the SDK. This could be a bug with the SDK, or invalid input provided to it.
If userResponse.IsAppwriteError
is true, then Result
will be of type AppwriteError
.
If userResponse.IsInternalError
is true, then Result
will be of type InternalError
.
We can switch on the result type, allowing us to perform different logic based on the success status.
userResponse.Result.Switch(
account => Console.WriteLine(account.Email),
appwriteError => Console.WriteLine(appwriteError.Message),
internalError => Console.WriteLine(internalError.Message)
);
We can also pull out the known type of the response:
if(userResponse.Success)
{
var email = userResponse.Result.AsT0.Email;
}
Finally, we can return something different depending on what type it is:
string emailAddressOrErrorMessage = userResponse.Result.Match(
account => account.Email,
appwriteError => appwriteError.Message,
internalError => internalError.Message
);
⌛ Progress
🔑 Key
Icon | Definition |
---|---|
✅ | The endpoint is implemented for the given SDK type (client or server) |
⬛ | The endpoint is not yet implemented for the given SDK type (client or server), but will be |
❌ | There is currently no intention to implement the endpoint for the given SDK type (client or server) |
Account
Users
Teams
Endpoint | Client | Server |
---|---|---|
List Teams | ✅ | ✅ |
Create Team | ✅ | ✅ |
Get Team | ✅ | ✅ |
Update Name | ✅ | ✅ |
Delete Team | ✅ | ✅ |
List Team Memberships | ✅ | ✅ |
Create Team Membership | ✅ | ✅ |
Get Team Membership | ✅ | ✅ |
Update Membership | ✅ | ✅ |
Delete Team Membership | ✅ | ✅ |
Update Team Membership Status | ✅ | ❌ |
Get Team Memberships | ✅ | ✅ |
Update Preferences | ✅ | ✅ |
Databases
Storage
Endpoint | Client | Server |
---|---|---|
List Buckets | ❌ | ⬛ |
Create Bucket | ❌ | ⬛ |
Get Bucket | ❌ | ⬛ |
Update Bucket | ❌ | ⬛ |
Delete Bucket | ❌ | ⬛ |
List Files | ⬛ | ⬛ |
Create File | ⬛ | ⬛ |
Get File | ⬛ | ⬛ |
Update File | ⬛ | ⬛ |
Delete File | ⬛ | ⬛ |
Get File For Download | ⬛ | ⬛ |
Get File Preview | ⬛ | ⬛ |
Get File For View | ⬛ | ⬛ |
Functions
Endpoint | Client | Server |
---|---|---|
List Functions | ❌ | ⬛ |
Create Function | ❌ | ⬛ |
List Runtimes | ❌ | ⬛ |
Get Function | ❌ | ⬛ |
Update Function | ❌ | ⬛ |
Delete Function | ❌ | ⬛ |
List Deployments | ❌ | ⬛ |
Create Deployment | ❌ | ⬛ |
Get Deployment | ❌ | ⬛ |
Update Function Deployment | ❌ | ⬛ |
Delete Deployment | ❌ | ⬛ |
Create Build | ❌ | ⬛ |
Download Deployment | ❌ | ⬛ |
List Executions | ⬛ | ⬛ |
Create Execution | ⬛ | ⬛ |
Get Execution | ⬛ | ⬛ |
List Variables | ❌ | ⬛ |
Create Variable | ❌ | ⬛ |
Get Variable | ❌ | ⬛ |
Update Variable | ❌ | ⬛ |
Delete Variable | ❌ | ⬛ |
Messaging
Locale
Endpoint | Client | Server |
---|---|---|
Get User Locale | ⬛ | ❌ |
List Locale Codes | ⬛ | ⬛ |
List Continents | ⬛ | ⬛ |
List Countries | ⬛ | ⬛ |
List EU Countries | ⬛ | ⬛ |
List Countries Phone Codes | ⬛ | ⬛ |
List Currencies | ⬛ | ⬛ |
List Languages | ⬛ | ⬛ |
Avatars
Endpoint | Client | Server |
---|---|---|
Get Browser Icon | ⬛ | ⬛ |
Get Credit Card Icon | ⬛ | ⬛ |
Get Favicon | ⬛ | ⬛ |
Get Country Flag | ⬛ | ⬛ |
Get Image From Url | ⬛ | ⬛ |
Get Initials | ⬛ | ⬛ |
Get QR Code | ⬛ | ⬛ |
Health
Endpoint | Client | Server |
---|---|---|
Get HTTP | ❌ | ⬛ |
Get Antivirus | ❌ | ⬛ |
Get Cache | ❌ | ⬛ |
Get the SSL certificate for a domain | ❌ | ⬛ |
Get DB | ❌ | ⬛ |
Get PubSub | ❌ | ⬛ |
Get Queue | ❌ | ⬛ |
Get Builds Queue | ❌ | ⬛ |
Get Certificates Queue | ❌ | ⬛ |
Get Databases Queue | ❌ | ⬛ |
Get Deletes Queue | ❌ | ⬛ |
Get Number of Failed Jobs | ❌ | ⬛ |
Get Functions Queue | ❌ | ⬛ |
Get Logs Queue | ❌ | ⬛ |
Get Mails Queue | ❌ | ⬛ |
Get Messaging Queue | ❌ | ⬛ |
Get Migrations Queue | ❌ | ⬛ |
Get Usage Queue | ❌ | ⬛ |
Get Usage Dump Queue | ❌ | ⬛ |
Get Webhooks Queue | ❌ | ⬛ |
Get Storage | ❌ | ⬛ |
Get Local Storage | ❌ | ⬛ |
Get Time | ❌ | ⬛ |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- OneOf (>= 3.0.271)
- PinguApps.Appwrite.Shared (>= 0.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.3.1 | 75 | 11/6/2024 |
0.3.0 | 90 | 10/20/2024 |
0.2.0 | 77 | 10/13/2024 |
0.1.0 | 91 | 9/25/2024 |
0.1.0-alpha | 110 | 7/2/2024 |