class

Polar::Api::Webhooks

Inherits Reference < Object

API client for webhooks operations

Constants

Log = ::Log.for(self)

Constructors

new(client : Client)

Creates a new Webhooks instance

@param client [Client] The Polar API client instance

Source

Instance methods

Create Webhook Endpoint

Create a webhook endpoint.

Scopes: webhooks:write

Endpoint: POST /v1/webhooks/endpoints

Parameters:

  • body (required): Request body as Polar::Models::WebhookEndpointCreate

Returns: Polar::Models::WebhookEndpoint

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
delete_webhook_endpoint(id : String)

Delete Webhook Endpoint

Delete a webhook endpoint.

Scopes: webhooks:write

Endpoint: DELETE /v1/webhooks/endpoints/{id}

Parameters:

  • id (required): The webhook endpoint ID.

Returns: JSON response string

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
get_webhook_endpoint(id : String) : Polar::Models::WebhookEndpoint

Get Webhook Endpoint

Get a webhook endpoint by ID.

Scopes: webhooks:read webhooks:write

Endpoint: GET /v1/webhooks/endpoints/{id}

Parameters:

  • id (required): The webhook endpoint ID.

Returns: Polar::Models::WebhookEndpoint

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
list_webhook_deliveries(endpoint_id : String | Nil = nil, start_timestamp : String | Nil = nil, end_timestamp : String | Nil = nil, page : Int32 | Nil = nil, limit : Int32 | Nil = nil) : Polar::Models::ListResource(Polar::Models::WebhookDelivery)

List Webhook Deliveries

List webhook deliveries.

Deliveries are all the attempts to deliver a webhook event to an endpoint.

Scopes: webhooks:read webhooks:write

Endpoint: GET /v1/webhooks/deliveries

Parameters:

  • endpoint_id (optional): Filter by webhook endpoint ID.
  • start_timestamp (optional): Filter deliveries after this timestamp.
  • end_timestamp (optional): Filter deliveries before this timestamp.
  • page (optional): Page number, defaults to 1.
  • limit (optional): Size of a page, defaults to 10. Maximum is 100.

Returns: Polar::Models::ListResource(Polar::Models::WebhookDelivery)

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
list_webhook_endpoints(organization_id : String | Nil = nil, page : Int32 | Nil = nil, limit : Int32 | Nil = nil) : Polar::Models::ListResource(Polar::Models::WebhookEndpoint)

List Webhook Endpoints

List webhook endpoints.

Scopes: webhooks:read webhooks:write

Endpoint: GET /v1/webhooks/endpoints

Parameters:

  • organization_id (optional): Filter by organization ID.
  • page (optional): Page number, defaults to 1.
  • limit (optional): Size of a page, defaults to 10. Maximum is 100.

Returns: Polar::Models::ListResource(Polar::Models::WebhookEndpoint)

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
redeliver_webhook_event(id : String)

Redeliver Webhook Event

Schedule the re-delivery of a webhook event.

Scopes: webhooks:write

Endpoint: POST /v1/webhooks/events/{id}/redeliver

Parameters:

  • id (required): The webhook event ID.

Returns: JSON response string

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source
reset_webhook_endpoint_secret(id : String) : Polar::Models::WebhookEndpoint

Reset Webhook Endpoint Secret

Regenerate a webhook endpoint secret.

Scopes: webhooks:write

Endpoint: PATCH /v1/webhooks/endpoints/{id}/secret

Parameters:

  • id (required): The webhook endpoint ID.

Returns: Polar::Models::WebhookEndpoint

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source

Update Webhook Endpoint

Update a webhook endpoint.

Scopes: webhooks:write

Endpoint: PATCH /v1/webhooks/endpoints/{id}

Parameters:

  • id (required): The webhook endpoint ID.
  • body (required): Request body as Polar::Models::WebhookEndpointUpdate

Returns: Polar::Models::WebhookEndpoint

Raises:

  • ResourceNotFoundError on 404
  • NotPermittedError on 403
  • HTTPValidationError on 422
  • PolarError on other errors
Source