Skip to content

IMediaMaticService

Namespace: MJCZone.MediaMatic.AspNetCore.Services

Assembly: MJCZone.MediaMatic.AspNetCore

Summary

Service interface for MediaMatic operations in ASP.NET Core applications.

abstract public

Note: This is an interface that defines a contract. Look for implementing classes in the same or related namespaces.

Contents

Methods (23)

Methods

MethodSummary
GetFilesourcesAsyncGets all registered datasources.
GetFilesourceAsyncGets datasource information by name.
AddFilesourceAsyncAdds a new datasource.
UpdateFilesourceAsyncUpdates an existing datasource.
RemoveFilesourceAsyncRemoves a datasource.
FilesourceExistsAsyncChecks if a datasource exists.
TestFilesourceAsyncTests the connection to a datasource.
GetFileMetadataAsyncGets metadata for a file.
TransformImageAsyncTransforms an image with specified processing options.
ListFilesAsyncLists files in a directory.
ListAsyncLists files and folders in a directory with rich metadata.
DownloadFileAsyncDownloads a file.
UploadFileAsyncUploads a file.
DeleteFileAsyncDeletes a file.
FileExistsAsyncChecks if a file exists.
ListFoldersAsyncLists folders in a directory.
CreateFolderAsyncCreates a folder.
DeleteFolderAsyncDeletes a folder and all its contents.
CreateFolderArchiveAsyncCreates an archive of a folder.
CreateFileListArchiveAsyncCreates an archive from a list of files and folders.
ListArchivesAsyncLists all archives in a folder.
DownloadArchiveAsyncDownloads an archive file.
DeleteArchiveAsyncDeletes an archive file.

GetFilesourcesAsync

Gets all registered datasources.

csharp
Task<IEnumerable<FilesourceDto>> GetFilesourcesAsync(
    IOperationContext context,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<IEnumerable<FilesourceDto>>

List of datasource information.

GetFilesourceAsync

Gets datasource information by name.

csharp
Task&lt;FilesourceDto&gt; GetFilesourceAsync(
    IOperationContext context,
    string datasourceId,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • datasourceId (string) - The id of the datasource.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<FilesourceDto>

The datasource information.

AddFilesourceAsync

Adds a new datasource.

csharp
Task&lt;FilesourceDto&gt; AddFilesourceAsync(
    IOperationContext context,
    FilesourceDto datasource,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • datasource (FilesourceDto) - The datasource to add.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<FilesourceDto>

The added datasource if successful.

UpdateFilesourceAsync

Updates an existing datasource.

csharp
Task&lt;FilesourceDto&gt; UpdateFilesourceAsync(
    IOperationContext context,
    FilesourceDto datasource,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • datasource (FilesourceDto) - The updated datasource information.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<FilesourceDto>

The updated datasource.

RemoveFilesourceAsync

Removes a datasource.

csharp
Task RemoveFilesourceAsync(
    IOperationContext context,
    string datasourceId,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • datasourceId (string) - The id of the datasource to remove.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task

Task representing the asynchronous operation.

FilesourceExistsAsync

Checks if a datasource exists.

csharp
Task&lt;bool&gt; FilesourceExistsAsync(
    IOperationContext context,
    string datasourceId,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • datasourceId (string) - The id of the datasource to check.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;bool&gt;

True if the datasource exists, false otherwise.

TestFilesourceAsync

Tests the connection to a datasource.

csharp
Task&lt;FilesourceConnectivityTestDto&gt; TestFilesourceAsync(
    IOperationContext context,
    string datasourceId,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • datasourceId (string) - The id of the datasource to test.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<FilesourceConnectivityTestDto>

Test result containing connection status and details.

GetFileMetadataAsync

Gets metadata for a file.

csharp
Task&lt;MediaMetadata&gt; GetFileMetadataAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string filePath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • filePath (string) - The file path.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<MediaMetadata>

File metadata.

TransformImageAsync

Transforms an image with specified processing options.

csharp
Task&lt;Stream&gt; TransformImageAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string filePath,
    ImageProcessingOptions options,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • filePath (string) - The source file path.
  • options (ImageProcessingOptions) - Image processing options.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;Stream&gt;

Stream containing the transformed image.

ListFilesAsync

Lists files in a directory.

csharp
Task&lt;IEnumerable&lt;string&gt;&gt; ListFilesAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string path,
    bool recursive,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • path (string) - The directory path (null for root).
  • recursive (bool) - Whether to list files recursively.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;IEnumerable&lt;string&gt;&gt;

List of file paths.

ListAsync

Lists files and folders in a directory with rich metadata.

csharp
Task&lt;BrowseResponseDto&gt; ListAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string path,
    BrowseOptions options,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • path (string) - The directory path (null for root).
  • options (BrowseOptions) - Browse options for filtering and field selection.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<BrowseResponseDto>

Browse response containing files and folders with metadata.

DownloadFileAsync

Downloads a file.

csharp
Task&lt;Stream&gt; DownloadFileAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string filePath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • filePath (string) - The file path to download.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;Stream&gt;

Stream containing the file data.

UploadFileAsync

Uploads a file.

csharp
Task&lt;string&gt; UploadFileAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string filePath,
    Stream stream,
    bool overwrite,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • filePath (string) - The target file path.
  • stream (Stream) - The file stream to upload.
  • overwrite (bool) - Whether to overwrite existing files.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;string&gt;

The path to the uploaded file.

DeleteFileAsync

Deletes a file.

csharp
Task DeleteFileAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string filePath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • filePath (string) - The file path to delete.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task

Task representing the asynchronous operation.

FileExistsAsync

Checks if a file exists.

csharp
Task&lt;bool&gt; FileExistsAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string filePath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • filePath (string) - The file path to check.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;bool&gt;

True if the file exists.

ListFoldersAsync

Lists folders in a directory.

csharp
Task&lt;IEnumerable&lt;string&gt;&gt; ListFoldersAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string path,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • path (string) - The directory path (null for root).
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;IEnumerable&lt;string&gt;&gt;

List of folder paths.

CreateFolderAsync

Creates a folder.

csharp
Task&lt;bool&gt; CreateFolderAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string folderPath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • folderPath (string) - The folder path to create.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;bool&gt;

True if the folder was created, false if it already exists.

DeleteFolderAsync

Deletes a folder and all its contents.

csharp
Task DeleteFolderAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string folderPath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • folderPath (string) - The folder path to delete.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task

Task representing the asynchronous operation.

CreateFolderArchiveAsync

Creates an archive of a folder.

csharp
Task&lt;ArchiveResponse&gt; CreateFolderArchiveAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string folderPath,
    ArchiveRequest request,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • folderPath (string) - The folder path to archive.
  • request (ArchiveRequest) - Archive creation options.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<ArchiveResponse>

Archive response containing job ID and archive information.

CreateFileListArchiveAsync

Creates an archive from a list of files and folders.

csharp
Task&lt;ArchiveResponse&gt; CreateFileListArchiveAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    ArchiveRequest request,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • request (ArchiveRequest) - Archive request containing the list of paths.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<ArchiveResponse>

Archive response containing job ID and archive information.

ListArchivesAsync

Lists all archives in a folder.

csharp
Task&lt;IEnumerable&lt;ArchiveInfo&gt;&gt; ListArchivesAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string folderPath,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • folderPath (string) - The folder path containing archives.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task<IEnumerable<ArchiveInfo>>

List of archive information.

DownloadArchiveAsync

Downloads an archive file.

csharp
Task&lt;Stream&gt; DownloadArchiveAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string archiveId,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • archiveId (string) - The archive identifier.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task&lt;Stream&gt;

Stream containing the archive data.

DeleteArchiveAsync

Deletes an archive file.

csharp
Task DeleteArchiveAsync(
    IOperationContext context,
    string filesourceId,
    string bucketName,
    string archiveId,
    CancellationToken cancellationToken)

Parameters

  • context (IOperationContext) - The operation context.
  • filesourceId (string) - The filesource identifier.
  • bucketName (string) - Optional bucket name (for S3/Azure).
  • archiveId (string) - The archive identifier.
  • cancellationToken (CancellationToken) - Cancellation token.

Returns

Type: Task

Task representing the asynchronous operation.