-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #560 from PinguApps/dev
Merge v0.4.0
- Loading branch information
Showing
347 changed files
with
21,435 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
- [ ] `feature` | ||
- [ ] `bug` | ||
- [ ] `docs` | ||
- [ ] `security` | ||
- [ ] `meta` | ||
- [ ] `patch` | ||
- [ ] `minor` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/PinguApps.Appwrite.Client/Clients/DatabasesClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>(); | ||
} | ||
} | ||
} |
Oops, something went wrong.