WebLinksModule

public class WebLinksModule

Provides Web Link management.

  • Get information about a specified web link.

    Declaration

    Swift

    public func get(
        webLinkId: String,
        fields: [String]? = nil,
        completion: @escaping Callback<WebLink>
    )

    Parameters

    webLinkId

    The ID of the web link on which to retrieve information.

    fields

    Comma-separated list of fields to include in the response.

    completion

    Returns a full web link object or an error.

  • Creates a new web link with the specified url on the specified item.

    Declaration

    Swift

    @available(*, deprecated, message: "Please use create(url:parentId:name:description:fields:completion:﹚'instead.")
    public func create(
        url: String,
        parentId: String,
        name: String? = nil,
        description: String? = nil,
        sharedLink _: NullableParameter<SharedLinkData>? = nil,
        fields: [String]? = nil,
        completion: @escaping Callback<WebLink>
    )

    Parameters

    url

    The specified url to create the web link for.

    parentId

    The id of the folder item that the web link lives in.

    name

    Optional name value for the created web link. If no name value is specified, defaults to url.

    description

    Optional description value for the created web link.

    sharedLink

    Shared links provide direct, read-only access to files or folder on Box using a URL.

    fields

    Comma-separated list of fields to include in the response.

    completion

    Returns a full web link object or an error.

  • Creates a new web link with the specified url on the specified item.

    Declaration

    Swift

    public func create(
        url: String,
        parentId: String,
        name: String? = nil,
        description: String? = nil,
        fields: [String]? = nil,
        completion: @escaping Callback<WebLink>
    )

    Parameters

    url

    The specified url to create the web link for.

    parentId

    The id of the folder item that the web link lives in.

    name

    Optional name value for the created web link. If no name value is specified, defaults to url.

    description

    Optional description value for the created web link.

    fields

    Comma-separated list of fields to include in the response.

    completion

    Returns a full web link object or an error.

  • Update the specified web link info.

    Declaration

    Swift

    public func update(
        webLinkId: String,
        url: String? = nil,
        parentId: String? = nil,
        name: String? = nil,
        description: String? = nil,
        sharedLink: NullableParameter<SharedLinkData>? = nil,
        fields: [String]? = nil,
        completion: @escaping Callback<WebLink>
    )

    Parameters

    webLinkId

    The id of the web link to update info for.

    url

    The new url for the web link to update to.

    parentId

    The id of the new parent folder to move the web link.

    name

    The new name for the web link to update to.

    description

    The new description for the web link to update to.

    sharedLink

    Shared links provide direct, read-only access to web link on Box using a URL. The canDownload which is inner property in sharedLink is not supported in web links.

    fields

    Comma-separated list of fields to include in the response.

    completion

    Returns the updated web link object or an error.

  • Delete a specified web link.

    Declaration

    Swift

    public func delete(
        webLinkId: String,
        completion: @escaping Callback<Void>
    )

    Parameters

    webLink

    The ID of the web link to delete.

    completion

    An empty response will be returned upon successful deletion.

  • Gets web link with updated shared link

    Declaration

    Swift

    public func getSharedLink(
        forWebLink webLinkId: String,
        completion: @escaping Callback<SharedLink>
    )

    Parameters

    webLinkId

    The ID of the web link

    completion

    Returns a standard shared link object or an error

  • Creates or updates shared link for a web link

    Declaration

    Swift

    @available(*, deprecated, message: "Please use setSharedLink(forWebLink:access:unsharedAt:vanityName:password:completion:﹚'instead.")
    public func setSharedLink(
        forWebLink webLinkId: String,
        access: SharedLinkAccess? = nil,
        unsharedAt: NullableParameter<Date>? = nil,
        vanityName: NullableParameter<String>? = nil,
        password: NullableParameter<String>? = nil,
        canDownload _: Bool? = nil,
        completion: @escaping Callback<SharedLink>
    )

    Parameters

    webLink

    The ID of the web link

    access

    The level of access. If you omit this field then the access level will be set to the default access level specified by the enterprise admin

    unsharedAt

    The date-time that this link will become disabled. This field can only be set by users with paid accounts

    vanityName

    The custom name of a shared link, as used in the vanityUrl field. It should be between 12 and 30 characters. This field can contains only letters, numbers, and hyphens.

    password

    The password required to access the shared link. Set to .null to remove the password

    canDownload

    Whether the shared link allows downloads. Applies to any items in the folder

    completion

    Returns a standard SharedLink object or an error

  • Creates or updates shared link for a web link

    Declaration

    Swift

    public func setSharedLink(
        forWebLink webLinkId: String,
        access: SharedLinkAccess? = nil,
        unsharedAt: NullableParameter<Date>? = nil,
        vanityName: NullableParameter<String>? = nil,
        password: NullableParameter<String>? = nil,
        completion: @escaping Callback<SharedLink>
    )

    Parameters

    webLink

    The ID of the web link

    access

    The level of access. If you omit this field then the access level will be set to the default access level specified by the enterprise admin

    unsharedAt

    The date-time that this link will become disabled. This field can only be set by users with paid accounts

    vanityName

    The custom name of a shared link, as used in the vanity_url field. It should be between 12 and 30 characters. This field can contains only letters, numbers, and hyphens.

    password

    The password required to access the shared link. Set to .null to remove the password

    completion

    Returns a standard SharedLink object or an error

  • Removes shared link for a web link

    Declaration

    Swift

    public func deleteSharedLink(
        forWebLink webLinkId: String,
        completion: @escaping Callback<Void>
    )

    Parameters

    webLinkId

    The ID of the web link

    completion

    Returns an empty response or an error