Interface IFileService
Defines the interface for a service that manages media files (e.g. images, documents).
Namespace: DataWeb.Media
Assembly: DataWeb.Core.dll
Syntax
public interface IFileService
  Methods
CloneFileAndUpdateDataAsync(Dictionary<string, object>, Dictionary<string, object>)
Clones file and updates related data fields.
Declaration
Task CloneFileAndUpdateDataAsync(Dictionary<string, object> sourceSectionData, Dictionary<string, object> targetSectionData)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Dictionary<string, object> | sourceSectionData | The source data with file reference.  | 
      
| Dictionary<string, object> | targetSectionData | The target data with cloned file reference.  | 
      
Returns
| Type | Description | 
|---|---|
| Task | 
GetFile(FileData)
Gets a File object from a FileData object.
Declaration
File GetFile(FileData fileData)
  Parameters
| Type | Name | Description | 
|---|---|---|
| FileData | fileData | The FileData object to use to create the File object.  | 
      
Returns
| Type | Description | 
|---|---|
| File | A File object representing the given FileData object.  | 
      
GetFileByCodeAsync(string, string, string, string, PublishMode?, CancellationToken)
Gets a file by its code, with optional filters.
Declaration
Task<File> GetFileByCodeAsync(string code, string tagName = null, string versionName = null, string versionCulture = null, PublishMode? publishMode = null, CancellationToken cancellationToken = default)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | code | The code of the file to retrieve.  | 
      
| string | tagName | The tag name of the file to retrieve. If null, the most recent tag is used.  | 
      
| string | versionName | The version name of the file to retrieve. If null, the most recent version is used.  | 
      
| string | versionCulture | The culture of the file to retrieve. If null, the default culture is used.  | 
      
| PublishMode? | publishMode | The PublishMode of the file to retrieve. If null, the latest published version is used.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<File> | A File object representing the retrieved file.  | 
      
GetFileByIdMasterAsync(string, string, string, string, PublishMode?, CancellationToken)
Gets a file by its IdMaster, with optional filters.
Declaration
Task<File> GetFileByIdMasterAsync(string IdMaster, string tagName = null, string versionName = null, string versionCulture = null, PublishMode? publishMode = null, CancellationToken cancellationToken = default)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | IdMaster | The IdMaster of the file to retrieve.  | 
      
| string | tagName | The tag name of the file to retrieve. If null, the most recent tag is used.  | 
      
| string | versionName | The version name of the file to retrieve. If null, the most recent version is used.  | 
      
| string | versionCulture | The culture of the file to retrieve. If null, the default culture is used.  | 
      
| PublishMode? | publishMode | The PublishMode of the file to retrieve. If null, the latest published version is used.  | 
      
| CancellationToken | cancellationToken | 
Returns
| Type | Description | 
|---|---|
| Task<File> | A File object representing the retrieved file.  | 
      
GetObsoleteFiles()
Gets a list of obsolete files (files that are no longer used).
Declaration
Task<IEnumerable<File>> GetObsoleteFiles()
  Returns
| Type | Description | 
|---|---|
| Task<IEnumerable<File>> | An IEnumerable of File objects representing the obsolete files.  | 
      
UpdateIsInStorage(string, bool)
Updates the IsInStorage flag of a file.
Declaration
Task UpdateIsInStorage(string fileIdMaster, bool isInStorage)
  Parameters
| Type | Name | Description | 
|---|---|---|
| string | fileIdMaster | The IdMaster of the file to update.  | 
      
| bool | isInStorage | The new value of the IsInStorage flag.  | 
      
Returns
| Type | Description | 
|---|---|
| Task |