PinguApps.Appwrite.Client 0.4.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package PinguApps.Appwrite.Client --version 0.4.3                
NuGet\Install-Package PinguApps.Appwrite.Client -Version 0.4.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PinguApps.Appwrite.Client" Version="0.4.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PinguApps.Appwrite.Client --version 0.4.3                
#r "nuget: PinguApps.Appwrite.Client, 0.4.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PinguApps.Appwrite.Client as a Cake Addin
#addin nuget:?package=PinguApps.Appwrite.Client&version=0.4.3

// Install PinguApps.Appwrite.Client as a Cake Tool
#tool nuget:?package=PinguApps.Appwrite.Client&version=0.4.3                

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.

Client Version Client Downloads Server Version Server Downloads GitHub Repo stars GitHub Actions Workflow Status CodeFactor Grade

Repobeats Analytics

🚧 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

Server & Client - 172 / 317

Server - 107 / 224

Client - 65 / 93

🔑 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

Account - 58 / 58

Endpoint Client Server
Get Account
Create Account
Update Email
List Identities
Delete Identity
Create JWT
List Logs
Update MFA
Add Authenticator
Verify Authenticator
Delete Authenticator
Create 2FA Challenge
Create MFA Challenge (confirmation)
List Factors
Get MFA Recovery Codes
Create MFA Recovery Codes
Regenerate MFA Recovery Codes
Update Name
Update Password
Update Phone
Get Account Preferences
Update Preferences
Create Password Recovery
Create Password Recovery (Confirmation)
List Sessions
Delete Sessions
Create Anonymous Session
Create Email Password Session
Update Magic URL Session
Create OAuth2 Session
Update Phone Session
Create Session
Get Session
Update Session
Delete Session
Update Status
Create Push Target
Update Push Target
Delete Push Target
Create Email Token (OTP)
Create Magic URL Token
Create OAuth2 Token
Create Phone Token
Create Email Verification
Create Email Verification (Confirmation)
Create Phone Verification
Create Phone Verification (Confirmation)

Users

Account - 42 / 42

Endpoint Client Server
List Users
Create User
Create User with Argon2 Password
Create User with Bcrypt Password
List Identities
Delete Identity
Create User with MD5 Password
Create User with PHPass Password
Create User with Scrypt Password
Create User with Scrypt Modified Password
Create User with SHA Password
Get User
Delete User
Update Email
Create User JWT
Update User Labels
List User Logs
List User Memberships
Update MFA
Delete Authenticator
List Factors
Get MFA Recovery Codes
Regenerate MFA Recovery Codes
Create MFA Recovery Codes
Update Name
Update Password
Update Phone
Get User Preferences
Update User Preferences
List User Sessions
Create Session
Delete User Sessions
Delete User Session
Update User Status
List User Targets
Create User Target
Get User Target
Update User Target
Delete User Target
Create Token
Update Email Verification
Update Phone Verification

Teams

Teams - 25 / 25

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

Databases - 47 / 47

Endpoint Client Server
List Databases
Create Databases
Get Database
Update Database
Delete Database
List Collections
Create Collection
Get Collections
Update Collection
Delete Collection
List Attributes
Create Boolean Attribute
Update Boolean Attribute
Create Datetime Attribute
Update Datetime Attribute
Create Email Attribute
Update Email Attribute
Create Enum Attribute
Update Enum Attribute
Create Float Attribute
Update Float Attribute
Create Integer Attribute
Update Integer attribute
Create IP Address Attribute
Update IP Address Attribute
Create Relationship Attribute
Create String Attribute
Update String Attribute
Create URL Attribute
Update URL Attribute
Get Attribute
Delete Attribute
Update Relationship Attribute
List Documents
Create Document
Get Document
Update Document
Delete Document
List Indexes
Create Index
Get Index
Delete Index

Storage

storage - 0 / 21

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

Functions - 0 / 24

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

Messaging - 0 / 48

Endpoint Client Server
List Messages
Create Email
Update Email
Create Push Notification
Update Push Notification
Create SMS
Update SMS
Get Message
Delete Message
List Message Logs
List Message Targets
List Providers
Create APNS Provider
Update APNS Provider
Create FCM Provider
Update FCM Provider
Create Mailgun Provider
Update Mailgun Provider
Create Msg91 Provider
Update Msg91 Provider
Create Sendgrid Provider
Update Sendgrid Provider
Create SMTP Provider
Update SMTP Provider
Create Telesign Provider
Update Telesign Provider
Create Textmagic Provider
Update Textmagic Provider
Create Twilio Provider
Update Twilio Provider
Create Vonage Provider
Update Vonage Provider
Get Provider
Delete Provider
List Provider Logs
List Subscriber Logs
List Topics
Create Topic
Get Topic
Update Topic
Delete Topic
List Topic Logs
List Subscribers
Create Subscriber
Get Subscriber
Delete Subscriber

Locale

Locale - 0 / 15

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

Avatars - 0 / 14

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

Health - 0 / 23

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.4.6 46 12/21/2024
0.4.5 41 12/19/2024
0.4.4 42 12/18/2024
0.4.3 39 12/18/2024
0.4.2 43 12/18/2024
0.4.1 43 12/18/2024
0.4.0 73 12/11/2024
0.3.1 91 11/6/2024
0.3.0 98 10/20/2024
0.2.0 92 10/13/2024
0.1.0 97 9/25/2024
0.1.0-alpha 122 7/2/2024