Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IMediaEditingService

    Defines the Media Editing Service, which provides operations for creating, updating, deleting, and managing IMedia items through the editing API.

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface IMediaEditingService

    Methods

    View Source

    CreateAsync(MediaCreateModel, Guid)

    Creates a new media item.

    Declaration
    Task<Attempt<MediaCreateResult, ContentEditingOperationStatus>> CreateAsync(MediaCreateModel createModel, Guid userKey)
    Parameters
    Type Name Description
    MediaCreateModel createModel

    The MediaCreateModel containing the media data to create.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<MediaCreateResult, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the MediaCreateResult containing the created media and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    DeleteAsync(Guid, Guid)

    Permanently deletes a media item.

    Declaration
    Task<Attempt<IMedia?, ContentEditingOperationStatus>> DeleteAsync(Guid key, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to delete.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IMedia, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the deleted IMedia item (if successful) and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    DeleteFromRecycleBinAsync(Guid, Guid)

    Permanently deletes a media item from the recycle bin.

    Declaration
    Task<Attempt<IMedia?, ContentEditingOperationStatus>> DeleteFromRecycleBinAsync(Guid key, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to delete from the recycle bin.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IMedia, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the deleted IMedia item (if successful) and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    GetAsync(Guid)

    Gets a media item by its unique identifier.

    Declaration
    Task<IMedia?> GetAsync(Guid key)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to retrieve.

    Returns
    Type Description
    Task<IMedia>

    A task that represents the asynchronous operation. The task result contains the IMedia item if found; otherwise, null.

    View Source

    MoveAsync(Guid, Guid?, Guid)

    Moves a media item to a new parent location.

    Declaration
    Task<Attempt<IMedia?, ContentEditingOperationStatus>> MoveAsync(Guid key, Guid? parentKey, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to move.

    Guid? parentKey

    The unique identifier of the new parent, or null to move to the root.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IMedia, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the moved IMedia item (if successful) and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    MoveToRecycleBinAsync(Guid, Guid)

    Moves a media item to the recycle bin.

    Declaration
    Task<Attempt<IMedia?, ContentEditingOperationStatus>> MoveToRecycleBinAsync(Guid key, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to move to the recycle bin.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IMedia, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the moved IMedia item (if successful) and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    RestoreAsync(Guid, Guid?, Guid)

    Restores a media item from the recycle bin to a specified parent location.

    Declaration
    Task<Attempt<IMedia?, ContentEditingOperationStatus>> RestoreAsync(Guid key, Guid? parentKey, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to restore.

    Guid? parentKey

    The unique identifier of the parent to restore to, or null to restore to the root.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<IMedia, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the restored IMedia item (if successful) and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    SortAsync(Guid?, IEnumerable<SortingModel>, Guid)

    Sorts media items under a specified parent.

    Declaration
    Task<ContentEditingOperationStatus> SortAsync(Guid? parentKey, IEnumerable<SortingModel> sortingModels, Guid userKey)
    Parameters
    Type Name Description
    Guid? parentKey

    The unique identifier of the parent, or null for root-level sorting.

    IEnumerable<SortingModel> sortingModels

    The collection of SortingModel items defining the sort order.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<ContentEditingOperationStatus>

    A task that represents the asynchronous operation. The task result contains a ContentEditingOperationStatus indicating the operation outcome.

    View Source

    UpdateAsync(Guid, MediaUpdateModel, Guid)

    Updates an existing media item.

    Declaration
    Task<Attempt<MediaUpdateResult, ContentEditingOperationStatus>> UpdateAsync(Guid key, MediaUpdateModel updateModel, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to update.

    MediaUpdateModel updateModel

    The MediaUpdateModel containing the updated media data.

    Guid userKey

    The unique identifier of the user performing the operation.

    Returns
    Type Description
    Task<Attempt<MediaUpdateResult, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the MediaUpdateResult containing the updated media and ContentEditingOperationStatus indicating the operation outcome.

    View Source

    ValidateCreateAsync(MediaCreateModel)

    Validates a media creation model without persisting it.

    Declaration
    Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> ValidateCreateAsync(MediaCreateModel createModel)
    Parameters
    Type Name Description
    MediaCreateModel createModel

    The MediaCreateModel containing the media data to validate.

    Returns
    Type Description
    Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the ContentValidationResult and ContentEditingOperationStatus indicating the validation outcome.

    View Source

    ValidateUpdateAsync(Guid, MediaUpdateModel)

    Validates a media update model without persisting it.

    Declaration
    Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> ValidateUpdateAsync(Guid key, MediaUpdateModel updateModel)
    Parameters
    Type Name Description
    Guid key

    The unique identifier of the media item to validate the update for.

    MediaUpdateModel updateModel

    The MediaUpdateModel containing the updated media data to validate.

    Returns
    Type Description
    Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>>

    A task that represents the asynchronous operation. The task result contains an Attempt<TResult, TStatus> with the ContentValidationResult and ContentEditingOperationStatus indicating the validation outcome.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX