StorageCategoryBehavior

public protocol StorageCategoryBehavior

Behavior of the Storage category used though Amplify.Storage.*. Plugin implementations conform to this protocol indirectly though the StorageCategoryPlugin protocol.

  • Tag: StorageCategoryBehavior
  • getURL(key:options:) Asynchronous

    Retrieve the remote URL for the object from storage.

    • Tag: StorageCategoryBehavior.getURL

    Declaration

    Swift

    @discardableResult
    func getURL(key: String,
                options: StorageGetURLOperation.Request.Options?) async throws -> URL

    Parameters

    key

    The unique identifier for the object in storage.

    options

    Parameters to specific plugin behavior

    Return Value

    requested Get URL

  • Retrieve the object from storage into memory.

    • Tag: StorageCategoryBehavior.downloadData

    Declaration

    Swift

    @discardableResult
    func downloadData(key: String,
                      options: StorageDownloadDataOperation.Request.Options?) -> StorageDownloadDataTask

    Parameters

    key

    The unique identifier for the object in storage

    options

    Options to adjust the behavior of this request, including plugin-options

    Return Value

    A task that provides progress updates and the key which was used to download

  • Download to file the object from storage.

    • Tag: StorageCategoryBehavior.downloadFile

    Declaration

    Swift

    @discardableResult
    func downloadFile(key: String,
                      local: URL,
                      options: StorageDownloadFileOperation.Request.Options?) -> StorageDownloadFileTask

    Parameters

    key

    The unique identifier for the object in storage.

    local

    The local file to download destination

    options

    Parameters to specific plugin behavior

    Return Value

    A task that provides progress updates and the key which was used to download

  • Upload data to storage

    • Tag: StorageCategoryBehavior.uploadData

    Declaration

    Swift

    @discardableResult
    func uploadData(key: String,
                    data: Data,
                    options: StorageUploadDataOperation.Request.Options?) -> StorageUploadDataTask

    Parameters

    key

    The unique identifier of the object in storage.

    data

    The data in memory to be uploaded

    options

    Parameters to specific plugin behavior

    Return Value

    A task that provides progress updates and the key which was used to upload

  • Upload local file to storage

    • Tag: StorageCategoryBehavior.uploadFile

    Declaration

    Swift

    @discardableResult
    func uploadFile(key: String,
                    local: URL,
                    options: StorageUploadFileOperation.Request.Options?) -> StorageUploadFileTask

    Parameters

    key

    The unique identifier of the object in storage.

    local

    The path to a local file.

    options

    Parameters to specific plugin behavior

    Return Value

    A task that provides progress updates and the key which was used to upload

  • remove(key:options:) Asynchronous

    Delete object from storage

    • Tag: StorageCategoryBehavior.remove

    Declaration

    Swift

    @discardableResult
    func remove(key: String,
                options: StorageRemoveOperation.Request.Options?) async throws -> String

    Parameters

    key

    The unique identifier of the object in storage.

    options

    Parameters to specific plugin behavior

    Return Value

    An operation object that provides notifications and actions related to the execution of the work

  • list(options:) Asynchronous

    List the object identifiers under the hierarchy specified by the path, relative to access level, from storage

    • Tag: StorageCategoryBehavior.list

    Declaration

    Swift

    @discardableResult
    func list(options: StorageListOperation.Request.Options?) async throws -> StorageListResult

    Parameters

    options

    Parameters to specific plugin behavior

    resultListener

    Triggered when the list is complete

    Return Value

    An operation object that provides notifications and actions related to the execution of the work

  • Handles background events which are related to URLSession

    • Tag: StorageCategoryBehavior.handleBackgroundEvents

    Declaration

    Swift

    func handleBackgroundEvents(identifier: String) async -> Bool

    Parameters

    identifier

    identifier

    Return Value

    returns true if the identifier is handled by Amplify