@polar-sh/sdk 1.0.0-alpha.12 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/2026-04/index.d.cts +36 -36
- package/dist/2026-04/index.d.mts +36 -36
- package/dist/2026-04/services/benefit_grants.cjs +3 -3
- package/dist/2026-04/services/benefit_grants.cjs.map +1 -1
- package/dist/2026-04/services/benefit_grants.d.cts +3 -3
- package/dist/2026-04/services/benefit_grants.d.mts +3 -3
- package/dist/2026-04/services/benefit_grants.mjs +3 -3
- package/dist/2026-04/services/benefit_grants.mjs.map +1 -1
- package/dist/2026-04/services/benefits.cjs +6 -6
- package/dist/2026-04/services/benefits.cjs.map +1 -1
- package/dist/2026-04/services/benefits.d.cts +5 -5
- package/dist/2026-04/services/benefits.d.mts +5 -5
- package/dist/2026-04/services/benefits.mjs +5 -5
- package/dist/2026-04/services/benefits.mjs.map +1 -1
- package/dist/2026-04/services/checkout_links.cjs +3 -3
- package/dist/2026-04/services/checkout_links.cjs.map +1 -1
- package/dist/2026-04/services/checkout_links.d.cts +3 -3
- package/dist/2026-04/services/checkout_links.d.mts +3 -3
- package/dist/2026-04/services/checkout_links.mjs +3 -3
- package/dist/2026-04/services/checkout_links.mjs.map +1 -1
- package/dist/2026-04/services/checkouts.cjs +3 -3
- package/dist/2026-04/services/checkouts.cjs.map +1 -1
- package/dist/2026-04/services/checkouts.d.cts +3 -3
- package/dist/2026-04/services/checkouts.d.mts +3 -3
- package/dist/2026-04/services/checkouts.mjs +3 -3
- package/dist/2026-04/services/checkouts.mjs.map +1 -1
- package/dist/2026-04/services/custom_fields.cjs +3 -3
- package/dist/2026-04/services/custom_fields.cjs.map +1 -1
- package/dist/2026-04/services/custom_fields.d.cts +3 -3
- package/dist/2026-04/services/custom_fields.d.mts +3 -3
- package/dist/2026-04/services/custom_fields.mjs +3 -3
- package/dist/2026-04/services/custom_fields.mjs.map +1 -1
- package/dist/2026-04/services/customer_meters.cjs +3 -3
- package/dist/2026-04/services/customer_meters.cjs.map +1 -1
- package/dist/2026-04/services/customer_meters.d.cts +3 -3
- package/dist/2026-04/services/customer_meters.d.mts +3 -3
- package/dist/2026-04/services/customer_meters.mjs +3 -3
- package/dist/2026-04/services/customer_meters.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/benefit_grants.cjs +3 -3
- package/dist/2026-04/services/customer_portal/benefit_grants.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/benefit_grants.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/benefit_grants.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/benefit_grants.mjs +3 -3
- package/dist/2026-04/services/customer_portal/benefit_grants.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/customer_meters.cjs +3 -3
- package/dist/2026-04/services/customer_portal/customer_meters.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/customer_meters.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/customer_meters.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/customer_meters.mjs +3 -3
- package/dist/2026-04/services/customer_portal/customer_meters.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/customers.cjs +3 -3
- package/dist/2026-04/services/customer_portal/customers.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/customers.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/customers.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/customers.mjs +3 -3
- package/dist/2026-04/services/customer_portal/customers.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/downloadables.cjs +3 -3
- package/dist/2026-04/services/customer_portal/downloadables.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/downloadables.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/downloadables.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/downloadables.mjs +3 -3
- package/dist/2026-04/services/customer_portal/downloadables.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/index.d.cts +10 -10
- package/dist/2026-04/services/customer_portal/index.d.mts +10 -10
- package/dist/2026-04/services/customer_portal/license_keys.cjs +3 -3
- package/dist/2026-04/services/customer_portal/license_keys.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/license_keys.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/license_keys.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/license_keys.mjs +3 -3
- package/dist/2026-04/services/customer_portal/license_keys.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/members.cjs +3 -3
- package/dist/2026-04/services/customer_portal/members.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/members.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/members.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/members.mjs +3 -3
- package/dist/2026-04/services/customer_portal/members.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/orders.cjs +3 -3
- package/dist/2026-04/services/customer_portal/orders.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/orders.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/orders.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/orders.mjs +3 -3
- package/dist/2026-04/services/customer_portal/orders.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/seats.cjs +3 -3
- package/dist/2026-04/services/customer_portal/seats.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/seats.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/seats.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/seats.mjs +3 -3
- package/dist/2026-04/services/customer_portal/seats.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/subscriptions.cjs +3 -3
- package/dist/2026-04/services/customer_portal/subscriptions.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/subscriptions.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/subscriptions.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/subscriptions.mjs +3 -3
- package/dist/2026-04/services/customer_portal/subscriptions.mjs.map +1 -1
- package/dist/2026-04/services/customer_portal/wallets.cjs +3 -3
- package/dist/2026-04/services/customer_portal/wallets.cjs.map +1 -1
- package/dist/2026-04/services/customer_portal/wallets.d.cts +3 -3
- package/dist/2026-04/services/customer_portal/wallets.d.mts +3 -3
- package/dist/2026-04/services/customer_portal/wallets.mjs +3 -3
- package/dist/2026-04/services/customer_portal/wallets.mjs.map +1 -1
- package/dist/2026-04/services/customers/index.cjs +9 -9
- package/dist/2026-04/services/customers/index.cjs.map +1 -1
- package/dist/2026-04/services/customers/index.d.cts +7 -7
- package/dist/2026-04/services/customers/index.d.mts +7 -7
- package/dist/2026-04/services/customers/index.mjs +7 -7
- package/dist/2026-04/services/customers/index.mjs.map +1 -1
- package/dist/2026-04/services/discounts.cjs +3 -3
- package/dist/2026-04/services/discounts.cjs.map +1 -1
- package/dist/2026-04/services/discounts.d.cts +3 -3
- package/dist/2026-04/services/discounts.d.mts +3 -3
- package/dist/2026-04/services/discounts.mjs +3 -3
- package/dist/2026-04/services/discounts.mjs.map +1 -1
- package/dist/2026-04/services/disputes.cjs +3 -3
- package/dist/2026-04/services/disputes.cjs.map +1 -1
- package/dist/2026-04/services/disputes.d.cts +3 -3
- package/dist/2026-04/services/disputes.d.mts +3 -3
- package/dist/2026-04/services/disputes.mjs +3 -3
- package/dist/2026-04/services/disputes.mjs.map +1 -1
- package/dist/2026-04/services/event_types.cjs +3 -3
- package/dist/2026-04/services/event_types.cjs.map +1 -1
- package/dist/2026-04/services/event_types.d.cts +3 -3
- package/dist/2026-04/services/event_types.d.mts +3 -3
- package/dist/2026-04/services/event_types.mjs +3 -3
- package/dist/2026-04/services/event_types.mjs.map +1 -1
- package/dist/2026-04/services/events.cjs +3 -3
- package/dist/2026-04/services/events.cjs.map +1 -1
- package/dist/2026-04/services/events.d.cts +3 -3
- package/dist/2026-04/services/events.d.mts +3 -3
- package/dist/2026-04/services/events.mjs +3 -3
- package/dist/2026-04/services/events.mjs.map +1 -1
- package/dist/2026-04/services/files.cjs +3 -3
- package/dist/2026-04/services/files.cjs.map +1 -1
- package/dist/2026-04/services/files.d.cts +3 -3
- package/dist/2026-04/services/files.d.mts +3 -3
- package/dist/2026-04/services/files.mjs +3 -3
- package/dist/2026-04/services/files.mjs.map +1 -1
- package/dist/2026-04/services/license_keys.cjs +3 -3
- package/dist/2026-04/services/license_keys.cjs.map +1 -1
- package/dist/2026-04/services/license_keys.d.cts +3 -3
- package/dist/2026-04/services/license_keys.d.mts +3 -3
- package/dist/2026-04/services/license_keys.mjs +3 -3
- package/dist/2026-04/services/license_keys.mjs.map +1 -1
- package/dist/2026-04/services/members.cjs +3 -3
- package/dist/2026-04/services/members.cjs.map +1 -1
- package/dist/2026-04/services/members.d.cts +3 -3
- package/dist/2026-04/services/members.d.mts +3 -3
- package/dist/2026-04/services/members.mjs +3 -3
- package/dist/2026-04/services/members.mjs.map +1 -1
- package/dist/2026-04/services/meters.cjs +3 -3
- package/dist/2026-04/services/meters.cjs.map +1 -1
- package/dist/2026-04/services/meters.d.cts +3 -3
- package/dist/2026-04/services/meters.d.mts +3 -3
- package/dist/2026-04/services/meters.mjs +3 -3
- package/dist/2026-04/services/meters.mjs.map +1 -1
- package/dist/2026-04/services/orders.cjs +3 -3
- package/dist/2026-04/services/orders.cjs.map +1 -1
- package/dist/2026-04/services/orders.d.cts +3 -3
- package/dist/2026-04/services/orders.d.mts +3 -3
- package/dist/2026-04/services/orders.mjs +3 -3
- package/dist/2026-04/services/orders.mjs.map +1 -1
- package/dist/2026-04/services/organizations.cjs +3 -3
- package/dist/2026-04/services/organizations.cjs.map +1 -1
- package/dist/2026-04/services/organizations.d.cts +3 -3
- package/dist/2026-04/services/organizations.d.mts +3 -3
- package/dist/2026-04/services/organizations.mjs +3 -3
- package/dist/2026-04/services/organizations.mjs.map +1 -1
- package/dist/2026-04/services/payments.cjs +3 -3
- package/dist/2026-04/services/payments.cjs.map +1 -1
- package/dist/2026-04/services/payments.d.cts +3 -3
- package/dist/2026-04/services/payments.d.mts +3 -3
- package/dist/2026-04/services/payments.mjs +3 -3
- package/dist/2026-04/services/payments.mjs.map +1 -1
- package/dist/2026-04/services/products.cjs +3 -3
- package/dist/2026-04/services/products.cjs.map +1 -1
- package/dist/2026-04/services/products.d.cts +3 -3
- package/dist/2026-04/services/products.d.mts +3 -3
- package/dist/2026-04/services/products.mjs +3 -3
- package/dist/2026-04/services/products.mjs.map +1 -1
- package/dist/2026-04/services/refunds.cjs +3 -3
- package/dist/2026-04/services/refunds.cjs.map +1 -1
- package/dist/2026-04/services/refunds.d.cts +3 -3
- package/dist/2026-04/services/refunds.d.mts +3 -3
- package/dist/2026-04/services/refunds.mjs +3 -3
- package/dist/2026-04/services/refunds.mjs.map +1 -1
- package/dist/2026-04/services/subscriptions.cjs +3 -3
- package/dist/2026-04/services/subscriptions.cjs.map +1 -1
- package/dist/2026-04/services/subscriptions.d.cts +3 -3
- package/dist/2026-04/services/subscriptions.d.mts +3 -3
- package/dist/2026-04/services/subscriptions.mjs +3 -3
- package/dist/2026-04/services/subscriptions.mjs.map +1 -1
- package/dist/2026-04/services/webhooks.cjs +6 -6
- package/dist/2026-04/services/webhooks.cjs.map +1 -1
- package/dist/2026-04/services/webhooks.d.cts +5 -5
- package/dist/2026-04/services/webhooks.d.mts +5 -5
- package/dist/2026-04/services/webhooks.mjs +5 -5
- package/dist/2026-04/services/webhooks.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -38,7 +38,7 @@ const listWebhookEndpointsWebhooks = (client) => {
|
|
|
38
38
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
39
39
|
* @throws {HTTPValidationError} Validation Error
|
|
40
40
|
*/
|
|
41
|
-
const
|
|
41
|
+
const iterListWebhookEndpointsWebhooks = (client) => {
|
|
42
42
|
return async function* (query) {
|
|
43
43
|
let page;
|
|
44
44
|
page = query?.page ?? 1;
|
|
@@ -219,7 +219,7 @@ const listWebhookDeliveriesWebhooks = (client) => {
|
|
|
219
219
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
220
220
|
* @throws {HTTPValidationError} Validation Error
|
|
221
221
|
*/
|
|
222
|
-
const
|
|
222
|
+
const iterListWebhookDeliveriesWebhooks = (client) => {
|
|
223
223
|
return async function* (query) {
|
|
224
224
|
let page;
|
|
225
225
|
page = query?.page ?? 1;
|
|
@@ -271,8 +271,8 @@ function createWebhooksService(client) {
|
|
|
271
271
|
resetWebhookEndpointSecret: resetWebhookEndpointSecretWebhooks(client),
|
|
272
272
|
listWebhookDeliveries: listWebhookDeliveriesWebhooks(client),
|
|
273
273
|
redeliverWebhookEvent: redeliverWebhookEventWebhooks(client),
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
iterListWebhookEndpoints: iterListWebhookEndpointsWebhooks(client),
|
|
275
|
+
iterListWebhookDeliveries: iterListWebhookDeliveriesWebhooks(client)
|
|
276
276
|
};
|
|
277
277
|
}
|
|
278
278
|
//#endregion
|
|
@@ -280,8 +280,8 @@ exports.createWebhookEndpointWebhooks = createWebhookEndpointWebhooks;
|
|
|
280
280
|
exports.createWebhooksService = createWebhooksService;
|
|
281
281
|
exports.deleteWebhookEndpointWebhooks = deleteWebhookEndpointWebhooks;
|
|
282
282
|
exports.getWebhookEndpointWebhooks = getWebhookEndpointWebhooks;
|
|
283
|
-
exports.
|
|
284
|
-
exports.
|
|
283
|
+
exports.iterListWebhookDeliveriesWebhooks = iterListWebhookDeliveriesWebhooks;
|
|
284
|
+
exports.iterListWebhookEndpointsWebhooks = iterListWebhookEndpointsWebhooks;
|
|
285
285
|
exports.listWebhookDeliveriesWebhooks = listWebhookDeliveriesWebhooks;
|
|
286
286
|
exports.listWebhookEndpointsWebhooks = listWebhookEndpointsWebhooks;
|
|
287
287
|
exports.redeliverWebhookEventWebhooks = redeliverWebhookEventWebhooks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.cjs","names":["HTTPValidationError","ResourceNotFound"],"sources":["../../../src/2026-04/services/webhooks.ts"],"sourcesContent":["import type { ClientBase } from \"../../base\";\nimport type {\n ListResourceWebhookDelivery,\n ListResourceWebhookEndpoint,\n WebhookDelivery,\n WebhookEndpoint,\n WebhookEndpointCreate,\n WebhookEndpointUpdate,\n WebhookEventType,\n} from \"../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../errors\";\n\nexport const listWebhookEndpointsWebhooks = (client: ClientBase) => {\n /**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookEndpoint>} A generator that yields items of type WebhookEndpoint.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistWebhookEndpointsWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookEndpoint> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookEndpointsWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const createWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Create a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: WebhookEndpointCreate): Promise<WebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const getWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Get a webhook endpoint by ID.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Delete a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {void}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<void>(response, \"none\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Update a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: WebhookEndpointUpdate): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resetWebhookEndpointSecretWebhooks = (client: ClientBase) => {\n /**\n * Regenerate a webhook endpoint secret.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}/secret\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listWebhookDeliveriesWebhooks = (client: ClientBase) => {\n /**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookDelivery}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookDelivery> => {\n const pathParams = {};\n const queryParams = {\n endpoint_id: query?.endpoint_id,\n start_timestamp: query?.start_timestamp,\n end_timestamp: query?.end_timestamp,\n succeeded: query?.succeeded,\n query: query?.query,\n http_code_class: query?.http_code_class,\n event_type: query?.event_type,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/deliveries\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookDelivery>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookDelivery>} A generator that yields items of type WebhookDelivery.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistWebhookDeliveriesWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookDelivery> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookDeliveriesWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const redeliverWebhookEventWebhooks = (client: ClientBase) => {\n /**\n * Schedule the re-delivery of a webhook event.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook event ID.\n * @returns {unknown}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook event not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<unknown> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/events/{id}/redeliver\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<unknown>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createWebhooksService(client: ClientBase) {\n return {\n listWebhookEndpoints: listWebhookEndpointsWebhooks(client),\n createWebhookEndpoint: createWebhookEndpointWebhooks(client),\n getWebhookEndpoint: getWebhookEndpointWebhooks(client),\n deleteWebhookEndpoint: deleteWebhookEndpointWebhooks(client),\n updateWebhookEndpoint: updateWebhookEndpointWebhooks(client),\n resetWebhookEndpointSecret: resetWebhookEndpointSecretWebhooks(client),\n listWebhookDeliveries: listWebhookDeliveriesWebhooks(client),\n redeliverWebhookEvent: redeliverWebhookEventWebhooks(client),\n iterlistWebhookEndpoints: iterlistWebhookEndpointsWebhooks(client),\n iterlistWebhookDeliveries: iterlistWebhookDeliveriesWebhooks(client),\n };\n}\n\nexport type Webhooks = ReturnType<typeof createWebhooksService>;\n"],"mappings":";;;AAaA,MAAa,gCAAgC,WAAuB;;;;;;;;;;;;;CAalE,OAAO,OAAO,UAI8B;EAC1C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;EACzB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,0BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA2C,UAAU,QAAQ,EACzE,KAAKA,eAAAA,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,oCAAoC,WAAuB;CACtE,OAAO,iBAAiB,OAIY;EAClC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,6BAA6B,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACrF,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AACA,MAAa,iCAAiC,WAAuB;;;;;;;;;;;;;CAanE,OAAO,OAAO,SAA0D;EAGtE,MAAM,UAAU,OAAO,aACrB,QACA,0BACA,CAAS,GACT,CAAU,GACV,IACF;EACA,MAAM,WAAW,MAA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AsB,QAAoB;CACxD,OAAO;EACL,sBAAsB,6BAA6B,MAAM;EACzD,uBAAuB,8BAA8B,MAAM;EAC3D,oBAAoB,2BAA2B,MAAM;EACrD,uBAAuB,8BAA8B,MAAM;EAC3D,uBAAuB,8BAA8B,MAAM;EAC3D,4BAA4B,mCAAmC,MAAM;EACrE,uBAAuB,8BAA8B,MAAM;EAC3D,uBAAuB,8BAA8B,MAAM;EAC3D,0BAA0B,iCAAiC,MAAM;EACjE,2BAA2B,kCAAkC,MAAM;CACrE;AACF"}
|
|
1
|
+
{"version":3,"file":"webhooks.cjs","names":["HTTPValidationError","ResourceNotFound"],"sources":["../../../src/2026-04/services/webhooks.ts"],"sourcesContent":["import type { ClientBase } from \"../../base\";\nimport type {\n ListResourceWebhookDelivery,\n ListResourceWebhookEndpoint,\n WebhookDelivery,\n WebhookEndpoint,\n WebhookEndpointCreate,\n WebhookEndpointUpdate,\n WebhookEventType,\n} from \"../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../errors\";\n\nexport const listWebhookEndpointsWebhooks = (client: ClientBase) => {\n /**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookEndpoint>} A generator that yields items of type WebhookEndpoint.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListWebhookEndpointsWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookEndpoint> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookEndpointsWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const createWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Create a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: WebhookEndpointCreate): Promise<WebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const getWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Get a webhook endpoint by ID.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Delete a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {void}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<void>(response, \"none\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Update a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: WebhookEndpointUpdate): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resetWebhookEndpointSecretWebhooks = (client: ClientBase) => {\n /**\n * Regenerate a webhook endpoint secret.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}/secret\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listWebhookDeliveriesWebhooks = (client: ClientBase) => {\n /**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookDelivery}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookDelivery> => {\n const pathParams = {};\n const queryParams = {\n endpoint_id: query?.endpoint_id,\n start_timestamp: query?.start_timestamp,\n end_timestamp: query?.end_timestamp,\n succeeded: query?.succeeded,\n query: query?.query,\n http_code_class: query?.http_code_class,\n event_type: query?.event_type,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/deliveries\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookDelivery>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookDelivery>} A generator that yields items of type WebhookDelivery.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListWebhookDeliveriesWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookDelivery> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookDeliveriesWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const redeliverWebhookEventWebhooks = (client: ClientBase) => {\n /**\n * Schedule the re-delivery of a webhook event.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook event ID.\n * @returns {unknown}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook event not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<unknown> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/events/{id}/redeliver\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<unknown>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createWebhooksService(client: ClientBase) {\n return {\n listWebhookEndpoints: listWebhookEndpointsWebhooks(client),\n createWebhookEndpoint: createWebhookEndpointWebhooks(client),\n getWebhookEndpoint: getWebhookEndpointWebhooks(client),\n deleteWebhookEndpoint: deleteWebhookEndpointWebhooks(client),\n updateWebhookEndpoint: updateWebhookEndpointWebhooks(client),\n resetWebhookEndpointSecret: resetWebhookEndpointSecretWebhooks(client),\n listWebhookDeliveries: listWebhookDeliveriesWebhooks(client),\n redeliverWebhookEvent: redeliverWebhookEventWebhooks(client),\n iterListWebhookEndpoints: iterListWebhookEndpointsWebhooks(client),\n iterListWebhookDeliveries: iterListWebhookDeliveriesWebhooks(client),\n };\n}\n\nexport type Webhooks = ReturnType<typeof createWebhooksService>;\n"],"mappings":";;;AAaA,MAAa,gCAAgC,WAAuB;;;;;;;;;;;;;CAalE,OAAO,OAAO,UAI8B;EAC1C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;EACzB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,0BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA2C,UAAU,QAAQ,EACzE,KAAKA,eAAAA,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,oCAAoC,WAAuB;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E,GAAG;IAAO;IAAM;GAAM,CAAC;GACtF,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AACA,MAAa,iCAAiC,WAAuB;;;;;;;;;;;;;;CAcnE,OAAO,OAAO,OAAiC;EAC7C,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,QACA,sCACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAuB,UAAU,QAAQ;GACrD,KAAKC,eAAAA;GACL,KAAKD,eAAAA;EACP,CAAC;CACH;AACF;AAEA,SAAgB,sBAAsB,QAAoB;CACxD,OAAO;EACL,sBAAsB,6BAA6B,MAAM;EACzD,uBAAuB,8BAA8B,MAAM;EAC3D,oBAAoB,2BAA2B,MAAM;EACrD,uBAAuB,8BAA8B,MAAM;EAC3D,uBAAuB,8BAA8B,MAAM;EAC3D,4BAA4B,mCAAmC,MAAM;EACrE,uBAAuB,8BAA8B,MAAM;EAC3D,uBAAuB,8BAA8B,MAAM;EAC3D,0BAA0B,iCAAiC,MAAM;EACjE,2BAA2B,kCAAkC,MAAM;CACrE;AACF"}
|
|
@@ -18,7 +18,7 @@ declare const listWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
|
|
|
18
18
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
19
19
|
* @throws {HTTPValidationError} Validation Error
|
|
20
20
|
*/
|
|
21
|
-
declare const
|
|
21
|
+
declare const iterListWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
|
|
22
22
|
organization_id?: string | string[] | null;
|
|
23
23
|
page?: number;
|
|
24
24
|
limit?: number;
|
|
@@ -53,7 +53,7 @@ declare const listWebhookDeliveriesWebhooks: (client: ClientBase) => (query?: {
|
|
|
53
53
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
54
54
|
* @throws {HTTPValidationError} Validation Error
|
|
55
55
|
*/
|
|
56
|
-
declare const
|
|
56
|
+
declare const iterListWebhookDeliveriesWebhooks: (client: ClientBase) => (query?: {
|
|
57
57
|
endpoint_id?: string | string[] | null;
|
|
58
58
|
start_timestamp?: string | null;
|
|
59
59
|
end_timestamp?: string | null;
|
|
@@ -88,12 +88,12 @@ declare function createWebhooksService(client: ClientBase): {
|
|
|
88
88
|
limit?: number;
|
|
89
89
|
}) => Promise<ListResourceWebhookDelivery>;
|
|
90
90
|
redeliverWebhookEvent: (id: string) => Promise<unknown>;
|
|
91
|
-
|
|
91
|
+
iterListWebhookEndpoints: (query?: {
|
|
92
92
|
organization_id?: string | string[] | null;
|
|
93
93
|
page?: number;
|
|
94
94
|
limit?: number;
|
|
95
95
|
}) => AsyncGenerator<WebhookEndpoint>;
|
|
96
|
-
|
|
96
|
+
iterListWebhookDeliveries: (query?: {
|
|
97
97
|
endpoint_id?: string | string[] | null;
|
|
98
98
|
start_timestamp?: string | null;
|
|
99
99
|
end_timestamp?: string | null;
|
|
@@ -107,5 +107,5 @@ declare function createWebhooksService(client: ClientBase): {
|
|
|
107
107
|
};
|
|
108
108
|
type Webhooks = ReturnType<typeof createWebhooksService>;
|
|
109
109
|
//#endregion
|
|
110
|
-
export { Webhooks, createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks,
|
|
110
|
+
export { Webhooks, createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks, iterListWebhookDeliveriesWebhooks, iterListWebhookEndpointsWebhooks, listWebhookDeliveriesWebhooks, listWebhookEndpointsWebhooks, redeliverWebhookEventWebhooks, resetWebhookEndpointSecretWebhooks, updateWebhookEndpointWebhooks };
|
|
111
111
|
//# sourceMappingURL=webhooks.d.cts.map
|
|
@@ -18,7 +18,7 @@ declare const listWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
|
|
|
18
18
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
19
19
|
* @throws {HTTPValidationError} Validation Error
|
|
20
20
|
*/
|
|
21
|
-
declare const
|
|
21
|
+
declare const iterListWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
|
|
22
22
|
organization_id?: string | string[] | null;
|
|
23
23
|
page?: number;
|
|
24
24
|
limit?: number;
|
|
@@ -53,7 +53,7 @@ declare const listWebhookDeliveriesWebhooks: (client: ClientBase) => (query?: {
|
|
|
53
53
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
54
54
|
* @throws {HTTPValidationError} Validation Error
|
|
55
55
|
*/
|
|
56
|
-
declare const
|
|
56
|
+
declare const iterListWebhookDeliveriesWebhooks: (client: ClientBase) => (query?: {
|
|
57
57
|
endpoint_id?: string | string[] | null;
|
|
58
58
|
start_timestamp?: string | null;
|
|
59
59
|
end_timestamp?: string | null;
|
|
@@ -88,12 +88,12 @@ declare function createWebhooksService(client: ClientBase): {
|
|
|
88
88
|
limit?: number;
|
|
89
89
|
}) => Promise<ListResourceWebhookDelivery>;
|
|
90
90
|
redeliverWebhookEvent: (id: string) => Promise<unknown>;
|
|
91
|
-
|
|
91
|
+
iterListWebhookEndpoints: (query?: {
|
|
92
92
|
organization_id?: string | string[] | null;
|
|
93
93
|
page?: number;
|
|
94
94
|
limit?: number;
|
|
95
95
|
}) => AsyncGenerator<WebhookEndpoint>;
|
|
96
|
-
|
|
96
|
+
iterListWebhookDeliveries: (query?: {
|
|
97
97
|
endpoint_id?: string | string[] | null;
|
|
98
98
|
start_timestamp?: string | null;
|
|
99
99
|
end_timestamp?: string | null;
|
|
@@ -107,5 +107,5 @@ declare function createWebhooksService(client: ClientBase): {
|
|
|
107
107
|
};
|
|
108
108
|
type Webhooks = ReturnType<typeof createWebhooksService>;
|
|
109
109
|
//#endregion
|
|
110
|
-
export { Webhooks, createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks,
|
|
110
|
+
export { Webhooks, createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks, iterListWebhookDeliveriesWebhooks, iterListWebhookEndpointsWebhooks, listWebhookDeliveriesWebhooks, listWebhookEndpointsWebhooks, redeliverWebhookEventWebhooks, resetWebhookEndpointSecretWebhooks, updateWebhookEndpointWebhooks };
|
|
111
111
|
//# sourceMappingURL=webhooks.d.mts.map
|
|
@@ -37,7 +37,7 @@ const listWebhookEndpointsWebhooks = (client) => {
|
|
|
37
37
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
38
38
|
* @throws {HTTPValidationError} Validation Error
|
|
39
39
|
*/
|
|
40
|
-
const
|
|
40
|
+
const iterListWebhookEndpointsWebhooks = (client) => {
|
|
41
41
|
return async function* (query) {
|
|
42
42
|
let page;
|
|
43
43
|
page = query?.page ?? 1;
|
|
@@ -218,7 +218,7 @@ const listWebhookDeliveriesWebhooks = (client) => {
|
|
|
218
218
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
219
219
|
* @throws {HTTPValidationError} Validation Error
|
|
220
220
|
*/
|
|
221
|
-
const
|
|
221
|
+
const iterListWebhookDeliveriesWebhooks = (client) => {
|
|
222
222
|
return async function* (query) {
|
|
223
223
|
let page;
|
|
224
224
|
page = query?.page ?? 1;
|
|
@@ -270,11 +270,11 @@ function createWebhooksService(client) {
|
|
|
270
270
|
resetWebhookEndpointSecret: resetWebhookEndpointSecretWebhooks(client),
|
|
271
271
|
listWebhookDeliveries: listWebhookDeliveriesWebhooks(client),
|
|
272
272
|
redeliverWebhookEvent: redeliverWebhookEventWebhooks(client),
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
iterListWebhookEndpoints: iterListWebhookEndpointsWebhooks(client),
|
|
274
|
+
iterListWebhookDeliveries: iterListWebhookDeliveriesWebhooks(client)
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
//#endregion
|
|
278
|
-
export { createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks,
|
|
278
|
+
export { createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks, iterListWebhookDeliveriesWebhooks, iterListWebhookEndpointsWebhooks, listWebhookDeliveriesWebhooks, listWebhookEndpointsWebhooks, redeliverWebhookEventWebhooks, resetWebhookEndpointSecretWebhooks, updateWebhookEndpointWebhooks };
|
|
279
279
|
|
|
280
280
|
//# sourceMappingURL=webhooks.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.mjs","names":[],"sources":["../../../src/2026-04/services/webhooks.ts"],"sourcesContent":["import type { ClientBase } from \"../../base\";\nimport type {\n ListResourceWebhookDelivery,\n ListResourceWebhookEndpoint,\n WebhookDelivery,\n WebhookEndpoint,\n WebhookEndpointCreate,\n WebhookEndpointUpdate,\n WebhookEventType,\n} from \"../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../errors\";\n\nexport const listWebhookEndpointsWebhooks = (client: ClientBase) => {\n /**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookEndpoint>} A generator that yields items of type WebhookEndpoint.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistWebhookEndpointsWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookEndpoint> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookEndpointsWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const createWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Create a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: WebhookEndpointCreate): Promise<WebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const getWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Get a webhook endpoint by ID.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Delete a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {void}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<void>(response, \"none\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Update a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: WebhookEndpointUpdate): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resetWebhookEndpointSecretWebhooks = (client: ClientBase) => {\n /**\n * Regenerate a webhook endpoint secret.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}/secret\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listWebhookDeliveriesWebhooks = (client: ClientBase) => {\n /**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookDelivery}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookDelivery> => {\n const pathParams = {};\n const queryParams = {\n endpoint_id: query?.endpoint_id,\n start_timestamp: query?.start_timestamp,\n end_timestamp: query?.end_timestamp,\n succeeded: query?.succeeded,\n query: query?.query,\n http_code_class: query?.http_code_class,\n event_type: query?.event_type,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/deliveries\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookDelivery>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookDelivery>} A generator that yields items of type WebhookDelivery.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistWebhookDeliveriesWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookDelivery> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookDeliveriesWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const redeliverWebhookEventWebhooks = (client: ClientBase) => {\n /**\n * Schedule the re-delivery of a webhook event.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook event ID.\n * @returns {unknown}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook event not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<unknown> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/events/{id}/redeliver\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<unknown>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createWebhooksService(client: ClientBase) {\n return {\n listWebhookEndpoints: listWebhookEndpointsWebhooks(client),\n createWebhookEndpoint: createWebhookEndpointWebhooks(client),\n getWebhookEndpoint: getWebhookEndpointWebhooks(client),\n deleteWebhookEndpoint: deleteWebhookEndpointWebhooks(client),\n updateWebhookEndpoint: updateWebhookEndpointWebhooks(client),\n resetWebhookEndpointSecret: resetWebhookEndpointSecretWebhooks(client),\n listWebhookDeliveries: listWebhookDeliveriesWebhooks(client),\n redeliverWebhookEvent: redeliverWebhookEventWebhooks(client),\n iterlistWebhookEndpoints: iterlistWebhookEndpointsWebhooks(client),\n iterlistWebhookDeliveries: iterlistWebhookDeliveriesWebhooks(client),\n };\n}\n\nexport type Webhooks = ReturnType<typeof createWebhooksService>;\n"],"mappings":";;AAaA,MAAa,gCAAgC,WAAuB;;;;;;;;;;;;;CAalE,OAAO,OAAO,UAI8B;EAC1C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;EACzB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,0BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA2C,UAAU,QAAQ,EACzE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,oCAAoC,WAAuB;CACtE,OAAO,iBAAiB,OAIY;EAClC,IAAI;EACJ,OAAO,OA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A,MAAa,iCAAiC,WAAuB;;;;;;;;;;;;;;CAcnE,OAAO,OAAO,OAAiC;EAC7C,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,QACA,sCACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAuB,UAAU,QAAQ;GACrD,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AAEA,SAAgB,sBAAsB,QAAoB;CACxD,OAAO;EACL,sBAAsB,6BAA6B,MAAM;EACzD,uBAAuB,8BAA8B,MAAM;EAC3D,oBAAoB,2BAA2B,MAAM;EACrD,uBAAuB,8BAA8B,MAAM;EAC3D,uBAAuB,8BAA8B,MAAM;EAC3D,4BAA4B,mCAAmC,MAAM;EACrE,uBAAuB,8BAA8B,MAAM;EAC3D,uBAAuB,8BAA8B,MAAM;EAC3D,0BAA0B,iCAAiC,MAAM;EACjE,2BAA2B,kCAAkC,MAAM;CACrE;AACF"}
|
|
1
|
+
{"version":3,"file":"webhooks.mjs","names":[],"sources":["../../../src/2026-04/services/webhooks.ts"],"sourcesContent":["import type { ClientBase } from \"../../base\";\nimport type {\n ListResourceWebhookDelivery,\n ListResourceWebhookEndpoint,\n WebhookDelivery,\n WebhookEndpoint,\n WebhookEndpointCreate,\n WebhookEndpointUpdate,\n WebhookEventType,\n} from \"../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../errors\";\n\nexport const listWebhookEndpointsWebhooks = (client: ClientBase) => {\n /**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook endpoints.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookEndpoint>} A generator that yields items of type WebhookEndpoint.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListWebhookEndpointsWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookEndpoint> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookEndpointsWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const createWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Create a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: WebhookEndpointCreate): Promise<WebhookEndpoint> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/endpoints\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const getWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Get a webhook endpoint by ID.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Delete a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {void}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<void>(response, \"none\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateWebhookEndpointWebhooks = (client: ClientBase) => {\n /**\n * Update a webhook endpoint.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @param body - Request body\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: WebhookEndpointUpdate): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resetWebhookEndpointSecretWebhooks = (client: ClientBase) => {\n /**\n * Regenerate a webhook endpoint secret.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook endpoint ID.\n * @returns {WebhookEndpoint}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook endpoint not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<WebhookEndpoint> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/webhooks/endpoints/{id}/secret\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<WebhookEndpoint>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listWebhookDeliveriesWebhooks = (client: ClientBase) => {\n /**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceWebhookDelivery}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): Promise<ListResourceWebhookDelivery> => {\n const pathParams = {};\n const queryParams = {\n endpoint_id: query?.endpoint_id,\n start_timestamp: query?.start_timestamp,\n end_timestamp: query?.end_timestamp,\n succeeded: query?.succeeded,\n query: query?.query,\n http_code_class: query?.http_code_class,\n event_type: query?.event_type,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/webhooks/deliveries\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceWebhookDelivery>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List webhook deliveries.\n *\n * Deliveries are all the attempts to deliver a webhook event to an endpoint.\n *\n * **Scopes**: `webhooks:read` `webhooks:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<WebhookDelivery>} A generator that yields items of type WebhookDelivery.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListWebhookDeliveriesWebhooks = (client: ClientBase) => {\n return async function* (query?: {\n endpoint_id?: string | string[] | null;\n start_timestamp?: string | null;\n end_timestamp?: string | null;\n succeeded?: boolean | null;\n query?: string | null;\n http_code_class?: (\"2xx\" | \"3xx\" | \"4xx\" | \"5xx\") | null;\n event_type?: WebhookEventType | WebhookEventType[] | null;\n page?: number;\n limit?: number;\n }): AsyncGenerator<WebhookDelivery> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listWebhookDeliveriesWebhooks(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const redeliverWebhookEventWebhooks = (client: ClientBase) => {\n /**\n * Schedule the re-delivery of a webhook event.\n *\n * **Scopes**: `webhooks:write`\n *\n * @param id - The webhook event ID.\n * @returns {unknown}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Webhook event not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<unknown> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/webhooks/events/{id}/redeliver\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<unknown>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createWebhooksService(client: ClientBase) {\n return {\n listWebhookEndpoints: listWebhookEndpointsWebhooks(client),\n createWebhookEndpoint: createWebhookEndpointWebhooks(client),\n getWebhookEndpoint: getWebhookEndpointWebhooks(client),\n deleteWebhookEndpoint: deleteWebhookEndpointWebhooks(client),\n updateWebhookEndpoint: updateWebhookEndpointWebhooks(client),\n resetWebhookEndpointSecret: resetWebhookEndpointSecretWebhooks(client),\n listWebhookDeliveries: listWebhookDeliveriesWebhooks(client),\n redeliverWebhookEvent: redeliverWebhookEventWebhooks(client),\n iterListWebhookEndpoints: iterListWebhookEndpointsWebhooks(client),\n iterListWebhookDeliveries: iterListWebhookDeliveriesWebhooks(client),\n };\n}\n\nexport type Webhooks = ReturnType<typeof createWebhooksService>;\n"],"mappings":";;AAaA,MAAa,gCAAgC,WAAuB;;;;;;;;;;;;;CAalE,OAAO,OAAO,UAI8B;EAC1C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;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