♻️ Extract the Storage service to DysonNetwork.Drive microservice
This commit is contained in:
40
DysonNetwork.Drive/Interfaces/IFileReferenceService.cs
Normal file
40
DysonNetwork.Drive/Interfaces/IFileReferenceService.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using DysonNetwork.Drive.Models;
|
||||
|
||||
namespace DysonNetwork.Drive.Interfaces;
|
||||
|
||||
public interface IFileReferenceService
|
||||
{
|
||||
Task<CloudFileReference> CreateReferenceAsync(
|
||||
Guid fileId,
|
||||
string resourceId,
|
||||
string resourceType,
|
||||
string referenceType,
|
||||
string? referenceId = null,
|
||||
string? referenceName = null,
|
||||
string? referenceMimeType = null,
|
||||
long? referenceSize = null,
|
||||
string? referenceUrl = null,
|
||||
string? referenceThumbnailUrl = null,
|
||||
string? referencePreviewUrl = null,
|
||||
string? referenceMetadata = null,
|
||||
IDictionary<string, object>? metadata = null,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<CloudFileReference> GetReferenceAsync(Guid referenceId, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<CloudFileReference>> GetReferencesForFileAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<CloudFileReference>> GetReferencesForResourceAsync(string resourceId, string resourceType, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<CloudFileReference>> GetReferencesOfTypeAsync(string referenceType, CancellationToken cancellationToken = default);
|
||||
Task<bool> DeleteReferenceAsync(Guid referenceId, CancellationToken cancellationToken = default);
|
||||
Task<int> DeleteReferencesForFileAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<int> DeleteReferencesForResourceAsync(string resourceId, string resourceType, CancellationToken cancellationToken = default);
|
||||
Task<CloudFileReference> UpdateReferenceMetadataAsync(Guid referenceId, IDictionary<string, object> metadata, CancellationToken cancellationToken = default);
|
||||
Task<bool> ReferenceExistsAsync(Guid referenceId, CancellationToken cancellationToken = default);
|
||||
Task<bool> HasReferenceAsync(Guid fileId, string resourceId, string resourceType, string? referenceType = null, CancellationToken cancellationToken = default);
|
||||
Task<CloudFileReference> UpdateReferenceResourceAsync(Guid referenceId, string newResourceId, string newResourceType, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<CloudFile>> GetFilesForResourceAsync(string resourceId, string resourceType, string? referenceType = null, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<CloudFile>> GetFilesForReferenceTypeAsync(string referenceType, CancellationToken cancellationToken = default);
|
||||
}
|
27
DysonNetwork.Drive/Interfaces/IFileService.cs
Normal file
27
DysonNetwork.Drive/Interfaces/IFileService.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using DysonNetwork.Drive.Models;
|
||||
|
||||
namespace DysonNetwork.Drive.Interfaces;
|
||||
|
||||
public interface IFileService
|
||||
{
|
||||
Task<CloudFile> GetFileAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<Stream> DownloadFileAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<CloudFile> UploadFileAsync(Stream fileStream, string fileName, string contentType, IDictionary<string, string>? metadata = null, CancellationToken cancellationToken = default);
|
||||
Task<bool> DeleteFileAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<CloudFile> UpdateFileMetadataAsync(Guid fileId, IDictionary<string, string> metadata, CancellationToken cancellationToken = default);
|
||||
Task<bool> FileExistsAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<string> GetFileUrlAsync(Guid fileId, TimeSpan? expiry = null, CancellationToken cancellationToken = default);
|
||||
Task<string> GetFileThumbnailUrlAsync(Guid fileId, int? width = null, int? height = null, TimeSpan? expiry = null, CancellationToken cancellationToken = default);
|
||||
Task<CloudFile> CopyFileAsync(Guid sourceFileId, string? newName = null, IDictionary<string, string>? newMetadata = null, CancellationToken cancellationToken = default);
|
||||
Task<CloudFile> MoveFileAsync(Guid sourceFileId, string? newName = null, IDictionary<string, string>? newMetadata = null, CancellationToken cancellationToken = default);
|
||||
Task<CloudFile> RenameFileAsync(Guid fileId, string newName, CancellationToken cancellationToken = default);
|
||||
Task<long> GetFileSizeAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<string> GetFileHashAsync(Guid fileId, CancellationToken cancellationToken = default);
|
||||
Task<Stream> GetFileThumbnailAsync(Guid fileId, int? width = null, int? height = null, CancellationToken cancellationToken = default);
|
||||
Task<CloudFile> SetFileVisibilityAsync(Guid fileId, bool isPublic, CancellationToken cancellationToken = default);
|
||||
}
|
Reference in New Issue
Block a user