@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 { An as ListResourceCustomerWallet, Nt as CustomerWallet, Pt as CustomerWalletSortProperty } from "../../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/wallets.d.ts
|
|
4
4
|
declare const listWallets: (client: ClientBase) => (query?: {
|
|
@@ -16,7 +16,7 @@ declare const listWallets: (client: ClientBase) => (query?: {
|
|
|
16
16
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
17
17
|
* @throws {HTTPValidationError} Validation Error
|
|
18
18
|
*/
|
|
19
|
-
declare const
|
|
19
|
+
declare const iterListWallets: (client: ClientBase) => (query?: {
|
|
20
20
|
page?: number;
|
|
21
21
|
limit?: number;
|
|
22
22
|
sorting?: CustomerWalletSortProperty[] | null;
|
|
@@ -29,7 +29,7 @@ declare function createWalletsService(client: ClientBase): {
|
|
|
29
29
|
sorting?: CustomerWalletSortProperty[] | null;
|
|
30
30
|
}) => Promise<ListResourceCustomerWallet>;
|
|
31
31
|
get: (id: string) => Promise<CustomerWallet>;
|
|
32
|
-
|
|
32
|
+
iterList: (query?: {
|
|
33
33
|
page?: number;
|
|
34
34
|
limit?: number;
|
|
35
35
|
sorting?: CustomerWalletSortProperty[] | null;
|
|
@@ -37,5 +37,5 @@ declare function createWalletsService(client: ClientBase): {
|
|
|
37
37
|
};
|
|
38
38
|
type Wallets = ReturnType<typeof createWalletsService>;
|
|
39
39
|
//#endregion
|
|
40
|
-
export { Wallets, createWalletsService, getWallets,
|
|
40
|
+
export { Wallets, createWalletsService, getWallets, iterListWallets, listWallets };
|
|
41
41
|
//# sourceMappingURL=wallets.d.mts.map
|
|
@@ -33,7 +33,7 @@ const listWallets = (client) => {
|
|
|
33
33
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
34
34
|
* @throws {HTTPValidationError} Validation Error
|
|
35
35
|
*/
|
|
36
|
-
const
|
|
36
|
+
const iterListWallets = (client) => {
|
|
37
37
|
return async function* (query) {
|
|
38
38
|
let page;
|
|
39
39
|
page = query?.page ?? 1;
|
|
@@ -77,10 +77,10 @@ function createWalletsService(client) {
|
|
|
77
77
|
return {
|
|
78
78
|
list: listWallets(client),
|
|
79
79
|
get: getWallets(client),
|
|
80
|
-
|
|
80
|
+
iterList: iterListWallets(client)
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
-
export { createWalletsService, getWallets,
|
|
84
|
+
export { createWalletsService, getWallets, iterListWallets, listWallets };
|
|
85
85
|
|
|
86
86
|
//# sourceMappingURL=wallets.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/wallets.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerWallet,\n CustomerWalletSortProperty,\n ListResourceCustomerWallet,\n} from \"../../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../../errors\";\n\nexport const listWallets = (client: ClientBase) => {\n /**\n * List wallets of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerWallet}\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 page?: number;\n limit?: number;\n sorting?: CustomerWalletSortProperty[] | null;\n }): Promise<ListResourceCustomerWallet> => {\n const pathParams = {};\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-created_at\"],\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/wallets/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerWallet>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List wallets of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerWallet>} A generator that yields items of type CustomerWallet.\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
|
|
1
|
+
{"version":3,"file":"wallets.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/wallets.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerWallet,\n CustomerWalletSortProperty,\n ListResourceCustomerWallet,\n} from \"../../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../../errors\";\n\nexport const listWallets = (client: ClientBase) => {\n /**\n * List wallets of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerWallet}\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 page?: number;\n limit?: number;\n sorting?: CustomerWalletSortProperty[] | null;\n }): Promise<ListResourceCustomerWallet> => {\n const pathParams = {};\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-created_at\"],\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/wallets/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerWallet>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List wallets of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerWallet>} A generator that yields items of type CustomerWallet.\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 iterListWallets = (client: ClientBase) => {\n return async function* (query?: {\n page?: number;\n limit?: number;\n sorting?: CustomerWalletSortProperty[] | null;\n }): AsyncGenerator<CustomerWallet> {\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 listWallets(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 getWallets = (client: ClientBase) => {\n /**\n * Get a wallet by ID for the authenticated customer.\n *\n * @param id - The wallet ID.\n * @returns {CustomerWallet}\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} Wallet not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerWallet> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/wallets/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerWallet>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createWalletsService(client: ClientBase) {\n return {\n list: listWallets(client),\n get: getWallets(client),\n iterList: iterListWallets(client),\n };\n}\n\nexport type Wallets = ReturnType<typeof createWalletsService>;\n"],"mappings":";;AASA,MAAa,eAAe,WAAuB;;;;;;;;;;;CAWjD,OAAO,OAAO,UAI6B;EACzC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;EAC3C;EACA,MAAM,UAAU,OAAO,aACrB,OACA,gCACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA0C,UAAU,QAAQ,EACxE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;AAWA,MAAa,mBAAmB,WAAuB;CACrD,OAAO,iBAAiB,OAIW;EACjC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,YAAY,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACpE,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AACA,MAAa,cAAc,WAAuB;;;;;;;;;;;;CAYhD,OAAO,OAAO,OAAwC;EACpD,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,OACA,oCACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA8B,UAAU,QAAQ;GAC5D,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AAEA,SAAgB,qBAAqB,QAAoB;CACvD,OAAO;EACL,MAAM,YAAY,MAAM;EACxB,KAAK,WAAW,MAAM;EACtB,UAAU,gBAAgB,MAAM;CAClC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { St as CustomerSeatClaimResponse, ai as SeatAssign, bt as CustomerSeat, ci as SeatsList, oi as SeatClaim, si as SeatClaimInfo } from "../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customer_seats.d.ts
|
|
4
4
|
declare const listSeatsCustomerSeats: (client: ClientBase) => (query?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { St as CustomerSeatClaimResponse, ai as SeatAssign, bt as CustomerSeat, ci as SeatsList, oi as SeatClaim, si as SeatClaimInfo } from "../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customer_seats.d.ts
|
|
4
4
|
declare const listSeatsCustomerSeats: (client: ClientBase) => (query?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as
|
|
1
|
+
import { Ct as CustomerSession, Tt as CustomerSessionCustomerIDCreate, wt as CustomerSessionCustomerExternalIDCreate } from "../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customer_sessions.d.ts
|
|
4
4
|
declare const createCustomerSessions: (client: ClientBase) => (body: CustomerSessionCustomerIDCreate | CustomerSessionCustomerExternalIDCreate) => Promise<CustomerSession>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as
|
|
1
|
+
import { Ct as CustomerSession, Tt as CustomerSessionCustomerIDCreate, wt as CustomerSessionCustomerExternalIDCreate } from "../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customer_sessions.d.ts
|
|
4
4
|
declare const createCustomerSessions: (client: ClientBase) => (body: CustomerSessionCustomerIDCreate | CustomerSessionCustomerExternalIDCreate) => Promise<CustomerSession>;
|
|
@@ -44,7 +44,7 @@ const listCustomers = (client) => {
|
|
|
44
44
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
45
45
|
* @throws {HTTPValidationError} Validation Error
|
|
46
46
|
*/
|
|
47
|
-
const
|
|
47
|
+
const iterListCustomers = (client) => {
|
|
48
48
|
return async function* (query) {
|
|
49
49
|
let page;
|
|
50
50
|
page = query?.page ?? 1;
|
|
@@ -373,7 +373,7 @@ const listPaymentMethodsCustomers = (client) => {
|
|
|
373
373
|
* @throws {ResourceNotFound} Customer not found.
|
|
374
374
|
* @throws {HTTPValidationError} Validation Error
|
|
375
375
|
*/
|
|
376
|
-
const
|
|
376
|
+
const iterListPaymentMethodsCustomers = (client) => {
|
|
377
377
|
return async function* (id, query) {
|
|
378
378
|
let page;
|
|
379
379
|
page = query?.page ?? 1;
|
|
@@ -434,7 +434,7 @@ const listPaymentMethodsExternalCustomers = (client) => {
|
|
|
434
434
|
* @throws {ResourceNotFound} Customer not found.
|
|
435
435
|
* @throws {HTTPValidationError} Validation Error
|
|
436
436
|
*/
|
|
437
|
-
const
|
|
437
|
+
const iterListPaymentMethodsExternalCustomers = (client) => {
|
|
438
438
|
return async function* (external_id, query) {
|
|
439
439
|
let page;
|
|
440
440
|
page = query?.page ?? 1;
|
|
@@ -467,9 +467,9 @@ function createCustomersService(client) {
|
|
|
467
467
|
getStateExternal: getStateExternalCustomers(client),
|
|
468
468
|
listPaymentMethods: listPaymentMethodsCustomers(client),
|
|
469
469
|
listPaymentMethodsExternal: listPaymentMethodsExternalCustomers(client),
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
470
|
+
iterList: iterListCustomers(client),
|
|
471
|
+
iterListPaymentMethods: iterListPaymentMethodsCustomers(client),
|
|
472
|
+
iterListPaymentMethodsExternal: iterListPaymentMethodsExternalCustomers(client),
|
|
473
473
|
members: require_2026_04_services_customers_members.createMembersService(client)
|
|
474
474
|
};
|
|
475
475
|
}
|
|
@@ -483,9 +483,9 @@ exports.getCustomers = getCustomers;
|
|
|
483
483
|
exports.getExternalCustomers = getExternalCustomers;
|
|
484
484
|
exports.getStateCustomers = getStateCustomers;
|
|
485
485
|
exports.getStateExternalCustomers = getStateExternalCustomers;
|
|
486
|
-
exports.
|
|
487
|
-
exports.
|
|
488
|
-
exports.
|
|
486
|
+
exports.iterListCustomers = iterListCustomers;
|
|
487
|
+
exports.iterListPaymentMethodsCustomers = iterListPaymentMethodsCustomers;
|
|
488
|
+
exports.iterListPaymentMethodsExternalCustomers = iterListPaymentMethodsExternalCustomers;
|
|
489
489
|
exports.listCustomers = listCustomers;
|
|
490
490
|
exports.listPaymentMethodsCustomers = listPaymentMethodsCustomers;
|
|
491
491
|
exports.listPaymentMethodsExternalCustomers = listPaymentMethodsExternalCustomers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["HTTPValidationError","ResourceNotFound","createMembersService"],"sources":["../../../../src/2026-04/services/customers/index.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n Customer,\n CustomerCreate,\n CustomerSortProperty,\n CustomerState,\n CustomerUpdate,\n CustomerUpdateExternalID,\n ListResourceCustomer,\n ListResourcePaymentMethod,\n MetadataQuery,\n PaymentMethod,\n} from \"../../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../../errors\";\nimport { createMembersService } from \"./members\";\n\nexport const listCustomers = (client: ClientBase) => {\n /**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomer}\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 email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): Promise<ListResourceCustomer> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n email: query?.email,\n query: query?.query,\n active: query?.active,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-created_at\"],\n metadata: query?.metadata,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<Customer>} A generator that yields items of type Customer.\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 iterlistCustomers = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): AsyncGenerator<Customer> {\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 listCustomers(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 createCustomers = (client: ClientBase) => {\n /**\n * Create a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param body - Request body\n * @returns {Customer}\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: CustomerCreate): Promise<Customer> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\"POST\", \"/v1/customers/\", pathParams, queryParams, body);\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const exportCustomers = (client: ClientBase) => {\n /**\n * Export customers as a CSV file.\n *\n * **Scopes**: `customers:read` `customers: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/customers/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 getCustomers = (client: ClientBase) => {\n /**\n * Get a customer by ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteCustomers = (client: ClientBase) => {\n /**\n * Delete a customer.\n *\n * This action cannot be undone and will immediately:\n * - Cancel any active subscriptions for the customer\n * - Revoke all their benefits\n * - Clear any `external_id`\n *\n * Use it only in the context of deleting a user within your\n * own service. Otherwise, use more granular API endpoints to cancel\n * a specific subscription or revoke certain benefits.\n *\n * Note: The customers information will nonetheless be retained for historic\n * orders and subscriptions.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/{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 updateCustomers = (client: ClientBase) => {\n /**\n * Update a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerUpdate): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteExternalCustomers = (client: ClientBase) => {\n /**\n * Delete a customer by external ID.\n *\n * Immediately cancels any active subscriptions and revokes any active benefits.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/external/{external_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 updateExternalCustomers = (client: ClientBase) => {\n /**\n * Update a customer by external ID.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string, body: CustomerUpdateExternalID): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerState> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by external ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<CustomerState> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listPaymentMethodsCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistPaymentMethodsCustomers = (client: ClientBase) => {\n return async function* (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsCustomers(client)(id, { ...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 listPaymentMethodsExternalCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistPaymentMethodsExternalCustomers = (client: ClientBase) => {\n return async function* (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsExternalCustomers(client)(external_id, {\n ...query,\n page,\n limit,\n });\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};\n\nexport function createCustomersService(client: ClientBase) {\n return {\n list: listCustomers(client),\n create: createCustomers(client),\n export: exportCustomers(client),\n get: getCustomers(client),\n delete: deleteCustomers(client),\n update: updateCustomers(client),\n getExternal: getExternalCustomers(client),\n deleteExternal: deleteExternalCustomers(client),\n updateExternal: updateExternalCustomers(client),\n getState: getStateCustomers(client),\n getStateExternal: getStateExternalCustomers(client),\n listPaymentMethods: listPaymentMethodsCustomers(client),\n listPaymentMethodsExternal: listPaymentMethodsExternalCustomers(client),\n iterlist: iterlistCustomers(client),\n iterlistPaymentMethods: iterlistPaymentMethodsCustomers(client),\n iterlistPaymentMethodsExternal: iterlistPaymentMethodsExternalCustomers(client),\n members: createMembersService(client),\n };\n}\n\nexport type Customers = ReturnType<typeof createCustomersService>;\n"],"mappings":";;;;AAiBA,MAAa,iBAAiB,WAAuB;;;;;;;;;;;;;CAanD,OAAO,OAAO,UASuB;EACnC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,MAAM,OAAO,QAA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;EAC/B,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,oCAAoC,MAAM,CAAC,CAAC,aAAa;IAC9E,GAAG;IACH;IACA;GACF,CAAC;GACD,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,uBAAuB,QAAoB;CACzD,OAAO;EACL,MAAM,cAAc,MAAM;EAC1B,QAAQ,gBAAgB,MAAM;EAC9B,QAAQ,gBAAgB,MAAM;EAC9B,KAAK,aAAa,MAAM;EACxB,QAAQ,gBAAgB,MAAM;EAC9B,QAAQ,gBAAgB,MAAM;EAC9B,aAAa,qBAAqB,MAAM;EACxC,gBAAgB,wBAAwB,MAAM;EAC9C,gBAAgB,wBAAwB,MAAM;EAC9C,UAAU,kBAAkB,MAAM;EAClC,kBAAkB,0BAA0B,MAAM;EAClD,oBAAoB,4BAA4B,MAAM;EACtD,4BAA4B,oCAAoC,MAAM;EACtE,UAAU,kBAAkB,MAAM;EAClC,wBAAwB,gCAAgC,MAAM;EAC9D,gCAAgC,wCAAwC,MAAM;EAC9E,SAASE,2CAAAA,qBAAqB,MAAM;CACtC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["HTTPValidationError","ResourceNotFound","createMembersService"],"sources":["../../../../src/2026-04/services/customers/index.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n Customer,\n CustomerCreate,\n CustomerSortProperty,\n CustomerState,\n CustomerUpdate,\n CustomerUpdateExternalID,\n ListResourceCustomer,\n ListResourcePaymentMethod,\n MetadataQuery,\n PaymentMethod,\n} from \"../../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../../errors\";\nimport { createMembersService } from \"./members\";\n\nexport const listCustomers = (client: ClientBase) => {\n /**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomer}\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 email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): Promise<ListResourceCustomer> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n email: query?.email,\n query: query?.query,\n active: query?.active,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-created_at\"],\n metadata: query?.metadata,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<Customer>} A generator that yields items of type Customer.\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 iterListCustomers = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): AsyncGenerator<Customer> {\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 listCustomers(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 createCustomers = (client: ClientBase) => {\n /**\n * Create a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param body - Request body\n * @returns {Customer}\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: CustomerCreate): Promise<Customer> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\"POST\", \"/v1/customers/\", pathParams, queryParams, body);\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const exportCustomers = (client: ClientBase) => {\n /**\n * Export customers as a CSV file.\n *\n * **Scopes**: `customers:read` `customers: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/customers/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 getCustomers = (client: ClientBase) => {\n /**\n * Get a customer by ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteCustomers = (client: ClientBase) => {\n /**\n * Delete a customer.\n *\n * This action cannot be undone and will immediately:\n * - Cancel any active subscriptions for the customer\n * - Revoke all their benefits\n * - Clear any `external_id`\n *\n * Use it only in the context of deleting a user within your\n * own service. Otherwise, use more granular API endpoints to cancel\n * a specific subscription or revoke certain benefits.\n *\n * Note: The customers information will nonetheless be retained for historic\n * orders and subscriptions.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/{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 updateCustomers = (client: ClientBase) => {\n /**\n * Update a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerUpdate): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteExternalCustomers = (client: ClientBase) => {\n /**\n * Delete a customer by external ID.\n *\n * Immediately cancels any active subscriptions and revokes any active benefits.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/external/{external_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 updateExternalCustomers = (client: ClientBase) => {\n /**\n * Update a customer by external ID.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string, body: CustomerUpdateExternalID): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerState> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by external ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<CustomerState> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listPaymentMethodsCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListPaymentMethodsCustomers = (client: ClientBase) => {\n return async function* (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsCustomers(client)(id, { ...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 listPaymentMethodsExternalCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListPaymentMethodsExternalCustomers = (client: ClientBase) => {\n return async function* (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsExternalCustomers(client)(external_id, {\n ...query,\n page,\n limit,\n });\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};\n\nexport function createCustomersService(client: ClientBase) {\n return {\n list: listCustomers(client),\n create: createCustomers(client),\n export: exportCustomers(client),\n get: getCustomers(client),\n delete: deleteCustomers(client),\n update: updateCustomers(client),\n getExternal: getExternalCustomers(client),\n deleteExternal: deleteExternalCustomers(client),\n updateExternal: updateExternalCustomers(client),\n getState: getStateCustomers(client),\n getStateExternal: getStateExternalCustomers(client),\n listPaymentMethods: listPaymentMethodsCustomers(client),\n listPaymentMethodsExternal: listPaymentMethodsExternalCustomers(client),\n iterList: iterListCustomers(client),\n iterListPaymentMethods: iterListPaymentMethodsCustomers(client),\n iterListPaymentMethodsExternal: iterListPaymentMethodsExternalCustomers(client),\n members: createMembersService(client),\n };\n}\n\nexport type Customers = ReturnType<typeof createCustomersService>;\n"],"mappings":";;;;AAiBA,MAAa,iBAAiB,WAAuB;;;;;;;;;;;;;CAanD,OAAO,OAAO,UASuB;EACnC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;GACzC,UAAU,OAAO;EACnB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,kBACA,Y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AC,CAAC,aAAa;IAC9E,GAAG;IACH;IACA;GACF,CAAC;GACD,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,uBAAuB,QAAoB;CACzD,OAAO;EACL,MAAM,cAAc,MAAM;EAC1B,QAAQ,gBAAgB,MAAM;EAC9B,QAAQ,gBAAgB,MAAM;EAC9B,KAAK,aAAa,MAAM;EACxB,QAAQ,gBAAgB,MAAM;EAC9B,QAAQ,gBAAgB,MAAM;EAC9B,aAAa,qBAAqB,MAAM;EACxC,gBAAgB,wBAAwB,MAAM;EAC9C,gBAAgB,wBAAwB,MAAM;EAC9C,UAAU,kBAAkB,MAAM;EAClC,kBAAkB,0BAA0B,MAAM;EAClD,oBAAoB,4BAA4B,MAAM;EACtD,4BAA4B,oCAAoC,MAAM;EACtE,UAAU,kBAAkB,MAAM;EAClC,wBAAwB,gCAAgC,MAAM;EAC9D,gCAAgC,wCAAwC,MAAM;EAC9E,SAASE,2CAAAA,qBAAqB,MAAM;CACtC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as MemberCreateFromCustomer, Dt as CustomerState, Et as CustomerSortProperty, K as CustomerCreate, Mt as CustomerUpdateExternalID, Qn as Member, Sn as ListResourceCustomer, V as Customer, Wn as ListResourcePaymentMethod, jt as CustomerUpdate, nr as MemberUpdate, rr as MetadataQuery, zr as PaymentMethod } from "../../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customers/index.d.ts
|
|
4
4
|
declare const listCustomers: (client: ClientBase) => (query?: {
|
|
@@ -23,7 +23,7 @@ declare const listCustomers: (client: ClientBase) => (query?: {
|
|
|
23
23
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
24
24
|
* @throws {HTTPValidationError} Validation Error
|
|
25
25
|
*/
|
|
26
|
-
declare const
|
|
26
|
+
declare const iterListCustomers: (client: ClientBase) => (query?: {
|
|
27
27
|
organization_id?: string | string[] | null;
|
|
28
28
|
email?: string | null;
|
|
29
29
|
query?: string | null;
|
|
@@ -67,7 +67,7 @@ declare const listPaymentMethodsCustomers: (client: ClientBase) => (id: string,
|
|
|
67
67
|
* @throws {ResourceNotFound} Customer not found.
|
|
68
68
|
* @throws {HTTPValidationError} Validation Error
|
|
69
69
|
*/
|
|
70
|
-
declare const
|
|
70
|
+
declare const iterListPaymentMethodsCustomers: (client: ClientBase) => (id: string, query?: {
|
|
71
71
|
page?: number;
|
|
72
72
|
limit?: number;
|
|
73
73
|
}) => AsyncGenerator<PaymentMethod>;
|
|
@@ -89,7 +89,7 @@ declare const listPaymentMethodsExternalCustomers: (client: ClientBase) => (exte
|
|
|
89
89
|
* @throws {ResourceNotFound} Customer not found.
|
|
90
90
|
* @throws {HTTPValidationError} Validation Error
|
|
91
91
|
*/
|
|
92
|
-
declare const
|
|
92
|
+
declare const iterListPaymentMethodsExternalCustomers: (client: ClientBase) => (external_id: string, query?: {
|
|
93
93
|
page?: number;
|
|
94
94
|
limit?: number;
|
|
95
95
|
}) => AsyncGenerator<PaymentMethod>;
|
|
@@ -128,7 +128,7 @@ declare function createCustomersService(client: ClientBase): {
|
|
|
128
128
|
page?: number;
|
|
129
129
|
limit?: number;
|
|
130
130
|
}) => Promise<ListResourcePaymentMethod>;
|
|
131
|
-
|
|
131
|
+
iterList: (query?: {
|
|
132
132
|
organization_id?: string | string[] | null;
|
|
133
133
|
email?: string | null;
|
|
134
134
|
query?: string | null;
|
|
@@ -138,11 +138,11 @@ declare function createCustomersService(client: ClientBase): {
|
|
|
138
138
|
sorting?: CustomerSortProperty[] | null;
|
|
139
139
|
metadata?: MetadataQuery;
|
|
140
140
|
}) => AsyncGenerator<Customer>;
|
|
141
|
-
|
|
141
|
+
iterListPaymentMethods: (id: string, query?: {
|
|
142
142
|
page?: number;
|
|
143
143
|
limit?: number;
|
|
144
144
|
}) => AsyncGenerator<PaymentMethod>;
|
|
145
|
-
|
|
145
|
+
iterListPaymentMethodsExternal: (external_id: string, query?: {
|
|
146
146
|
page?: number;
|
|
147
147
|
limit?: number;
|
|
148
148
|
}) => AsyncGenerator<PaymentMethod>;
|
|
@@ -159,5 +159,5 @@ declare function createCustomersService(client: ClientBase): {
|
|
|
159
159
|
};
|
|
160
160
|
type Customers = ReturnType<typeof createCustomersService>;
|
|
161
161
|
//#endregion
|
|
162
|
-
export { Customers, createCustomers, createCustomersService, deleteCustomers, deleteExternalCustomers, exportCustomers, getCustomers, getExternalCustomers, getStateCustomers, getStateExternalCustomers,
|
|
162
|
+
export { Customers, createCustomers, createCustomersService, deleteCustomers, deleteExternalCustomers, exportCustomers, getCustomers, getExternalCustomers, getStateCustomers, getStateExternalCustomers, iterListCustomers, iterListPaymentMethodsCustomers, iterListPaymentMethodsExternalCustomers, listCustomers, listPaymentMethodsCustomers, listPaymentMethodsExternalCustomers, updateCustomers, updateExternalCustomers };
|
|
163
163
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as MemberCreateFromCustomer, Dt as CustomerState, Et as CustomerSortProperty, K as CustomerCreate, Mt as CustomerUpdateExternalID, Qn as Member, Sn as ListResourceCustomer, V as Customer, Wn as ListResourcePaymentMethod, jt as CustomerUpdate, nr as MemberUpdate, rr as MetadataQuery, zr as PaymentMethod } from "../../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customers/index.d.ts
|
|
4
4
|
declare const listCustomers: (client: ClientBase) => (query?: {
|
|
@@ -23,7 +23,7 @@ declare const listCustomers: (client: ClientBase) => (query?: {
|
|
|
23
23
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
24
24
|
* @throws {HTTPValidationError} Validation Error
|
|
25
25
|
*/
|
|
26
|
-
declare const
|
|
26
|
+
declare const iterListCustomers: (client: ClientBase) => (query?: {
|
|
27
27
|
organization_id?: string | string[] | null;
|
|
28
28
|
email?: string | null;
|
|
29
29
|
query?: string | null;
|
|
@@ -67,7 +67,7 @@ declare const listPaymentMethodsCustomers: (client: ClientBase) => (id: string,
|
|
|
67
67
|
* @throws {ResourceNotFound} Customer not found.
|
|
68
68
|
* @throws {HTTPValidationError} Validation Error
|
|
69
69
|
*/
|
|
70
|
-
declare const
|
|
70
|
+
declare const iterListPaymentMethodsCustomers: (client: ClientBase) => (id: string, query?: {
|
|
71
71
|
page?: number;
|
|
72
72
|
limit?: number;
|
|
73
73
|
}) => AsyncGenerator<PaymentMethod>;
|
|
@@ -89,7 +89,7 @@ declare const listPaymentMethodsExternalCustomers: (client: ClientBase) => (exte
|
|
|
89
89
|
* @throws {ResourceNotFound} Customer not found.
|
|
90
90
|
* @throws {HTTPValidationError} Validation Error
|
|
91
91
|
*/
|
|
92
|
-
declare const
|
|
92
|
+
declare const iterListPaymentMethodsExternalCustomers: (client: ClientBase) => (external_id: string, query?: {
|
|
93
93
|
page?: number;
|
|
94
94
|
limit?: number;
|
|
95
95
|
}) => AsyncGenerator<PaymentMethod>;
|
|
@@ -128,7 +128,7 @@ declare function createCustomersService(client: ClientBase): {
|
|
|
128
128
|
page?: number;
|
|
129
129
|
limit?: number;
|
|
130
130
|
}) => Promise<ListResourcePaymentMethod>;
|
|
131
|
-
|
|
131
|
+
iterList: (query?: {
|
|
132
132
|
organization_id?: string | string[] | null;
|
|
133
133
|
email?: string | null;
|
|
134
134
|
query?: string | null;
|
|
@@ -138,11 +138,11 @@ declare function createCustomersService(client: ClientBase): {
|
|
|
138
138
|
sorting?: CustomerSortProperty[] | null;
|
|
139
139
|
metadata?: MetadataQuery;
|
|
140
140
|
}) => AsyncGenerator<Customer>;
|
|
141
|
-
|
|
141
|
+
iterListPaymentMethods: (id: string, query?: {
|
|
142
142
|
page?: number;
|
|
143
143
|
limit?: number;
|
|
144
144
|
}) => AsyncGenerator<PaymentMethod>;
|
|
145
|
-
|
|
145
|
+
iterListPaymentMethodsExternal: (external_id: string, query?: {
|
|
146
146
|
page?: number;
|
|
147
147
|
limit?: number;
|
|
148
148
|
}) => AsyncGenerator<PaymentMethod>;
|
|
@@ -159,5 +159,5 @@ declare function createCustomersService(client: ClientBase): {
|
|
|
159
159
|
};
|
|
160
160
|
type Customers = ReturnType<typeof createCustomersService>;
|
|
161
161
|
//#endregion
|
|
162
|
-
export { Customers, createCustomers, createCustomersService, deleteCustomers, deleteExternalCustomers, exportCustomers, getCustomers, getExternalCustomers, getStateCustomers, getStateExternalCustomers,
|
|
162
|
+
export { Customers, createCustomers, createCustomersService, deleteCustomers, deleteExternalCustomers, exportCustomers, getCustomers, getExternalCustomers, getStateCustomers, getStateExternalCustomers, iterListCustomers, iterListPaymentMethodsCustomers, iterListPaymentMethodsExternalCustomers, listCustomers, listPaymentMethodsCustomers, listPaymentMethodsExternalCustomers, updateCustomers, updateExternalCustomers };
|
|
163
163
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -43,7 +43,7 @@ const listCustomers = (client) => {
|
|
|
43
43
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
44
44
|
* @throws {HTTPValidationError} Validation Error
|
|
45
45
|
*/
|
|
46
|
-
const
|
|
46
|
+
const iterListCustomers = (client) => {
|
|
47
47
|
return async function* (query) {
|
|
48
48
|
let page;
|
|
49
49
|
page = query?.page ?? 1;
|
|
@@ -372,7 +372,7 @@ const listPaymentMethodsCustomers = (client) => {
|
|
|
372
372
|
* @throws {ResourceNotFound} Customer not found.
|
|
373
373
|
* @throws {HTTPValidationError} Validation Error
|
|
374
374
|
*/
|
|
375
|
-
const
|
|
375
|
+
const iterListPaymentMethodsCustomers = (client) => {
|
|
376
376
|
return async function* (id, query) {
|
|
377
377
|
let page;
|
|
378
378
|
page = query?.page ?? 1;
|
|
@@ -433,7 +433,7 @@ const listPaymentMethodsExternalCustomers = (client) => {
|
|
|
433
433
|
* @throws {ResourceNotFound} Customer not found.
|
|
434
434
|
* @throws {HTTPValidationError} Validation Error
|
|
435
435
|
*/
|
|
436
|
-
const
|
|
436
|
+
const iterListPaymentMethodsExternalCustomers = (client) => {
|
|
437
437
|
return async function* (external_id, query) {
|
|
438
438
|
let page;
|
|
439
439
|
page = query?.page ?? 1;
|
|
@@ -466,13 +466,13 @@ function createCustomersService(client) {
|
|
|
466
466
|
getStateExternal: getStateExternalCustomers(client),
|
|
467
467
|
listPaymentMethods: listPaymentMethodsCustomers(client),
|
|
468
468
|
listPaymentMethodsExternal: listPaymentMethodsExternalCustomers(client),
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
469
|
+
iterList: iterListCustomers(client),
|
|
470
|
+
iterListPaymentMethods: iterListPaymentMethodsCustomers(client),
|
|
471
|
+
iterListPaymentMethodsExternal: iterListPaymentMethodsExternalCustomers(client),
|
|
472
472
|
members: createMembersService(client)
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
475
|
//#endregion
|
|
476
|
-
export { createCustomers, createCustomersService, deleteCustomers, deleteExternalCustomers, exportCustomers, getCustomers, getExternalCustomers, getStateCustomers, getStateExternalCustomers,
|
|
476
|
+
export { createCustomers, createCustomersService, deleteCustomers, deleteExternalCustomers, exportCustomers, getCustomers, getExternalCustomers, getStateCustomers, getStateExternalCustomers, iterListCustomers, iterListPaymentMethodsCustomers, iterListPaymentMethodsExternalCustomers, listCustomers, listPaymentMethodsCustomers, listPaymentMethodsExternalCustomers, updateCustomers, updateExternalCustomers };
|
|
477
477
|
|
|
478
478
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/2026-04/services/customers/index.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n Customer,\n CustomerCreate,\n CustomerSortProperty,\n CustomerState,\n CustomerUpdate,\n CustomerUpdateExternalID,\n ListResourceCustomer,\n ListResourcePaymentMethod,\n MetadataQuery,\n PaymentMethod,\n} from \"../../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../../errors\";\nimport { createMembersService } from \"./members\";\n\nexport const listCustomers = (client: ClientBase) => {\n /**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomer}\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 email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): Promise<ListResourceCustomer> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n email: query?.email,\n query: query?.query,\n active: query?.active,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-created_at\"],\n metadata: query?.metadata,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<Customer>} A generator that yields items of type Customer.\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 iterlistCustomers = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): AsyncGenerator<Customer> {\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 listCustomers(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 createCustomers = (client: ClientBase) => {\n /**\n * Create a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param body - Request body\n * @returns {Customer}\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: CustomerCreate): Promise<Customer> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\"POST\", \"/v1/customers/\", pathParams, queryParams, body);\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const exportCustomers = (client: ClientBase) => {\n /**\n * Export customers as a CSV file.\n *\n * **Scopes**: `customers:read` `customers: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/customers/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 getCustomers = (client: ClientBase) => {\n /**\n * Get a customer by ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteCustomers = (client: ClientBase) => {\n /**\n * Delete a customer.\n *\n * This action cannot be undone and will immediately:\n * - Cancel any active subscriptions for the customer\n * - Revoke all their benefits\n * - Clear any `external_id`\n *\n * Use it only in the context of deleting a user within your\n * own service. Otherwise, use more granular API endpoints to cancel\n * a specific subscription or revoke certain benefits.\n *\n * Note: The customers information will nonetheless be retained for historic\n * orders and subscriptions.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/{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 updateCustomers = (client: ClientBase) => {\n /**\n * Update a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerUpdate): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteExternalCustomers = (client: ClientBase) => {\n /**\n * Delete a customer by external ID.\n *\n * Immediately cancels any active subscriptions and revokes any active benefits.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/external/{external_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 updateExternalCustomers = (client: ClientBase) => {\n /**\n * Update a customer by external ID.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string, body: CustomerUpdateExternalID): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerState> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by external ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<CustomerState> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listPaymentMethodsCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistPaymentMethodsCustomers = (client: ClientBase) => {\n return async function* (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsCustomers(client)(id, { ...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 listPaymentMethodsExternalCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistPaymentMethodsExternalCustomers = (client: ClientBase) => {\n return async function* (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsExternalCustomers(client)(external_id, {\n ...query,\n page,\n limit,\n });\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};\n\nexport function createCustomersService(client: ClientBase) {\n return {\n list: listCustomers(client),\n create: createCustomers(client),\n export: exportCustomers(client),\n get: getCustomers(client),\n delete: deleteCustomers(client),\n update: updateCustomers(client),\n getExternal: getExternalCustomers(client),\n deleteExternal: deleteExternalCustomers(client),\n updateExternal: updateExternalCustomers(client),\n getState: getStateCustomers(client),\n getStateExternal: getStateExternalCustomers(client),\n listPaymentMethods: listPaymentMethodsCustomers(client),\n listPaymentMethodsExternal: listPaymentMethodsExternalCustomers(client),\n iterlist: iterlistCustomers(client),\n iterlistPaymentMethods: iterlistPaymentMethodsCustomers(client),\n iterlistPaymentMethodsExternal: iterlistPaymentMethodsExternalCustomers(client),\n members: createMembersService(client),\n };\n}\n\nexport type Customers = ReturnType<typeof createCustomersService>;\n"],"mappings":";;;AAiBA,MAAa,iBAAiB,WAAuB;;;;;;;;;;;;;CAanD,OAAO,OAAO,UASuB;EACnC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,OAAO,OA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AC,aAAa;IAC9E,GAAG;IACH;IACA;GACF,CAAC;GACD,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,uBAAuB,QAAoB;CACzD,OAAO;EACL,MAAM,cAAc,MAAM;EAC1B,QAAQ,gBAAgB,MAAM;EAC9B,QAAQ,gBAAgB,MAAM;EAC9B,KAAK,aAAa,MAAM;EACxB,QAAQ,gBAAgB,MAAM;EAC9B,QAAQ,gBAAgB,MAAM;EAC9B,aAAa,qBAAqB,MAAM;EACxC,gBAAgB,wBAAwB,MAAM;EAC9C,gBAAgB,wBAAwB,MAAM;EAC9C,UAAU,kBAAkB,MAAM;EAClC,kBAAkB,0BAA0B,MAAM;EAClD,oBAAoB,4BAA4B,MAAM;EACtD,4BAA4B,oCAAoC,MAAM;EACtE,UAAU,kBAAkB,MAAM;EAClC,wBAAwB,gCAAgC,MAAM;EAC9D,gCAAgC,wCAAwC,MAAM;EAC9E,SAAS,qBAAqB,MAAM;CACtC;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/2026-04/services/customers/index.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n Customer,\n CustomerCreate,\n CustomerSortProperty,\n CustomerState,\n CustomerUpdate,\n CustomerUpdateExternalID,\n ListResourceCustomer,\n ListResourcePaymentMethod,\n MetadataQuery,\n PaymentMethod,\n} from \"../../models\";\n\nimport { HTTPValidationError, ResourceNotFound } from \"../../errors\";\nimport { createMembersService } from \"./members\";\n\nexport const listCustomers = (client: ClientBase) => {\n /**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomer}\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 email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): Promise<ListResourceCustomer> => {\n const pathParams = {};\n const queryParams = {\n organization_id: query?.organization_id,\n email: query?.email,\n query: query?.query,\n active: query?.active,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-created_at\"],\n metadata: query?.metadata,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List customers.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<Customer>} A generator that yields items of type Customer.\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 iterListCustomers = (client: ClientBase) => {\n return async function* (query?: {\n organization_id?: string | string[] | null;\n email?: string | null;\n query?: string | null;\n active?: boolean | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSortProperty[] | null;\n metadata?: MetadataQuery;\n }): AsyncGenerator<Customer> {\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 listCustomers(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 createCustomers = (client: ClientBase) => {\n /**\n * Create a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param body - Request body\n * @returns {Customer}\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: CustomerCreate): Promise<Customer> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\"POST\", \"/v1/customers/\", pathParams, queryParams, body);\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\nexport const exportCustomers = (client: ClientBase) => {\n /**\n * Export customers as a CSV file.\n *\n * **Scopes**: `customers:read` `customers: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/customers/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 getCustomers = (client: ClientBase) => {\n /**\n * Get a customer by ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteCustomers = (client: ClientBase) => {\n /**\n * Delete a customer.\n *\n * This action cannot be undone and will immediately:\n * - Cancel any active subscriptions for the customer\n * - Revoke all their benefits\n * - Clear any `external_id`\n *\n * Use it only in the context of deleting a user within your\n * own service. Otherwise, use more granular API endpoints to cancel\n * a specific subscription or revoke certain benefits.\n *\n * Note: The customers information will nonetheless be retained for historic\n * orders and subscriptions.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/{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 updateCustomers = (client: ClientBase) => {\n /**\n * Update a customer.\n *\n * **Scopes**: `customers:write`\n *\n * @param id - The customer ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerUpdate): Promise<Customer> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const deleteExternalCustomers = (client: ClientBase) => {\n /**\n * Delete a customer by external ID.\n *\n * Immediately cancels any active subscriptions and revokes any active benefits.\n *\n * Set `anonymize=true` to also anonymize PII for GDPR compliance.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n anonymize?: boolean;\n },\n ): Promise<void> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n anonymize: query?.anonymize,\n };\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customers/external/{external_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 updateExternalCustomers = (client: ClientBase) => {\n /**\n * Update a customer by external ID.\n *\n * **Scopes**: `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param body - Request body\n * @returns {Customer}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string, body: CustomerUpdateExternalID): Promise<Customer> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customers/external/{external_id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<Customer>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerState> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getStateExternalCustomers = (client: ClientBase) => {\n /**\n * Get a customer state by external ID.\n *\n * The customer state includes information about\n * the customer's active subscriptions and benefits.\n *\n * It's the ideal endpoint to use when you need to get a full overview\n * of a customer's status.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @returns {CustomerState}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (external_id: string): Promise<CustomerState> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/state\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerState>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listPaymentMethodsCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/{id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param id - The customer ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListPaymentMethodsCustomers = (client: ClientBase) => {\n return async function* (\n id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsCustomers(client)(id, { ...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 listPaymentMethodsExternalCustomers = (client: ClientBase) => {\n /**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {ListResourcePaymentMethod}\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): Promise<ListResourcePaymentMethod> => {\n const pathParams = {\n external_id: external_id,\n };\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customers/external/{external_id}/payment-methods\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourcePaymentMethod>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * Get saved payment methods of a customer by external ID.\n *\n * **Scopes**: `customers:read` `customers:write`\n *\n * @param external_id - The customer external ID.\n * @param query - Query parameters\n * @returns {AsyncGenerator<PaymentMethod>} A generator that yields items of type PaymentMethod.\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} Customer not found.\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListPaymentMethodsExternalCustomers = (client: ClientBase) => {\n return async function* (\n external_id: string,\n query?: {\n page?: number;\n limit?: number;\n },\n ): AsyncGenerator<PaymentMethod> {\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 listPaymentMethodsExternalCustomers(client)(external_id, {\n ...query,\n page,\n limit,\n });\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};\n\nexport function createCustomersService(client: ClientBase) {\n return {\n list: listCustomers(client),\n create: createCustomers(client),\n export: exportCustomers(client),\n get: getCustomers(client),\n delete: deleteCustomers(client),\n update: updateCustomers(client),\n getExternal: getExternalCustomers(client),\n deleteExternal: deleteExternalCustomers(client),\n updateExternal: updateExternalCustomers(client),\n getState: getStateCustomers(client),\n getStateExternal: getStateExternalCustomers(client),\n listPaymentMethods: listPaymentMethodsCustomers(client),\n listPaymentMethodsExternal: listPaymentMethodsExternalCustomers(client),\n iterList: iterListCustomers(client),\n iterListPaymentMethods: iterListPaymentMethodsCustomers(client),\n iterListPaymentMethodsExternal: iterListPaymentMethodsExternalCustomers(client),\n members: createMembersService(client),\n };\n}\n\nexport type Customers = ReturnType<typeof createCustomersService>;\n"],"mappings":";;;AAiBA,MAAa,iBAAiB,WAAuB;;;;;;;;;;;;;CAanD,OAAO,OAAO,UASuB;EACnC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,OAAO,OAAO;GACd,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;GACzC,UAAU,OAAO;EACnB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,kBACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAoC,UAAU,QAAQ,EAClE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,qBAAqB,WAAuB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qBAAqB,MAAM;EACxC,gBAAgB,wBAAwB,MAAM;EAC9C,gBAAgB,wBAAwB,MAAM;EAC9C,UAAU,kBAAkB,MAAM;EAClC,kBAAkB,0BAA0B,MAAM;EAClD,oBAAoB,4BAA4B,MAAM;EACtD,4BAA4B,oCAAoC,MAAM;EACtE,UAAU,kBAAkB,MAAM;EAClC,wBAAwB,gCAAgC,MAAM;EAC9D,gCAAgC,wCAAwC,MAAM;EAC9E,SAAS,qBAAqB,MAAM;CACtC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as MemberCreateFromCustomer, Qn as Member, nr as MemberUpdate } from "../../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customers/members.d.ts
|
|
4
4
|
declare const createMembers: (client: ClientBase) => (id: string, body: MemberCreateFromCustomer) => Promise<Member>;
|