MetadataModule

public class MetadataModule

Defines methods for metadata management

  • Retrieve all metadata associated with a given file

    Declaration

    Swift

    func getAllMetadata(
        forFileId fileId: String,
        completion: @escaping (Result<[MetadataObject], BoxError>) -> Void
    )

    Parameters

    fileId

    The scope of metadata template - possible values are global or enterprise_{id}

    completion

    Returns an array of metadata objects for particular file or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Get the metadata instance for a file.

    Declaration

    Swift

    func getMetadata(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        completion: @escaping (Result<MetadataObject, BoxError>) -> Void
    )

    Parameters

    fileId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns an array of metadata objects for particular file or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Create a metadata instance for a file.

    Declaration

    Swift

    func createMetadata(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        keys: [String: Any],
        completion: @escaping (Result<MetadataObject, BoxError>) -> Void
    )

    Parameters

    fileId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns an array of metadata objects for particular file or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Update a metadata instance for a file.

    Declaration

    Swift

    func updateMetadata(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        operations: [FileMetadataOperation],
        completion: @escaping (Result<MetadataObject, BoxError>) -> Void
    )

    Parameters

    fileId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns an array of metadata objects for particular file or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Delete a metadata instance for a file.

    Declaration

    Swift

    func deleteMetadata(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        completion: @escaping (Result<Void, BoxError>) -> Void
    )

    Parameters

    fileId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    completion

    Returns success or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Retrieve all metadata associated with a given folder

    Declaration

    Swift

    func getAllMetadata(
        forFolderId folderId: String,
        completion: @escaping (Result<[MetadataObject], BoxError>) -> Void
    )

    Parameters

    folderId

    The scope of metadata template - possible values are global or enterprise_{id}

    completion

    Returns an array of metadata objects for particular folder or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Get the metadata instance for a folder.

    Declaration

    Swift

    func getMetadata(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        completion: @escaping (Result<MetadataObject, BoxError>) -> Void
    )

    Parameters

    folderId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns an array of metadata objects for particular folder or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Create a metadata instance for a folder.

    Declaration

    Swift

    func createMetadata(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        keys: [String: Any],
        completion: @escaping (Result<MetadataObject, BoxError>) -> Void
    )

    Parameters

    folderId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns an array of metadata objects for particular folder or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Update a metadata instance for a folder.

    Declaration

    Swift

    func updateMetadata(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        operations: [FolderMetadataOperation],
        completion: @escaping (Result<MetadataObject, BoxError>) -> Void
    )

    Parameters

    folderId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns an array of metadata objects for particular folder or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Delete a metadata instance for a folder.

    Declaration

    Swift

    func deleteMetadata(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        completion: @escaping (Result<Void, BoxError>) -> Void
    )

    Parameters

    folderId

    The scope of metadata template - possible values are global or enterprise_{id}

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    completion

    Returns success or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Get metadata template by name (templateKey).

    Declaration

    Swift

    func getMetadataTemplate(
        scope: String,
        templateKey: String,
        completion: @escaping (Result<MetadataTemplate, BoxError>) -> Void
    )

    Parameters

    scope

    The scope of metadata template - possible values are global or enterprise_{id}

    templateKey

    A unique identifier for the template.

    completion

    Returns a metadata template info or an error if the scope or templateKey are invalid or the user doesn’t have access to the template.

  • Get metadata template by ID.

    Declaration

    Swift

    func getMetadataTemplate(
        id: String,
        completion: @escaping (Result<MetadataTemplate, BoxError>) -> Void
    )

    Parameters

    id

    The identifier of template

    completion

    Returns a metadata template info or an error if ID is invalid or the user doesn’t have access to the template.

  • Create metadata template.

    Declaration

    Swift

    func createMetadataTemplate(
        scope: String,
        templateKey: String,
        displayName: String,
        hidden: Bool,
        fields: [MetadataField],
        completion: @escaping (Result<MetadataTemplate, BoxError>) -> Void
    )

    Parameters

    scope

    The scope of the object. Only the enterprise scope is supported.

    templateKey

    A unique identifier for the template.

    displayName

    The display name of the template.

    hidden

    Whether this template is hidden in the UI. Defaults to false.

    fields

    Definition of fields for this metadata template.

    completion

    Returns success or an error if template is invalid or the user doesn’t have access to the file.

  • Update metadata template.

    Declaration

    Swift

    func updateMetadataTemplate(
        scope: String,
        templateKey: String,
        operation: MetadataTemplateOperation,
        completion: @escaping (Result<MetadataTemplate, BoxError>) -> Void
    )

    Parameters

    scope

    The scope of the object. Only the enterprise scope is supported.

    templateKey

    A unique identifier for the template.

    operation

    Description of operation on template. See template update operations.

    completion

    Returns success or an error if template is invalid or the user doesn’t have access to the file.

  • Delete metadata template.

    Declaration

    Swift

    func deleteMetadataTemplate(
        scope: String,
        templateKey: String,
        completion: @escaping (Result<Void, BoxError>) -> Void
    )

    Parameters

    scope

    The scope of the object.

    templateKey

    Metadata template object

    completion

    Returns success or an error if template is invalid or the user doesn’t have access to the file.

  • Retrieve all metadata templates within the specified enterprise

    Declaration

    Swift

    func getEnterpriseTemplates(
        scope: String,
        marker: String? = nil,
        limit: Int? = nil
    ) -> MarkerPaginationIterator<MetadataTemplate>

    Parameters

    scope

    The scope of the object. Only the enterprise scope is supported.

    marker

    The position marker at which to begin the response. See marker-based paging for details.

    limit

    The maximum number of items to return. The default is 100 and the maximum is 1,000.