@polar-sh/sdk 1.0.0-alpha.11 → 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 +58 -2
- package/dist/2026-04/index.cjs +132 -0
- package/dist/2026-04/index.cjs.map +1 -1
- package/dist/2026-04/index.d.cts +836 -40
- package/dist/2026-04/index.d.cts.map +1 -1
- package/dist/2026-04/index.d.mts +836 -40
- package/dist/2026-04/index.d.mts.map +1 -1
- package/dist/2026-04/index.mjs +128 -2
- package/dist/2026-04/index.mjs.map +1 -1
- 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 +4 -4
- package/dist/2026-04/services/benefit_grants.d.mts +4 -4
- 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 +6 -6
- package/dist/2026-04/services/benefits.d.mts +6 -6
- 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 +4 -4
- package/dist/2026-04/services/checkout_links.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/checkouts.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/custom_fields.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_meters.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/benefit_grants.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/customer_meters.d.mts +4 -4
- 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/customer_session.d.cts +1 -1
- package/dist/2026-04/services/customer_portal/customer_session.d.mts +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 +4 -4
- package/dist/2026-04/services/customer_portal/customers.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/downloadables.d.mts +4 -4
- 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 +11 -11
- package/dist/2026-04/services/customer_portal/index.d.mts +11 -11
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/license_keys.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/members.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/orders.d.mts +4 -4
- 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/organizations.d.cts +1 -1
- package/dist/2026-04/services/customer_portal/organizations.d.mts +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 +4 -4
- package/dist/2026-04/services/customer_portal/seats.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/subscriptions.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/customer_portal/wallets.d.mts +4 -4
- 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/customer_seats.d.cts +1 -1
- package/dist/2026-04/services/customer_seats.d.mts +1 -1
- package/dist/2026-04/services/customer_sessions.d.cts +1 -1
- package/dist/2026-04/services/customer_sessions.d.mts +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 +8 -8
- package/dist/2026-04/services/customers/index.d.mts +8 -8
- 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/customers/members.d.cts +1 -1
- package/dist/2026-04/services/customers/members.d.mts +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 +4 -4
- package/dist/2026-04/services/discounts.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/disputes.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/event_types.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/events.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/files.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/license_keys.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/members.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/meters.d.mts +4 -4
- package/dist/2026-04/services/meters.mjs +3 -3
- package/dist/2026-04/services/meters.mjs.map +1 -1
- package/dist/2026-04/services/metrics.d.cts +1 -1
- package/dist/2026-04/services/metrics.d.mts +1 -1
- package/dist/2026-04/services/oauth2/clients/index.d.cts +2 -2
- package/dist/2026-04/services/oauth2/clients/index.d.mts +2 -2
- package/dist/2026-04/services/oauth2/clients/oauth2.cjs +2 -2
- package/dist/2026-04/services/oauth2/clients/oauth2.cjs.map +1 -1
- package/dist/2026-04/services/oauth2/clients/oauth2.d.cts +3 -3
- package/dist/2026-04/services/oauth2/clients/oauth2.d.mts +3 -3
- package/dist/2026-04/services/oauth2/clients/oauth2.mjs +2 -2
- package/dist/2026-04/services/oauth2/clients/oauth2.mjs.map +1 -1
- package/dist/2026-04/services/oauth2/index.d.cts +2 -2
- package/dist/2026-04/services/oauth2/index.d.mts +2 -2
- 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 +4 -4
- package/dist/2026-04/services/orders.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/organizations.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/payments.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/products.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/refunds.d.mts +4 -4
- 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 +4 -4
- package/dist/2026-04/services/subscriptions.d.mts +4 -4
- 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 +6 -6
- package/dist/2026-04/services/webhooks.d.mts +6 -6
- package/dist/2026-04/services/webhooks.mjs +5 -5
- package/dist/2026-04/services/webhooks.mjs.map +1 -1
- package/dist/{models-IotBovey.d.cts → models-DnY24W7g.d.mts} +671 -51
- package/dist/models-DnY24W7g.d.mts.map +1 -0
- package/dist/{models-pdZgmVG-.d.mts → models-i5yDo5sm.d.cts} +671 -51
- package/dist/models-i5yDo5sm.d.cts.map +1 -0
- package/package.json +4 -2
- package/dist/models-IotBovey.d.cts.map +0 -1
- package/dist/models-pdZgmVG-.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as CustomerCancellationReason, di as SubscriptionCreateExternalCustomer, hi as SubscriptionUpdate, li as Subscription, mi as SubscriptionStatus, pi as SubscriptionSortProperty, qn as ListResourceSubscription, rr as MetadataQuery, ui as SubscriptionCreateCustomer } from "../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/subscriptions.d.ts
|
|
4
4
|
declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
@@ -30,7 +30,7 @@ declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
|
30
30
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
31
31
|
* @throws {HTTPValidationError} Validation Error
|
|
32
32
|
*/
|
|
33
|
-
declare const
|
|
33
|
+
declare const iterListSubscriptions: (client: ClientBase) => (query?: {
|
|
34
34
|
organization_id?: string | string[] | null;
|
|
35
35
|
product_id?: string | string[] | null;
|
|
36
36
|
customer_id?: string | string[] | null;
|
|
@@ -79,7 +79,7 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
79
79
|
get: (id: string) => Promise<Subscription>;
|
|
80
80
|
revoke: (id: string) => Promise<Subscription>;
|
|
81
81
|
update: (id: string, body: SubscriptionUpdate) => Promise<Subscription>;
|
|
82
|
-
|
|
82
|
+
iterList: (query?: {
|
|
83
83
|
organization_id?: string | string[] | null;
|
|
84
84
|
product_id?: string | string[] | null;
|
|
85
85
|
customer_id?: string | string[] | null;
|
|
@@ -99,5 +99,5 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
99
99
|
};
|
|
100
100
|
type Subscriptions = ReturnType<typeof createSubscriptionsService>;
|
|
101
101
|
//#endregion
|
|
102
|
-
export { Subscriptions, createSubscriptions, createSubscriptionsService, exportSubscriptions, getSubscriptions,
|
|
102
|
+
export { Subscriptions, createSubscriptions, createSubscriptionsService, exportSubscriptions, getSubscriptions, iterListSubscriptions, listSubscriptions, revokeSubscriptions, updateSubscriptions };
|
|
103
103
|
//# sourceMappingURL=subscriptions.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as CustomerCancellationReason, di as SubscriptionCreateExternalCustomer, hi as SubscriptionUpdate, li as Subscription, mi as SubscriptionStatus, pi as SubscriptionSortProperty, qn as ListResourceSubscription, rr as MetadataQuery, ui as SubscriptionCreateCustomer } from "../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/subscriptions.d.ts
|
|
4
4
|
declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
@@ -30,7 +30,7 @@ declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
|
30
30
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
31
31
|
* @throws {HTTPValidationError} Validation Error
|
|
32
32
|
*/
|
|
33
|
-
declare const
|
|
33
|
+
declare const iterListSubscriptions: (client: ClientBase) => (query?: {
|
|
34
34
|
organization_id?: string | string[] | null;
|
|
35
35
|
product_id?: string | string[] | null;
|
|
36
36
|
customer_id?: string | string[] | null;
|
|
@@ -79,7 +79,7 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
79
79
|
get: (id: string) => Promise<Subscription>;
|
|
80
80
|
revoke: (id: string) => Promise<Subscription>;
|
|
81
81
|
update: (id: string, body: SubscriptionUpdate) => Promise<Subscription>;
|
|
82
|
-
|
|
82
|
+
iterList: (query?: {
|
|
83
83
|
organization_id?: string | string[] | null;
|
|
84
84
|
product_id?: string | string[] | null;
|
|
85
85
|
customer_id?: string | string[] | null;
|
|
@@ -99,5 +99,5 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
99
99
|
};
|
|
100
100
|
type Subscriptions = ReturnType<typeof createSubscriptionsService>;
|
|
101
101
|
//#endregion
|
|
102
|
-
export { Subscriptions, createSubscriptions, createSubscriptionsService, exportSubscriptions, getSubscriptions,
|
|
102
|
+
export { Subscriptions, createSubscriptions, createSubscriptionsService, exportSubscriptions, getSubscriptions, iterListSubscriptions, listSubscriptions, revokeSubscriptions, updateSubscriptions };
|
|
103
103
|
//# sourceMappingURL=subscriptions.d.mts.map
|
|
@@ -49,7 +49,7 @@ const listSubscriptions = (client) => {
|
|
|
49
49
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
50
50
|
* @throws {HTTPValidationError} Validation Error
|
|
51
51
|
*/
|
|
52
|
-
const
|
|
52
|
+
const iterListSubscriptions = (client) => {
|
|
53
53
|
return async function* (query) {
|
|
54
54
|
let page;
|
|
55
55
|
page = query?.page ?? 1;
|
|
@@ -203,10 +203,10 @@ function createSubscriptionsService(client) {
|
|
|
203
203
|
get: getSubscriptions(client),
|
|
204
204
|
revoke: revokeSubscriptions(client),
|
|
205
205
|
update: updateSubscriptions(client),
|
|
206
|
-
|
|
206
|
+
iterList: iterListSubscriptions(client)
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
//#endregion
|
|
210
|
-
export { createSubscriptions, createSubscriptionsService, exportSubscriptions, getSubscriptions,
|
|
210
|
+
export { createSubscriptions, createSubscriptionsService, exportSubscriptions, getSubscriptions, iterListSubscriptions, listSubscriptions, revokeSubscriptions, updateSubscriptions };
|
|
211
211
|
|
|
212
212
|
//# sourceMappingURL=subscriptions.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.mjs","names":[],"sources":["../../../src/2026-04/services/subscriptions.ts"],"sourcesContent":["import type { ClientBase } from \"../../base\";\nimport type {\n CustomerCancellationReason,\n ListResourceSubscription,\n MetadataQuery,\n Subscription,\n SubscriptionCreateCustomer,\n SubscriptionCreateExternalCustomer,\n SubscriptionSortProperty,\n SubscriptionStatus,\n SubscriptionUpdate,\n} from \"../models\";\n\nimport {\n AlreadyCanceledSubscription,\n HTTPValidationError,\n PaymentFailed,\n ResourceNotFound,\n SubscriptionLocked,\n} from \"../errors\";\n\nexport const listSubscriptions = (client: ClientBase) => {\n /**\n * List subscriptions.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceSubscription}\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 product_id?: string | string[] | null;\n customer_id?: string | string[] | null;\n external_customer_id?: string | string[] | null;\n discount_id?: string | string[] | null;\n active?: boolean | null;\n status?: SubscriptionStatus | SubscriptionStatus[] | null;\n cancel_at_period_end?: boolean | null;\n customer_cancellation_reason?: CustomerCancellationReason | CustomerCancellationReason[] | null;\n canceled_at_after?: string | null;\n canceled_at_before?: string | null;\n page?: number;\n limit?: number;\n sorting?: SubscriptionSortProperty[] | null;\n metadata?: MetadataQuery;\n }): Promise<ListResourceSubscription> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n product_id: query?.product_id,\n customer_id: query?.customer_id,\n external_customer_id: query?.external_customer_id,\n discount_id: query?.discount_id,\n active: query?.active,\n status: query?.status,\n cancel_at_period_end: query?.cancel_at_period_end,\n customer_cancellation_reason: query?.customer_cancellation_reason,\n canceled_at_after: query?.canceled_at_after,\n canceled_at_before: query?.canceled_at_before,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-started_at\"],\n metadata: query?.metadata,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/subscriptions/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceSubscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List subscriptions.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<Subscription>} A generator that yields items of type Subscription.\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 iterlistSubscriptions = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n product_id?: string | string[] | null;\n customer_id?: string | string[] | null;\n external_customer_id?: string | string[] | null;\n discount_id?: string | string[] | null;\n active?: boolean | null;\n status?: SubscriptionStatus | SubscriptionStatus[] | null;\n cancel_at_period_end?: boolean | null;\n customer_cancellation_reason?: CustomerCancellationReason | CustomerCancellationReason[] | null;\n canceled_at_after?: string | null;\n canceled_at_before?: string | null;\n page?: number;\n limit?: number;\n sorting?: SubscriptionSortProperty[] | null;\n metadata?: MetadataQuery;\n }): AsyncGenerator<Subscription> {\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 listSubscriptions(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 createSubscriptions = (client: ClientBase) => {\n /**\n * Create a subscription programmatically.\n *\n * This endpoint only allows to create subscription on free products.\n * For paid products, use the checkout flow.\n *\n * No initial order will be created and no confirmation email will be sent.\n *\n * **Scopes**: `subscriptions:write`\n *\n * @param body - Request body\n * @returns {Subscription}\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 (\n body: SubscriptionCreateCustomer | SubscriptionCreateExternalCustomer,\n ): Promise<Subscription> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/subscriptions/\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const exportSubscriptions = (client: ClientBase) => {\n /**\n * Export subscriptions as a CSV file.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param query - Query parameters\n * @returns {string}\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?: { organization_id?: string | string[] | null }): Promise<string> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/subscriptions/export\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<string>(response, \"text\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const getSubscriptions = (client: ClientBase) => {\n /**\n * Get a subscription by ID.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param id - The subscription ID.\n * @returns {Subscription}\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} Subscription not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Subscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const revokeSubscriptions = (client: ClientBase) => {\n /**\n * Revoke a subscription, i.e cancel immediately.\n *\n * **Scopes**: `subscriptions:write`\n *\n * @param id - The subscription ID.\n * @returns {Subscription}\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 {AlreadyCanceledSubscription} This subscription is already revoked.\n * @throws {ResourceNotFound} Subscription not found.\n * @throws {SubscriptionLocked} Subscription is pending an update.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Subscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 403: AlreadyCanceledSubscription,\n 404: ResourceNotFound,\n 409: SubscriptionLocked,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateSubscriptions = (client: ClientBase) => {\n /**\n * Update a subscription.\n *\n * **Scopes**: `subscriptions:write`\n *\n * @param id - The subscription ID.\n * @param body - Request body\n * @returns {Subscription}\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 {PaymentFailed} Payment required to apply the subscription update.\n * @throws {AlreadyCanceledSubscription} Subscription is already canceled or will be at the end of the period.\n * @throws {ResourceNotFound} Subscription not found.\n * @throws {SubscriptionLocked} Subscription is pending an update.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: SubscriptionUpdate): Promise<Subscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/subscriptions/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 402: PaymentFailed,\n 403: AlreadyCanceledSubscription,\n 404: ResourceNotFound,\n 409: SubscriptionLocked,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createSubscriptionsService(client: ClientBase) {\n return {\n list: listSubscriptions(client),\n create: createSubscriptions(client),\n export: exportSubscriptions(client),\n get: getSubscriptions(client),\n revoke: revokeSubscriptions(client),\n update: updateSubscriptions(client),\n iterlist: iterlistSubscriptions(client),\n };\n}\n\nexport type Subscriptions = ReturnType<typeof createSubscriptionsService>;\n"],"mappings":";;AAqBA,MAAa,qBAAqB,WAAuB;;;;;;;;;;;;;CAavD,OAAO,OAAO,UAgB2B;EACvC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,sBAAsB,OAAO;GAC7B,aAAa,OAAO;GACpB,QAAQ,OAAO;GACf,QAAQ,OAAO;GACf,sBAAsB,OAAO;GAC7B,8BAA8B,OAAO;GACrC,mBAAmB,OAAO;GAC1B,oBAAoB,OAAO;GAC3B,MAAM,OAAO,QAAQ;GACrB,OAAO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,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,OACA,0BACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA4B,UAAU,QAAQ;GAC1D,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,uBAAuB,WAAuB;;;;;;;;;;;;;;;;CAgBzD,OAAO,OAAO,OAAsC;EAClD,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,UACA,0BACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA4B,UAAU,QAAQ;GAC1D,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,uBAAuB,WAAuB;;;;;;;;;;;;;;;;;;CAkBzD,OAAO,OAAO,IAAY,SAAoD;EAC5E,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,SACA,0BACA,YACA,CAAU,GACV,IACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA4B,UAAU,QAAQ;GAC1D,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AAEA,SAAgB,2BAA2B,QAAoB;CAC7D,OAAO;EACL,MAAM,kBAAkB,MAAM;EAC9B,QAAQ,oBAAoB,MAAM;EAClC,QAAQ,oBAAoB,MAAM;EAClC,KAAK,iBAAiB,MAAM;EAC5B,QAAQ,oBAAoB,MAAM;EAClC,QAAQ,oBAAoB,MAAM;EAClC,UAAU,sBAAsB,MAAM;CACxC;AACF"}
|
|
1
|
+
{"version":3,"file":"subscriptions.mjs","names":[],"sources":["../../../src/2026-04/services/subscriptions.ts"],"sourcesContent":["import type { ClientBase } from \"../../base\";\nimport type {\n CustomerCancellationReason,\n ListResourceSubscription,\n MetadataQuery,\n Subscription,\n SubscriptionCreateCustomer,\n SubscriptionCreateExternalCustomer,\n SubscriptionSortProperty,\n SubscriptionStatus,\n SubscriptionUpdate,\n} from \"../models\";\n\nimport {\n AlreadyCanceledSubscription,\n HTTPValidationError,\n PaymentFailed,\n ResourceNotFound,\n SubscriptionLocked,\n} from \"../errors\";\n\nexport const listSubscriptions = (client: ClientBase) => {\n /**\n * List subscriptions.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceSubscription}\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 product_id?: string | string[] | null;\n customer_id?: string | string[] | null;\n external_customer_id?: string | string[] | null;\n discount_id?: string | string[] | null;\n active?: boolean | null;\n status?: SubscriptionStatus | SubscriptionStatus[] | null;\n cancel_at_period_end?: boolean | null;\n customer_cancellation_reason?: CustomerCancellationReason | CustomerCancellationReason[] | null;\n canceled_at_after?: string | null;\n canceled_at_before?: string | null;\n page?: number;\n limit?: number;\n sorting?: SubscriptionSortProperty[] | null;\n metadata?: MetadataQuery;\n }): Promise<ListResourceSubscription> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n product_id: query?.product_id,\n customer_id: query?.customer_id,\n external_customer_id: query?.external_customer_id,\n discount_id: query?.discount_id,\n active: query?.active,\n status: query?.status,\n cancel_at_period_end: query?.cancel_at_period_end,\n customer_cancellation_reason: query?.customer_cancellation_reason,\n canceled_at_after: query?.canceled_at_after,\n canceled_at_before: query?.canceled_at_before,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-started_at\"],\n metadata: query?.metadata,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/subscriptions/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceSubscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List subscriptions.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<Subscription>} A generator that yields items of type Subscription.\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 iterListSubscriptions = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n product_id?: string | string[] | null;\n customer_id?: string | string[] | null;\n external_customer_id?: string | string[] | null;\n discount_id?: string | string[] | null;\n active?: boolean | null;\n status?: SubscriptionStatus | SubscriptionStatus[] | null;\n cancel_at_period_end?: boolean | null;\n customer_cancellation_reason?: CustomerCancellationReason | CustomerCancellationReason[] | null;\n canceled_at_after?: string | null;\n canceled_at_before?: string | null;\n page?: number;\n limit?: number;\n sorting?: SubscriptionSortProperty[] | null;\n metadata?: MetadataQuery;\n }): AsyncGenerator<Subscription> {\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 listSubscriptions(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 createSubscriptions = (client: ClientBase) => {\n /**\n * Create a subscription programmatically.\n *\n * This endpoint only allows to create subscription on free products.\n * For paid products, use the checkout flow.\n *\n * No initial order will be created and no confirmation email will be sent.\n *\n * **Scopes**: `subscriptions:write`\n *\n * @param body - Request body\n * @returns {Subscription}\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 (\n body: SubscriptionCreateCustomer | SubscriptionCreateExternalCustomer,\n ): Promise<Subscription> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/subscriptions/\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const exportSubscriptions = (client: ClientBase) => {\n /**\n * Export subscriptions as a CSV file.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param query - Query parameters\n * @returns {string}\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?: { organization_id?: string | string[] | null }): Promise<string> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/subscriptions/export\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<string>(response, \"text\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const getSubscriptions = (client: ClientBase) => {\n /**\n * Get a subscription by ID.\n *\n * **Scopes**: `subscriptions:read` `subscriptions:write`\n *\n * @param id - The subscription ID.\n * @returns {Subscription}\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} Subscription not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Subscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const revokeSubscriptions = (client: ClientBase) => {\n /**\n * Revoke a subscription, i.e cancel immediately.\n *\n * **Scopes**: `subscriptions:write`\n *\n * @param id - The subscription ID.\n * @returns {Subscription}\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 {AlreadyCanceledSubscription} This subscription is already revoked.\n * @throws {ResourceNotFound} Subscription not found.\n * @throws {SubscriptionLocked} Subscription is pending an update.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Subscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 403: AlreadyCanceledSubscription,\n 404: ResourceNotFound,\n 409: SubscriptionLocked,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateSubscriptions = (client: ClientBase) => {\n /**\n * Update a subscription.\n *\n * **Scopes**: `subscriptions:write`\n *\n * @param id - The subscription ID.\n * @param body - Request body\n * @returns {Subscription}\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 {PaymentFailed} Payment required to apply the subscription update.\n * @throws {AlreadyCanceledSubscription} Subscription is already canceled or will be at the end of the period.\n * @throws {ResourceNotFound} Subscription not found.\n * @throws {SubscriptionLocked} Subscription is pending an update.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: SubscriptionUpdate): Promise<Subscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/subscriptions/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Subscription>(response, \"json\", {\n 402: PaymentFailed,\n 403: AlreadyCanceledSubscription,\n 404: ResourceNotFound,\n 409: SubscriptionLocked,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createSubscriptionsService(client: ClientBase) {\n return {\n list: listSubscriptions(client),\n create: createSubscriptions(client),\n export: exportSubscriptions(client),\n get: getSubscriptions(client),\n revoke: revokeSubscriptions(client),\n update: updateSubscriptions(client),\n iterList: iterListSubscriptions(client),\n };\n}\n\nexport type Subscriptions = ReturnType<typeof createSubscriptionsService>;\n"],"mappings":";;AAqBA,MAAa,qBAAqB,WAAuB;;;;;;;;;;;;;CAavD,OAAO,OAAO,UAgB2B;EACvC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,YAAY,OAAO;GACnB,aAAa,OAAO;GACpB,sBAAsB,OAAO;GAC7B,aAAa,OAAO;GACpB,QAAQ,OAAO;GACf,QAAQ,OAAO;GACf,sBAAsB,OAAO;GAC7B,8BAA8B,OAAO;GACrC,mBAAmB,OAAO;GAC1B,oBAAoB,OAAO;GAC3B,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;GACzC,UAAU,OAAO;EACnB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,sBACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAwC,UAAU,QAAQ,EACtE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,yBAAyB,WAAuB;CAC3D,OAAO,iBAAiB,OAgBS;EAC/B,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,kBAAkB,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GAC1E,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AACA,MAAa,uBAAuB,WAAuB;;;;;;;;;;;;;;;;;;CAkBzD,OAAO,OACL,S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ACrB,SACA,0BACA,YACA,CAAU,GACV,IACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA4B,UAAU,QAAQ;GAC1D,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AAEA,SAAgB,2BAA2B,QAAoB;CAC7D,OAAO;EACL,MAAM,kBAAkB,MAAM;EAC9B,QAAQ,oBAAoB,MAAM;EAClC,QAAQ,oBAAoB,MAAM;EAClC,KAAK,iBAAiB,MAAM;EAC5B,QAAQ,oBAAoB,MAAM;EAClC,QAAQ,oBAAoB,MAAM;EAClC,UAAU,sBAAsB,MAAM;CACxC;AACF"}
|
|
@@ -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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OACA,2BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA2C,UAAU,QAAQ,EACzE,KAAKA,eAAAA,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,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<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,CAA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AAAA;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,4 +1,4 @@
|
|
|
1
|
-
import { Ci as
|
|
1
|
+
import { Ci as WebhookDelivery, Di as WebhookEventType, Ei as WebhookEndpointUpdate, Jn as ListResourceWebhookDelivery, Ti as WebhookEndpointCreate, Yn as ListResourceWebhookEndpoint, wi as WebhookEndpoint } from "../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/webhooks.d.ts
|
|
4
4
|
declare const listWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
|
|
@@ -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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ci as
|
|
1
|
+
import { Ci as WebhookDelivery, Di as WebhookEventType, Ei as WebhookEndpointUpdate, Jn as ListResourceWebhookDelivery, Ti as WebhookEndpointCreate, Yn as ListResourceWebhookEndpoint, wi as WebhookEndpoint } from "../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/webhooks.d.ts
|
|
4
4
|
declare const listWebhookEndpointsWebhooks: (client: ClientBase) => (query?: {
|
|
@@ -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;GAC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AAO,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,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,OA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