WebhooksModule

public class WebhooksModule

Provides management of Webhooks

  • Get all webhooks in an enterprise.

    Declaration

    Swift

    public func list(
        marker: String? = nil,
        limit: Int? = nil,
        fields: [String]? = nil
    ) -> PagingIterator<Webhook>

    Parameters

    fields

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

  • Get information about a webhook.

    Declaration

    Swift

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

    Parameters

    webhookId

    The ID of the webhook on which to retrieve information.

    fields

    String array of fields to include in the response.

    completion

    Returns a Webhook response object if successful otherwise a BoxSDKError.

  • Update a webhook

    Declaration

    Swift

    public func update(
        webhookId: String,
        targetType: String? = nil,
        targetId: String? = nil,
        triggers: [Webhook.EventTriggers]? = nil,
        address: String? = nil,
        fields: [String]? = nil,
        completion: @escaping Callback<Webhook>
    )

    Parameters

    webhookId

    The ID of webhook to update

    targetType

    The type of box item that is associated with the webhook (i.e. file or folder)

    targetId

    The ID of the file or folder that is the target

    triggers

    String array of [triggers]

    address

    The notification URL to which Box sends messages when monitored events occur

    fields

    String array of fields to include in the response. Any attribute in the full comment objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a Webhook response object if successful otherwise a BoxSDKError.

  • Create a webhook

    Declaration

    Swift

    public func create(
        targetType: String,
        targetId: String,
        triggers: [Webhook.EventTriggers],
        address: String,
        fields: [String]? = nil,
        completion: @escaping Callback<Webhook>
    )

    Parameters

    targetType

    The type of box item associated with the webhook (i.e. file or folder)

    targetId

    The ID of the file or folder that is the target

    triggers

    String array of [triggers]

    address

    The notification URL to which Box sends messages when monitored events occur

    fields

    String array of fields to include in the response. Any attribute in the full comment objects can be passed in the fields parameter to get specific attributes.

    completion

    Returns a Webhook response object if successful otherwise a BoxSDKError.

  • Deletes a webhook.

    Declaration

    Swift

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

    Parameters

    webhookId

    The ID of the webhook to delete.

    completion

    Returns Void if the comment is deleted.