MetadataModule

public class MetadataModule

Defines methods for metadata management

  • Retrieve all metadata associated with a given file

    Declaration

    Swift

    func list(
        forFileId fileId: String,
        completion: @escaping Callback<[MetadataObject]>
    )

    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 get(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        completion: @escaping Callback<MetadataObject>
    )

    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 create(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        keys: [String: Any],
        completion: @escaping Callback<MetadataObject>
    )

    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 update(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        operations: [FileMetadataOperation],
        completion: @escaping Callback<MetadataObject>
    )

    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 delete(
        forFileWithId fileId: String,
        scope: String,
        templateKey: String,
        completion: @escaping Callback<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 list(
        forFolderId folderId: String,
        completion: @escaping Callback<[MetadataObject]>
    )

    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 get(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        completion: @escaping Callback<MetadataObject>
    )

    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 create(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        keys: [String: Any],
        completion: @escaping Callback<MetadataObject>
    )

    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 update(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        operations: [FolderMetadataOperation],
        completion: @escaping Callback<MetadataObject>
    )

    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 delete(
        forFolderWithId folderId: String,
        scope: String,
        templateKey: String,
        completion: @escaping Callback<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 getTemplateByKey(
        scope: String,
        templateKey: String,
        completion: @escaping Callback<MetadataTemplate>
    )

    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 getTemplateById(
        id: String,
        completion: @escaping Callback<MetadataTemplate>
    )

    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 createTemplate(
        scope: String,
        templateKey: String,
        displayName: String,
        hidden: Bool,
        copyInstanceOnItemCopy: Bool? = nil,
        fields: [MetadataField],
        completion: @escaping Callback<MetadataTemplate>
    )

    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.

    copyInstanceOnItemCopy

    Whether to copy any metadata attached to a file or folder when it is copied. 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 updateTemplate(
        scope: String,
        templateKey: String,
        operation: MetadataTemplateOperation,
        completion: @escaping Callback<MetadataTemplate>
    )

    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 deleteTemplate(
        scope: String,
        templateKey: String,
        completion: @escaping Callback<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 listEnterpriseTemplates(
        scope: String,
        marker: String? = nil,
        limit: Int? = nil
    ) -> PagingIterator<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.