@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.
Files changed (198) hide show
  1. package/README.md +4 -2
  2. package/dist/2026-04/index.d.cts +36 -36
  3. package/dist/2026-04/index.d.mts +36 -36
  4. package/dist/2026-04/services/benefit_grants.cjs +3 -3
  5. package/dist/2026-04/services/benefit_grants.cjs.map +1 -1
  6. package/dist/2026-04/services/benefit_grants.d.cts +3 -3
  7. package/dist/2026-04/services/benefit_grants.d.mts +3 -3
  8. package/dist/2026-04/services/benefit_grants.mjs +3 -3
  9. package/dist/2026-04/services/benefit_grants.mjs.map +1 -1
  10. package/dist/2026-04/services/benefits.cjs +6 -6
  11. package/dist/2026-04/services/benefits.cjs.map +1 -1
  12. package/dist/2026-04/services/benefits.d.cts +5 -5
  13. package/dist/2026-04/services/benefits.d.mts +5 -5
  14. package/dist/2026-04/services/benefits.mjs +5 -5
  15. package/dist/2026-04/services/benefits.mjs.map +1 -1
  16. package/dist/2026-04/services/checkout_links.cjs +3 -3
  17. package/dist/2026-04/services/checkout_links.cjs.map +1 -1
  18. package/dist/2026-04/services/checkout_links.d.cts +3 -3
  19. package/dist/2026-04/services/checkout_links.d.mts +3 -3
  20. package/dist/2026-04/services/checkout_links.mjs +3 -3
  21. package/dist/2026-04/services/checkout_links.mjs.map +1 -1
  22. package/dist/2026-04/services/checkouts.cjs +3 -3
  23. package/dist/2026-04/services/checkouts.cjs.map +1 -1
  24. package/dist/2026-04/services/checkouts.d.cts +3 -3
  25. package/dist/2026-04/services/checkouts.d.mts +3 -3
  26. package/dist/2026-04/services/checkouts.mjs +3 -3
  27. package/dist/2026-04/services/checkouts.mjs.map +1 -1
  28. package/dist/2026-04/services/custom_fields.cjs +3 -3
  29. package/dist/2026-04/services/custom_fields.cjs.map +1 -1
  30. package/dist/2026-04/services/custom_fields.d.cts +3 -3
  31. package/dist/2026-04/services/custom_fields.d.mts +3 -3
  32. package/dist/2026-04/services/custom_fields.mjs +3 -3
  33. package/dist/2026-04/services/custom_fields.mjs.map +1 -1
  34. package/dist/2026-04/services/customer_meters.cjs +3 -3
  35. package/dist/2026-04/services/customer_meters.cjs.map +1 -1
  36. package/dist/2026-04/services/customer_meters.d.cts +3 -3
  37. package/dist/2026-04/services/customer_meters.d.mts +3 -3
  38. package/dist/2026-04/services/customer_meters.mjs +3 -3
  39. package/dist/2026-04/services/customer_meters.mjs.map +1 -1
  40. package/dist/2026-04/services/customer_portal/benefit_grants.cjs +3 -3
  41. package/dist/2026-04/services/customer_portal/benefit_grants.cjs.map +1 -1
  42. package/dist/2026-04/services/customer_portal/benefit_grants.d.cts +3 -3
  43. package/dist/2026-04/services/customer_portal/benefit_grants.d.mts +3 -3
  44. package/dist/2026-04/services/customer_portal/benefit_grants.mjs +3 -3
  45. package/dist/2026-04/services/customer_portal/benefit_grants.mjs.map +1 -1
  46. package/dist/2026-04/services/customer_portal/customer_meters.cjs +3 -3
  47. package/dist/2026-04/services/customer_portal/customer_meters.cjs.map +1 -1
  48. package/dist/2026-04/services/customer_portal/customer_meters.d.cts +3 -3
  49. package/dist/2026-04/services/customer_portal/customer_meters.d.mts +3 -3
  50. package/dist/2026-04/services/customer_portal/customer_meters.mjs +3 -3
  51. package/dist/2026-04/services/customer_portal/customer_meters.mjs.map +1 -1
  52. package/dist/2026-04/services/customer_portal/customers.cjs +3 -3
  53. package/dist/2026-04/services/customer_portal/customers.cjs.map +1 -1
  54. package/dist/2026-04/services/customer_portal/customers.d.cts +3 -3
  55. package/dist/2026-04/services/customer_portal/customers.d.mts +3 -3
  56. package/dist/2026-04/services/customer_portal/customers.mjs +3 -3
  57. package/dist/2026-04/services/customer_portal/customers.mjs.map +1 -1
  58. package/dist/2026-04/services/customer_portal/downloadables.cjs +3 -3
  59. package/dist/2026-04/services/customer_portal/downloadables.cjs.map +1 -1
  60. package/dist/2026-04/services/customer_portal/downloadables.d.cts +3 -3
  61. package/dist/2026-04/services/customer_portal/downloadables.d.mts +3 -3
  62. package/dist/2026-04/services/customer_portal/downloadables.mjs +3 -3
  63. package/dist/2026-04/services/customer_portal/downloadables.mjs.map +1 -1
  64. package/dist/2026-04/services/customer_portal/index.d.cts +10 -10
  65. package/dist/2026-04/services/customer_portal/index.d.mts +10 -10
  66. package/dist/2026-04/services/customer_portal/license_keys.cjs +3 -3
  67. package/dist/2026-04/services/customer_portal/license_keys.cjs.map +1 -1
  68. package/dist/2026-04/services/customer_portal/license_keys.d.cts +3 -3
  69. package/dist/2026-04/services/customer_portal/license_keys.d.mts +3 -3
  70. package/dist/2026-04/services/customer_portal/license_keys.mjs +3 -3
  71. package/dist/2026-04/services/customer_portal/license_keys.mjs.map +1 -1
  72. package/dist/2026-04/services/customer_portal/members.cjs +3 -3
  73. package/dist/2026-04/services/customer_portal/members.cjs.map +1 -1
  74. package/dist/2026-04/services/customer_portal/members.d.cts +3 -3
  75. package/dist/2026-04/services/customer_portal/members.d.mts +3 -3
  76. package/dist/2026-04/services/customer_portal/members.mjs +3 -3
  77. package/dist/2026-04/services/customer_portal/members.mjs.map +1 -1
  78. package/dist/2026-04/services/customer_portal/orders.cjs +3 -3
  79. package/dist/2026-04/services/customer_portal/orders.cjs.map +1 -1
  80. package/dist/2026-04/services/customer_portal/orders.d.cts +3 -3
  81. package/dist/2026-04/services/customer_portal/orders.d.mts +3 -3
  82. package/dist/2026-04/services/customer_portal/orders.mjs +3 -3
  83. package/dist/2026-04/services/customer_portal/orders.mjs.map +1 -1
  84. package/dist/2026-04/services/customer_portal/seats.cjs +3 -3
  85. package/dist/2026-04/services/customer_portal/seats.cjs.map +1 -1
  86. package/dist/2026-04/services/customer_portal/seats.d.cts +3 -3
  87. package/dist/2026-04/services/customer_portal/seats.d.mts +3 -3
  88. package/dist/2026-04/services/customer_portal/seats.mjs +3 -3
  89. package/dist/2026-04/services/customer_portal/seats.mjs.map +1 -1
  90. package/dist/2026-04/services/customer_portal/subscriptions.cjs +3 -3
  91. package/dist/2026-04/services/customer_portal/subscriptions.cjs.map +1 -1
  92. package/dist/2026-04/services/customer_portal/subscriptions.d.cts +3 -3
  93. package/dist/2026-04/services/customer_portal/subscriptions.d.mts +3 -3
  94. package/dist/2026-04/services/customer_portal/subscriptions.mjs +3 -3
  95. package/dist/2026-04/services/customer_portal/subscriptions.mjs.map +1 -1
  96. package/dist/2026-04/services/customer_portal/wallets.cjs +3 -3
  97. package/dist/2026-04/services/customer_portal/wallets.cjs.map +1 -1
  98. package/dist/2026-04/services/customer_portal/wallets.d.cts +3 -3
  99. package/dist/2026-04/services/customer_portal/wallets.d.mts +3 -3
  100. package/dist/2026-04/services/customer_portal/wallets.mjs +3 -3
  101. package/dist/2026-04/services/customer_portal/wallets.mjs.map +1 -1
  102. package/dist/2026-04/services/customers/index.cjs +9 -9
  103. package/dist/2026-04/services/customers/index.cjs.map +1 -1
  104. package/dist/2026-04/services/customers/index.d.cts +7 -7
  105. package/dist/2026-04/services/customers/index.d.mts +7 -7
  106. package/dist/2026-04/services/customers/index.mjs +7 -7
  107. package/dist/2026-04/services/customers/index.mjs.map +1 -1
  108. package/dist/2026-04/services/discounts.cjs +3 -3
  109. package/dist/2026-04/services/discounts.cjs.map +1 -1
  110. package/dist/2026-04/services/discounts.d.cts +3 -3
  111. package/dist/2026-04/services/discounts.d.mts +3 -3
  112. package/dist/2026-04/services/discounts.mjs +3 -3
  113. package/dist/2026-04/services/discounts.mjs.map +1 -1
  114. package/dist/2026-04/services/disputes.cjs +3 -3
  115. package/dist/2026-04/services/disputes.cjs.map +1 -1
  116. package/dist/2026-04/services/disputes.d.cts +3 -3
  117. package/dist/2026-04/services/disputes.d.mts +3 -3
  118. package/dist/2026-04/services/disputes.mjs +3 -3
  119. package/dist/2026-04/services/disputes.mjs.map +1 -1
  120. package/dist/2026-04/services/event_types.cjs +3 -3
  121. package/dist/2026-04/services/event_types.cjs.map +1 -1
  122. package/dist/2026-04/services/event_types.d.cts +3 -3
  123. package/dist/2026-04/services/event_types.d.mts +3 -3
  124. package/dist/2026-04/services/event_types.mjs +3 -3
  125. package/dist/2026-04/services/event_types.mjs.map +1 -1
  126. package/dist/2026-04/services/events.cjs +3 -3
  127. package/dist/2026-04/services/events.cjs.map +1 -1
  128. package/dist/2026-04/services/events.d.cts +3 -3
  129. package/dist/2026-04/services/events.d.mts +3 -3
  130. package/dist/2026-04/services/events.mjs +3 -3
  131. package/dist/2026-04/services/events.mjs.map +1 -1
  132. package/dist/2026-04/services/files.cjs +3 -3
  133. package/dist/2026-04/services/files.cjs.map +1 -1
  134. package/dist/2026-04/services/files.d.cts +3 -3
  135. package/dist/2026-04/services/files.d.mts +3 -3
  136. package/dist/2026-04/services/files.mjs +3 -3
  137. package/dist/2026-04/services/files.mjs.map +1 -1
  138. package/dist/2026-04/services/license_keys.cjs +3 -3
  139. package/dist/2026-04/services/license_keys.cjs.map +1 -1
  140. package/dist/2026-04/services/license_keys.d.cts +3 -3
  141. package/dist/2026-04/services/license_keys.d.mts +3 -3
  142. package/dist/2026-04/services/license_keys.mjs +3 -3
  143. package/dist/2026-04/services/license_keys.mjs.map +1 -1
  144. package/dist/2026-04/services/members.cjs +3 -3
  145. package/dist/2026-04/services/members.cjs.map +1 -1
  146. package/dist/2026-04/services/members.d.cts +3 -3
  147. package/dist/2026-04/services/members.d.mts +3 -3
  148. package/dist/2026-04/services/members.mjs +3 -3
  149. package/dist/2026-04/services/members.mjs.map +1 -1
  150. package/dist/2026-04/services/meters.cjs +3 -3
  151. package/dist/2026-04/services/meters.cjs.map +1 -1
  152. package/dist/2026-04/services/meters.d.cts +3 -3
  153. package/dist/2026-04/services/meters.d.mts +3 -3
  154. package/dist/2026-04/services/meters.mjs +3 -3
  155. package/dist/2026-04/services/meters.mjs.map +1 -1
  156. package/dist/2026-04/services/orders.cjs +3 -3
  157. package/dist/2026-04/services/orders.cjs.map +1 -1
  158. package/dist/2026-04/services/orders.d.cts +3 -3
  159. package/dist/2026-04/services/orders.d.mts +3 -3
  160. package/dist/2026-04/services/orders.mjs +3 -3
  161. package/dist/2026-04/services/orders.mjs.map +1 -1
  162. package/dist/2026-04/services/organizations.cjs +3 -3
  163. package/dist/2026-04/services/organizations.cjs.map +1 -1
  164. package/dist/2026-04/services/organizations.d.cts +3 -3
  165. package/dist/2026-04/services/organizations.d.mts +3 -3
  166. package/dist/2026-04/services/organizations.mjs +3 -3
  167. package/dist/2026-04/services/organizations.mjs.map +1 -1
  168. package/dist/2026-04/services/payments.cjs +3 -3
  169. package/dist/2026-04/services/payments.cjs.map +1 -1
  170. package/dist/2026-04/services/payments.d.cts +3 -3
  171. package/dist/2026-04/services/payments.d.mts +3 -3
  172. package/dist/2026-04/services/payments.mjs +3 -3
  173. package/dist/2026-04/services/payments.mjs.map +1 -1
  174. package/dist/2026-04/services/products.cjs +3 -3
  175. package/dist/2026-04/services/products.cjs.map +1 -1
  176. package/dist/2026-04/services/products.d.cts +3 -3
  177. package/dist/2026-04/services/products.d.mts +3 -3
  178. package/dist/2026-04/services/products.mjs +3 -3
  179. package/dist/2026-04/services/products.mjs.map +1 -1
  180. package/dist/2026-04/services/refunds.cjs +3 -3
  181. package/dist/2026-04/services/refunds.cjs.map +1 -1
  182. package/dist/2026-04/services/refunds.d.cts +3 -3
  183. package/dist/2026-04/services/refunds.d.mts +3 -3
  184. package/dist/2026-04/services/refunds.mjs +3 -3
  185. package/dist/2026-04/services/refunds.mjs.map +1 -1
  186. package/dist/2026-04/services/subscriptions.cjs +3 -3
  187. package/dist/2026-04/services/subscriptions.cjs.map +1 -1
  188. package/dist/2026-04/services/subscriptions.d.cts +3 -3
  189. package/dist/2026-04/services/subscriptions.d.mts +3 -3
  190. package/dist/2026-04/services/subscriptions.mjs +3 -3
  191. package/dist/2026-04/services/subscriptions.mjs.map +1 -1
  192. package/dist/2026-04/services/webhooks.cjs +6 -6
  193. package/dist/2026-04/services/webhooks.cjs.map +1 -1
  194. package/dist/2026-04/services/webhooks.d.cts +5 -5
  195. package/dist/2026-04/services/webhooks.d.mts +5 -5
  196. package/dist/2026-04/services/webhooks.mjs +5 -5
  197. package/dist/2026-04/services/webhooks.mjs.map +1 -1
  198. 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 iterlistWebhookEndpointsWebhooks = (client) => {
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 iterlistWebhookDeliveriesWebhooks = (client) => {
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
- iterlistWebhookEndpoints: iterlistWebhookEndpointsWebhooks(client),
275
- iterlistWebhookDeliveries: iterlistWebhookDeliveriesWebhooks(client)
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.iterlistWebhookDeliveriesWebhooks = iterlistWebhookDeliveriesWebhooks;
284
- exports.iterlistWebhookEndpointsWebhooks = iterlistWebhookEndpointsWebhooks;
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,OA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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"}
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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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 iterlistWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
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 iterlistWebhookDeliveriesWebhooks: (client: ClientBase) => (query?: {
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
- iterlistWebhookEndpoints: (query?: {
91
+ iterListWebhookEndpoints: (query?: {
92
92
  organization_id?: string | string[] | null;
93
93
  page?: number;
94
94
  limit?: number;
95
95
  }) => AsyncGenerator<WebhookEndpoint>;
96
- iterlistWebhookDeliveries: (query?: {
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, iterlistWebhookDeliveriesWebhooks, iterlistWebhookEndpointsWebhooks, listWebhookDeliveriesWebhooks, listWebhookEndpointsWebhooks, redeliverWebhookEventWebhooks, resetWebhookEndpointSecretWebhooks, updateWebhookEndpointWebhooks };
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 iterlistWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
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 iterlistWebhookDeliveriesWebhooks: (client: ClientBase) => (query?: {
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
- iterlistWebhookEndpoints: (query?: {
91
+ iterListWebhookEndpoints: (query?: {
92
92
  organization_id?: string | string[] | null;
93
93
  page?: number;
94
94
  limit?: number;
95
95
  }) => AsyncGenerator<WebhookEndpoint>;
96
- iterlistWebhookDeliveries: (query?: {
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, iterlistWebhookDeliveriesWebhooks, iterlistWebhookEndpointsWebhooks, listWebhookDeliveriesWebhooks, listWebhookEndpointsWebhooks, redeliverWebhookEventWebhooks, resetWebhookEndpointSecretWebhooks, updateWebhookEndpointWebhooks };
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 iterlistWebhookEndpointsWebhooks = (client) => {
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 iterlistWebhookDeliveriesWebhooks = (client) => {
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
- iterlistWebhookEndpoints: iterlistWebhookEndpointsWebhooks(client),
274
- iterlistWebhookDeliveries: iterlistWebhookDeliveriesWebhooks(client)
273
+ iterListWebhookEndpoints: iterListWebhookEndpointsWebhooks(client),
274
+ iterListWebhookDeliveries: iterListWebhookDeliveriesWebhooks(client)
275
275
  };
276
276
  }
277
277
  //#endregion
278
- export { createWebhookEndpointWebhooks, createWebhooksService, deleteWebhookEndpointWebhooks, getWebhookEndpointWebhooks, iterlistWebhookDeliveriesWebhooks, iterlistWebhookEndpointsWebhooks, listWebhookDeliveriesWebhooks, listWebhookEndpointsWebhooks, redeliverWebhookEventWebhooks, resetWebhookEndpointSecretWebhooks, updateWebhookEndpointWebhooks };
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,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,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA+B,UAAU,QAAQ,EAC7D,KAAK,oBACP,CAAC;CACH;AACF;AACA,MAAa,8BAA8B,WAAuB;;;;;;;;;;;;;;CAchE,OAAO,OAAO,OAAyC;EACrD,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,OACA,+BACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,O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zB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,2BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA2C,UAAU,QAAQ,EACzE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;;;AAeA,MAAa,qCAAqC,WAAuB;CACvE,OAAO,iBAAiB,OAUY;EAClC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,8BAA8B,MAAM,CAAC,CAAC;IAAE,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,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;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,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,MAA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BAAoB,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polar-sh/sdk",
3
- "version": "1.0.0-alpha.12",
3
+ "version": "1.0.0-alpha.13",
4
4
  "description": "Polar SDK — A billing platform for the intelligence era",
5
5
  "keywords": [
6
6
  "api",