WebhookClient

public class WebhookClient

An iOS client wrapper of the Cisco Spark Webhooks REST API .

Since

1.2.0
  • Lists all webhooks of the authenticated user.

    Since

    1.2.0

    Declaration

    Swift

    public func list(max: Int? = nil, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<[Webhook]>) -> Void)

    Parameters

    max

    The maximum number of webhooks in the response.

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

    A closure to be executed once the request has finished.

    Return Value

    Void

  • Posts a webhook for the authenticated user.

    Since

    1.2.0

    Declaration

    Swift

    public func create(name: String, targetUrl: String, resource: String, event: String, filter: String? = nil, secret: String? = nil, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Webhook>) -> Void)

    Parameters

    name

    A user-friendly name for this webhook.

    targetUrl

    The URL that receives POST requests for each event.

    resource

    The resource type for the webhook.

    event

    The event type for the webhook.

    filter

    The filter that defines the webhook scope.

    secet

    Secret use to generate payload signiture

    queue

    The queue on which the completion handler is dispatched.

    secet

    Secret use to generate payload signiture

    completionHandler

    A closure to be executed once the request has finished.

    Return Value

    Void

  • Retrieves the details for a webhook by id.

    Since

    1.2.0

    Declaration

    Swift

    public func get(webhookId: String, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Webhook>) -> Void)

    Parameters

    webhookId

    The identifier of the webhook.

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

    A closure to be executed once the request has finished.

    Return Value

    Void

  • Updates a webhook by id.

    Since

    1.4.0

    Declaration

    Swift

    public func update(webhookId: String, name: String, targetUrl: String,  secret: String? = nil, status: String? = nil, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Webhook>) -> Void)

    Parameters

    webhookId

    The identifier of the webhook.

    name

    A user-friendly name for this webhook.

    targetUrl

    The URL that receives POST requests for each event.

    status

    The status of the webhook. Use active to reactivate a disabled webhook.

    secret

    The secret used to generate payload signature.

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

    A closure to be executed once the request has finished.

    Return Value

    Void

  • Deletes a webhook by id.

    Since

    1.2.0

    Declaration

    Swift

    public func delete(webhookId: String, queue: DispatchQueue? = nil, completionHandler: @escaping (ServiceResponse<Any>) -> Void)

    Parameters

    webhookId

    The identifier of the webhook.

    queue

    The queue on which the completion handler is dispatched.

    completionHandler

    A closure to be executed once the request has finished.

    webhookId

    The identifier of the webhook.

    Return Value

    Void