Skip to content

Commit

Permalink
Merge pull request #560 from PinguApps/dev
Browse files Browse the repository at this point in the history
Merge v0.4.0
  • Loading branch information
pingu2k4 authored Dec 11, 2024
2 parents 70d3c34 + c74b1f3 commit 749080d
Show file tree
Hide file tree
Showing 347 changed files with 21,435 additions and 157 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [ ] `feature`
- [ ] `bug`
- [ ] `docs`
- [ ] `security`
- [ ] `meta`
- [ ] `patch`
- [ ] `minor`
Expand Down
3 changes: 3 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ change-template: "- [#$NUMBER] $TITLE - Thanks to @$AUTHOR!"
exclude-labels:
- automated
categories:
- title: "🔒 Security"
labels:
- "security"
- title: "🚀 Features"
labels:
- "feature"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Nuget Cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
Expand All @@ -42,7 +42,7 @@ jobs:
run: dotnet test -c Release --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage"

- name: Combine Coverage Reports
uses: danielpalme/ReportGenerator-GitHub-Action@62f9e70ab348d56eee76d446b4db903a85ab0ea8 # v5.3.11
uses: danielpalme/ReportGenerator-GitHub-Action@810356ce07a94200154301fb73d878e327b2dd58 # v5.4.1
with:
reports: "**/*.cobertura.xml"
targetdir: "${{ github.workspace }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@53d8a86de9f2224b24c6a9009a8a1f56d4e1324d" # v5
uses: "alstr/todo-to-issue-action@f357c404fe00f5a17cd96696eaf6f8ce5fd19cf7" # v5
with:
INSERT_ISSUE_URLS: true
AUTO_ASSIGN: true
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jobs:
close-issue-message: 'Closing issue as it has been marked as stale for 3 days.'
close-pr-message: 'Closing PR as it has been marked as stale for 3 days.'
exempt-all-milestones: true
exempt-pr-labels: 'dependencies'
92 changes: 46 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ string emailAddressOrErrorMessage = userResponse.Result.Match(

## ⌛ Progress
<!-- `red` for first third, `gold` for second third, `forestgreen` for final third, `blue` for 100% -->
![Server & Client - 125 / 317](https://img.shields.io/badge/Server_&_Client-125%20%2F%20317-gold?style=for-the-badge)
![Server & Client - 172 / 317](https://img.shields.io/badge/Server_&_Client-172%20%2F%20317-gold?style=for-the-badge)

![Server - 65 / 224](https://img.shields.io/badge/Server-65%20%2F%20224-red?style=for-the-badge)
![Server - 107 / 224](https://img.shields.io/badge/Server-107%20%2F%20224-gold?style=for-the-badge)

![Client - 60 / 93](https://img.shields.io/badge/Client-60%20%2F%2093-gold?style=for-the-badge)
![Client - 65 / 93](https://img.shields.io/badge/Client-65%20%2F%2093-forestgreen?style=for-the-badge)

### 🔑 Key
| Icon | Definition |
Expand Down Expand Up @@ -275,52 +275,52 @@ string emailAddressOrErrorMessage = userResponse.Result.Match(
| [Update Preferences](https://appwrite.io/docs/references/1.6.x/client-rest/teams#updatePrefs) |||

### Databases
![Databases - 0 / 47](https://img.shields.io/badge/Databases-0%20%2F%2047-red?style=for-the-badge)
![Databases - 47 / 47](https://img.shields.io/badge/Databases-47%20%2F%2047-blue?style=for-the-badge)

| Endpoint | Client | Server |
|:-:|:-:|:-:|
| [List Databases](https://appwrite.io/docs/references/1.6.x/server-rest/databases#list) || |
| [Create Databases](https://appwrite.io/docs/references/1.6.x/server-rest/databases#create) || |
| [Get Database](https://appwrite.io/docs/references/1.6.x/server-rest/databases#get) || |
| [Update Database](https://appwrite.io/docs/references/1.6.x/server-rest/databases#update) || |
| [Delete Database](https://appwrite.io/docs/references/1.6.x/server-rest/databases#delete) || |
| [List Collections](https://appwrite.io/docs/references/1.6.x/server-rest/databases#listCollections) || |
| [Create Collection](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createCollection) || |
| [Get Collections](https://appwrite.io/docs/references/1.6.x/server-rest/databases#getCollection) || |
| [Update Collection](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateCollection) || |
| [Delete Collection](https://appwrite.io/docs/references/1.6.x/server-rest/databases#deleteCollection) || |
| [List Attributes](https://appwrite.io/docs/references/1.6.x/server-rest/databases#listAttributes) || |
| [Create Boolean Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createBooleanAttribute) || |
| [Update Boolean Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateBooleanAttribute) || |
| [Create Datatime Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createDatetimeAttribute) || |
| [Update Datetime Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateDatetimeAttribute) || |
| [Create Email Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createEmailAttribute) || |
| [Update Email Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateEmailAttribute) || |
| [Create Enum Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createEnumAttribute) || |
| [Update Enum Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateEnumAttribute) || |
| [Create Float Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createFloatAttribute) || |
| [Update Float Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateFloatAttribute) || |
| [Create Integer Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createIntegerAttribute) || |
| [Update Integer attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateIntegerAttribute) || |
| [Create IP Address Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createIpAttribute) || |
| [Update IP Address Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateIpAttribute) || |
| [Create Relationship Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createRelationshipAttribute) || |
| [Create String Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createStringAttribute) || |
| [Update String Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateStringAttribute) || |
| [Create URL Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createUrlAttribute) || |
| [Update URL Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateUrlAttribute) || |
| [Get Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#getAttribute) || |
| [Delete Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#deleteAttribute) || |
| [Update Relationship Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateRelationshipAttribute) || |
| [List Documents](https://appwrite.io/docs/references/1.6.x/client-rest/databases#listDocuments) | | |
| [Create Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#createDocument) | | |
| [Get Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#getDocument) | | |
| [Update Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#updateDocument) | | |
| [Delete Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#deleteDocument) | | |
| [List Indexes](https://appwrite.io/docs/references/1.6.x/server-rest/databases#listIndexes) || |
| [Create Index](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createIndex) || |
| [Get Index](https://appwrite.io/docs/references/1.6.x/server-rest/databases#getIndex) || |
| [Delete Index](https://appwrite.io/docs/references/1.6.x/server-rest/databases#deleteIndex) || |
| [List Databases](https://appwrite.io/docs/references/1.6.x/server-rest/databases#list) || |
| [Create Databases](https://appwrite.io/docs/references/1.6.x/server-rest/databases#create) || |
| [Get Database](https://appwrite.io/docs/references/1.6.x/server-rest/databases#get) || |
| [Update Database](https://appwrite.io/docs/references/1.6.x/server-rest/databases#update) || |
| [Delete Database](https://appwrite.io/docs/references/1.6.x/server-rest/databases#delete) || |
| [List Collections](https://appwrite.io/docs/references/1.6.x/server-rest/databases#listCollections) || |
| [Create Collection](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createCollection) || |
| [Get Collections](https://appwrite.io/docs/references/1.6.x/server-rest/databases#getCollection) || |
| [Update Collection](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateCollection) || |
| [Delete Collection](https://appwrite.io/docs/references/1.6.x/server-rest/databases#deleteCollection) || |
| [List Attributes](https://appwrite.io/docs/references/1.6.x/server-rest/databases#listAttributes) || |
| [Create Boolean Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createBooleanAttribute) || |
| [Update Boolean Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateBooleanAttribute) || |
| [Create Datetime Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createDatetimeAttribute) || |
| [Update Datetime Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateDatetimeAttribute) || |
| [Create Email Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createEmailAttribute) || |
| [Update Email Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateEmailAttribute) || |
| [Create Enum Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createEnumAttribute) || |
| [Update Enum Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateEnumAttribute) || |
| [Create Float Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createFloatAttribute) || |
| [Update Float Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateFloatAttribute) || |
| [Create Integer Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createIntegerAttribute) || |
| [Update Integer attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateIntegerAttribute) || |
| [Create IP Address Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createIpAttribute) || |
| [Update IP Address Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateIpAttribute) || |
| [Create Relationship Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createRelationshipAttribute) || |
| [Create String Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createStringAttribute) || |
| [Update String Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateStringAttribute) || |
| [Create URL Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createUrlAttribute) || |
| [Update URL Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateUrlAttribute) || |
| [Get Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#getAttribute) || |
| [Delete Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#deleteAttribute) || |
| [Update Relationship Attribute](https://appwrite.io/docs/references/1.6.x/server-rest/databases#updateRelationshipAttribute) || |
| [List Documents](https://appwrite.io/docs/references/1.6.x/client-rest/databases#listDocuments) | | |
| [Create Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#createDocument) | | |
| [Get Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#getDocument) | | |
| [Update Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#updateDocument) | | |
| [Delete Document](https://appwrite.io/docs/references/1.6.x/client-rest/databases#deleteDocument) | | |
| [List Indexes](https://appwrite.io/docs/references/1.6.x/server-rest/databases#listIndexes) || |
| [Create Index](https://appwrite.io/docs/references/1.6.x/server-rest/databases#createIndex) || |
| [Get Index](https://appwrite.io/docs/references/1.6.x/server-rest/databases#getIndex) || |
| [Delete Index](https://appwrite.io/docs/references/1.6.x/server-rest/databases#deleteIndex) || |

### Storage
![storage - 0 / 21](https://img.shields.io/badge/Storage-0%20%2F%2021-red?style=for-the-badge)
Expand Down
5 changes: 2 additions & 3 deletions src/PinguApps.Appwrite.Client/Clients/AccountClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using PinguApps.Appwrite.Client.Clients;
using PinguApps.Appwrite.Client.Internals;
using PinguApps.Appwrite.Client.Utils;
Expand All @@ -17,9 +16,9 @@ public class AccountClient : SessionAwareClientBase, IAccountClient
private readonly IAccountApi _accountApi;
private readonly Config _config;

public AccountClient(IServiceProvider services, Config config)
internal AccountClient(IAccountApi accountApi, Config config)
{
_accountApi = services.GetRequiredService<IAccountApi>();
_accountApi = accountApi;
_config = config;
}

Expand Down
9 changes: 8 additions & 1 deletion src/PinguApps.Appwrite.Client/Clients/AppwriteClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ public class AppwriteClient : IAppwriteClient, ISessionAware
{
/// <inheritdoc/>
public IAccountClient Account { get; }

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

public AppwriteClient(IAccountClient accountClient, ITeamsClient teams)
/// <inheritdoc/>
public IDatabasesClient Databases { get; }

public AppwriteClient(IAccountClient accountClient, ITeamsClient teams, IDatabasesClient databasesClient)
{
Account = accountClient;
Teams = teams;
Databases = databasesClient;
}

string? ISessionAware.Session { get; set; }
Expand All @@ -36,5 +42,6 @@ public void SetSession(string? session)
(this as ISessionAware).UpdateSession(session);
(Account as ISessionAware)!.UpdateSession(session);
(Teams as ISessionAware)!.UpdateSession(session);
(Databases as ISessionAware)!.UpdateSession(session);
}
}
105 changes: 105 additions & 0 deletions src/PinguApps.Appwrite.Client/Clients/DatabasesClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using System;
using System.Threading.Tasks;
using PinguApps.Appwrite.Client.Internals;
using PinguApps.Appwrite.Client.Utils;
using PinguApps.Appwrite.Shared;
using PinguApps.Appwrite.Shared.Requests.Databases;
using PinguApps.Appwrite.Shared.Responses;

namespace PinguApps.Appwrite.Client.Clients;

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

internal DatabasesClient(IDatabasesApi databasesApi)
{
_databasesApi = databasesApi;
}

/// <inheritdoc/>
public async Task<AppwriteResult<DocumentsList>> ListDocuments(ListDocumentsRequest request)
{
try
{
request.Validate(true);

var result = await _databasesApi.ListDocuments(GetCurrentSession(), request.DatabaseId, request.CollectionId, RequestUtils.GetQueryStrings(request.Queries));

return result.GetApiResponse();
}
catch (Exception e)
{
return e.GetExceptionResponse<DocumentsList>();
}
}

/// <inheritdoc/>
public async Task<AppwriteResult<Document>> CreateDocument(CreateDocumentRequest request)
{
try
{
request.Validate(true);

var result = await _databasesApi.CreateDocument(GetCurrentSession(), request.DatabaseId, request.CollectionId, request);

return result.GetApiResponse();
}
catch (Exception e)
{
return e.GetExceptionResponse<Document>();
}
}

/// <inheritdoc/>
public async Task<AppwriteResult> DeleteDocument(DeleteDocumentRequest request)
{
try
{
request.Validate(true);

var result = await _databasesApi.DeleteDocument(GetCurrentSession(), request.DatabaseId, request.CollectionId, request.DocumentId);

return result.GetApiResponse();
}
catch (Exception e)
{
return e.GetExceptionResponse();
}
}

/// <inheritdoc/>
public async Task<AppwriteResult<Document>> GetDocument(GetDocumentRequest request)
{
try
{
request.Validate(true);

var result = await _databasesApi.GetDocument(GetCurrentSession(), request.DatabaseId, request.CollectionId, request.DocumentId, RequestUtils.GetQueryStrings(request.Queries));

return result.GetApiResponse();
}
catch (Exception e)
{
return e.GetExceptionResponse<Document>();
}
}

/// <inheritdoc/>
public async Task<AppwriteResult<Document>> UpdateDocument(UpdateDocumentRequest request)
{
try
{
request.Validate(true);

var result = await _databasesApi.UpdateDocument(GetCurrentSession(), request.DatabaseId, request.CollectionId, request.DocumentId, request);

return result.GetApiResponse();
}
catch (Exception e)
{
return e.GetExceptionResponse<Document>();
}
}
}
Loading

0 comments on commit 749080d

Please sign in to comment.