Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions Nexus.Sdk.Token/Facades/DocumentStoreFacade.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Nexus.Sdk.Shared.Responses;
using Nexus.Sdk.Token.Facades.Interfaces;
using Nexus.Sdk.Token.Requests;
using Nexus.Sdk.Token.Responses;

namespace Nexus.Sdk.Token.Facades
{
public class DocumentStoreFacade : TokenServerFacade, IDocumentStoreFacade
{
public DocumentStoreFacade(ITokenServerProvider provider) : base(provider)
{
}

public async Task AddDocumentToStore(FileUploadRequest fileUploadRequest, string customerIPAddress)
{
await _provider.AddDocumentToStore(fileUploadRequest, customerIPAddress);
}

public async Task CreateDocumentStore(DocumentStoreSettingsRequest documentStoreSettings, string customerIPAddress)
{
await _provider.CreateDocumentStore(documentStoreSettings, customerIPAddress);
}

public async Task DeleteDocumentFromStore(DocumentRequest documentRequest, string customerIPAddress)
{
await _provider.DeleteDocumentFromStore(documentRequest, customerIPAddress);
}

public async Task DeleteDocumentStore(string customerIPAddress)
{
await _provider.DeleteDocumentStore(customerIPAddress);
}

public async Task<Stream> GetDocumentFromStore(DocumentRequest documentRequest, string customerIPAddress)
{
return await _provider.GetDocumentFromStore(documentRequest, customerIPAddress);
}

public async Task<DocumentStoreSettingsResponse> GetDocumentStore(string customerIPAddress)
{
return await _provider.GetDocumentStore(customerIPAddress);
}

public async Task<PagedResponse<DocumentStoreItemResponse>> GetDocumentStoreFileList(IDictionary<string, string>? queryParameters, string customerIPAddress)
{
return await _provider.GetDocumentStoreFileList(queryParameters, customerIPAddress);
}

public async Task UpdateDocumentInStore(FileUpdateRequest fileUpdateRequest, string customerIPAddress)
{
await _provider.UpdateDocumentInStore(fileUpdateRequest, customerIPAddress);
}

public async Task UpdateDocumentStore(DocumentStoreSettingsRequest documentStoreSettings, string customerIPAddress)
{
await _provider.UpdateDocumentStore(documentStoreSettings, customerIPAddress);
}
}
}
79 changes: 79 additions & 0 deletions Nexus.Sdk.Token/Facades/Interfaces/IDocumentStoreFacade.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Nexus.Sdk.Shared.Responses;
using Nexus.Sdk.Token.Requests;
using Nexus.Sdk.Token.Responses;

namespace Nexus.Sdk.Token.Facades.Interfaces
{
public interface IDocumentStoreFacade
{
/// <summary>
/// Retrieve the Document Store settings
/// </summary>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task<DocumentStoreSettingsResponse> GetDocumentStore(string customerIPAddress);

/// <summary>
/// Create a new Document Store with the provided settings
/// </summary>
/// <param name="documentStoreSettings"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task CreateDocumentStore(DocumentStoreSettingsRequest documentStoreSettings, string customerIPAddress);

/// <summary>
/// Update the existing Document Store settings
/// </summary>
/// <param name="documentStoreSettings"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task UpdateDocumentStore(DocumentStoreSettingsRequest documentStoreSettings, string customerIPAddress);

/// <summary>
/// Delete the existing Document Store settings
/// </summary>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task DeleteDocumentStore(string customerIPAddress);

/// <summary>
/// Retrieve a list of files in the Document Store based on the provided query parameters.
/// </summary>
/// <param name="queryParameters"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task<PagedResponse<DocumentStoreItemResponse>> GetDocumentStoreFileList(IDictionary<string, string>? queryParameters, string customerIPAddress);

/// <summary>
/// Upload a document to the Document Store.
/// </summary>
/// <param name="fileUploadRequest"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task AddDocumentToStore(FileUploadRequest fileUploadRequest, string customerIPAddress);

/// <summary>
/// Retrieve a document from the Document Store based on the provided file path.
/// </summary>
/// <param name="documentRequest"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task<Stream> GetDocumentFromStore(DocumentRequest documentRequest, string customerIPAddress);

/// <summary>
/// Delete a document from the Document Store based on the provided file path.
/// </summary>
/// <param name="documentRequest"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task DeleteDocumentFromStore(DocumentRequest documentRequest, string customerIPAddress);

/// <summary>
/// Update document metadata in the Document Store.
/// </summary>
/// <param name="fileUpdateRequest"></param>
/// <param name="customerIPAddress"></param>
/// <returns></returns>
public Task UpdateDocumentInStore(FileUpdateRequest fileUpdateRequest, string customerIPAddress);
}
}
Loading