@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/orders.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerOrder,\n CustomerOrderConfirmPayment,\n CustomerOrderInvoice,\n CustomerOrderPaymentConfirmation,\n CustomerOrderPaymentStatus,\n CustomerOrderReceipt,\n CustomerOrderSortProperty,\n CustomerOrderUpdate,\n ListResourceCustomerOrder,\n ProductBillingType,\n} from \"../../models\";\n\nimport {\n HTTPValidationError,\n ManualRetryLimitExceeded,\n MissingInvoiceBillingDetails,\n OrderNotEligibleForInvoice,\n OrderNotEligibleForRetry,\n PaymentAlreadyInProgress,\n ResourceNotFound,\n} from \"../../errors\";\n\nexport const listOrders = (client: ClientBase) => {\n /**\n * List orders of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerOrder}\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 product_id?: string | string[] | null;\n product_billing_type?: ProductBillingType | ProductBillingType[] | null;\n subscription_id?: string | string[] | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerOrderSortProperty[] | null;\n }): Promise<ListResourceCustomerOrder> => {\n const pathParams = {};\n const queryParams = {\n product_id: query?.product_id,\n product_billing_type: query?.product_billing_type,\n subscription_id: query?.subscription_id,\n query: query?.query,\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/orders/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerOrder>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List orders of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerOrder>} A generator that yields items of type CustomerOrder.\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 iterlistOrders = (client: ClientBase) => {\n return async function* (query?: {\n product_id?: string | string[] | null;\n product_billing_type?: ProductBillingType | ProductBillingType[] | null;\n subscription_id?: string | string[] | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerOrderSortProperty[] | null;\n }): AsyncGenerator<CustomerOrder> {\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 listOrders(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 getOrders = (client: ClientBase) => {\n /**\n * Get an order by ID for the authenticated customer.\n *\n * @param id - The order ID.\n * @returns {CustomerOrder}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrder> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrder>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateOrders = (client: ClientBase) => {\n /**\n * Update an order for the authenticated customer.\n *\n * @param id - The order ID.\n * @param body - Request body\n * @returns {CustomerOrder}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerOrderUpdate): Promise<CustomerOrder> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customer-portal/orders/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrder>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const invoiceOrders = (client: ClientBase) => {\n /**\n * Get an order's invoice data.\n *\n * @param id - The order ID.\n * @returns {CustomerOrderInvoice}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrderInvoice> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}/invoice\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderInvoice>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const generateInvoiceOrders = (client: ClientBase) => {\n /**\n * Trigger generation of an order's invoice.\n *\n * @param id - The order ID.\n * @returns {unknown}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Order not found.\n * @throws {OrderNotEligibleForInvoice} Order is not eligible for invoice generation (invalid status).\n * @throws {MissingInvoiceBillingDetails} Order is missing billing name or address.\n */\n return async (id: string): Promise<unknown> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/orders/{id}/invoice\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<unknown>(response, \"json\", {\n 404: ResourceNotFound,\n 409: OrderNotEligibleForInvoice,\n 422: MissingInvoiceBillingDetails,\n });\n };\n};\nexport const receiptOrders = (client: ClientBase) => {\n /**\n * Get a presigned URL to download an order's receipt PDF.\n *\n * @param id - The order ID.\n * @returns {CustomerOrderReceipt}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrderReceipt> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}/receipt\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderReceipt>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getPaymentStatusOrders = (client: ClientBase) => {\n /**\n * Get the current payment status for an order.\n *\n * @param id - The order ID.\n * @returns {CustomerOrderPaymentStatus}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrderPaymentStatus> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}/payment-status\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderPaymentStatus>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const confirmRetryPaymentOrders = (client: ClientBase) => {\n /**\n * Confirm a retry payment using a Stripe confirmation token.\n *\n * @param id - The order ID.\n * @param body - Request body\n * @returns {CustomerOrderPaymentConfirmation}\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} Order not found.\n * @throws {PaymentAlreadyInProgress} Payment already in progress.\n * @throws {OrderNotEligibleForRetry} Order not eligible for retry or payment confirmation failed.\n * @throws {ManualRetryLimitExceeded} Manual retry limit exceeded.\n */\n return async (\n id: string,\n body: CustomerOrderConfirmPayment,\n ): Promise<CustomerOrderPaymentConfirmation> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/orders/{id}/confirm-payment\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderPaymentConfirmation>(response, \"json\", {\n 404: ResourceNotFound,\n 409: PaymentAlreadyInProgress,\n 422: OrderNotEligibleForRetry,\n 429: ManualRetryLimitExceeded,\n });\n };\n};\n\nexport function createOrdersService(client: ClientBase) {\n return {\n list: listOrders(client),\n get: getOrders(client),\n update: updateOrders(client),\n invoice: invoiceOrders(client),\n generateInvoice: generateInvoiceOrders(client),\n receipt: receiptOrders(client),\n getPaymentStatus: getPaymentStatusOrders(client),\n confirmRetryPayment: confirmRetryPaymentOrders(client),\n iterlist: iterlistOrders(client),\n };\n}\n\nexport type Orders = ReturnType<typeof createOrdersService>;\n"],"mappings":";;AAwBA,MAAa,cAAc,WAAuB;;;;;;;;;;;CAWhD,OAAO,OAAO,UAQ4B;EACxC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,YAAY,OAAO;GACnB,sBAAsB,OAAO;GAC7B,iBAAiB,OAAO;GACxB,OAAO,OAAO;GACd,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;EAC3C;EACA,MAAM,UAAU,OAAO,aACrB,OACA,+BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAyC,UAAU,QAAQ,EACvE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;AAWA,MAAa,kBAAkB,WAAuB;CACpD,OAAO,iBAAiB,OAQU;EAChC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,WAAW,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACnE,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GA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;;;;;;;;;;;;CAYnD,OAAO,OAAO,OAA8C;EAC1D,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,OACA,2CACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAoC,UAAU,QAAQ;GAClE,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,0BAA0B,WAAuB;;;;;;;;;;;;CAY5D,OAAO,OAAO,OAAoD;EAChE,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,OACA,kDACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA0C,UAAU,QAAQ;GACxE,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,6BAA6B,WAAuB;;;;;;;;;;;;;;;CAe/D,OAAO,OACL,IACA,SAC8C;EAC9C,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,QACA,mDACA,YACA,CAAU,GACV,IACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAgD,UAAU,QAAQ;GAC9E,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AAEA,SAAgB,oBAAoB,QAAoB;CACtD,OAAO;EACL,MAAM,WAAW,MAAM;EACvB,KAAK,UAAU,MAAM;EACrB,QAAQ,aAAa,MAAM;EAC3B,SAAS,cAAc,MAAM;EAC7B,iBAAiB,sBAAsB,MAAM;EAC7C,SAAS,cAAc,MAAM;EAC7B,kBAAkB,uBAAuB,MAAM;EAC/C,qBAAqB,0BAA0B,MAAM;EACrD,UAAU,eAAe,MAAM;CACjC;AACF"}
|
|
1
|
+
{"version":3,"file":"orders.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/orders.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerOrder,\n CustomerOrderConfirmPayment,\n CustomerOrderInvoice,\n CustomerOrderPaymentConfirmation,\n CustomerOrderPaymentStatus,\n CustomerOrderReceipt,\n CustomerOrderSortProperty,\n CustomerOrderUpdate,\n ListResourceCustomerOrder,\n ProductBillingType,\n} from \"../../models\";\n\nimport {\n HTTPValidationError,\n ManualRetryLimitExceeded,\n MissingInvoiceBillingDetails,\n OrderNotEligibleForInvoice,\n OrderNotEligibleForRetry,\n PaymentAlreadyInProgress,\n ResourceNotFound,\n} from \"../../errors\";\n\nexport const listOrders = (client: ClientBase) => {\n /**\n * List orders of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerOrder}\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 product_id?: string | string[] | null;\n product_billing_type?: ProductBillingType | ProductBillingType[] | null;\n subscription_id?: string | string[] | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerOrderSortProperty[] | null;\n }): Promise<ListResourceCustomerOrder> => {\n const pathParams = {};\n const queryParams = {\n product_id: query?.product_id,\n product_billing_type: query?.product_billing_type,\n subscription_id: query?.subscription_id,\n query: query?.query,\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/orders/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerOrder>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List orders of the authenticated customer.\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerOrder>} A generator that yields items of type CustomerOrder.\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 iterListOrders = (client: ClientBase) => {\n return async function* (query?: {\n product_id?: string | string[] | null;\n product_billing_type?: ProductBillingType | ProductBillingType[] | null;\n subscription_id?: string | string[] | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerOrderSortProperty[] | null;\n }): AsyncGenerator<CustomerOrder> {\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 listOrders(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 getOrders = (client: ClientBase) => {\n /**\n * Get an order by ID for the authenticated customer.\n *\n * @param id - The order ID.\n * @returns {CustomerOrder}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrder> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrder>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateOrders = (client: ClientBase) => {\n /**\n * Update an order for the authenticated customer.\n *\n * @param id - The order ID.\n * @param body - Request body\n * @returns {CustomerOrder}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerOrderUpdate): Promise<CustomerOrder> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customer-portal/orders/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrder>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const invoiceOrders = (client: ClientBase) => {\n /**\n * Get an order's invoice data.\n *\n * @param id - The order ID.\n * @returns {CustomerOrderInvoice}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrderInvoice> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}/invoice\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderInvoice>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const generateInvoiceOrders = (client: ClientBase) => {\n /**\n * Trigger generation of an order's invoice.\n *\n * @param id - The order ID.\n * @returns {unknown}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {ResourceNotFound} Order not found.\n * @throws {OrderNotEligibleForInvoice} Order is not eligible for invoice generation (invalid status).\n * @throws {MissingInvoiceBillingDetails} Order is missing billing name or address.\n */\n return async (id: string): Promise<unknown> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/orders/{id}/invoice\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<unknown>(response, \"json\", {\n 404: ResourceNotFound,\n 409: OrderNotEligibleForInvoice,\n 422: MissingInvoiceBillingDetails,\n });\n };\n};\nexport const receiptOrders = (client: ClientBase) => {\n /**\n * Get a presigned URL to download an order's receipt PDF.\n *\n * @param id - The order ID.\n * @returns {CustomerOrderReceipt}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrderReceipt> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}/receipt\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderReceipt>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const getPaymentStatusOrders = (client: ClientBase) => {\n /**\n * Get the current payment status for an order.\n *\n * @param id - The order ID.\n * @returns {CustomerOrderPaymentStatus}\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} Order not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerOrderPaymentStatus> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/orders/{id}/payment-status\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderPaymentStatus>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const confirmRetryPaymentOrders = (client: ClientBase) => {\n /**\n * Confirm a retry payment using a Stripe confirmation token.\n *\n * @param id - The order ID.\n * @param body - Request body\n * @returns {CustomerOrderPaymentConfirmation}\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} Order not found.\n * @throws {PaymentAlreadyInProgress} Payment already in progress.\n * @throws {OrderNotEligibleForRetry} Order not eligible for retry or payment confirmation failed.\n * @throws {ManualRetryLimitExceeded} Manual retry limit exceeded.\n */\n return async (\n id: string,\n body: CustomerOrderConfirmPayment,\n ): Promise<CustomerOrderPaymentConfirmation> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/orders/{id}/confirm-payment\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerOrderPaymentConfirmation>(response, \"json\", {\n 404: ResourceNotFound,\n 409: PaymentAlreadyInProgress,\n 422: OrderNotEligibleForRetry,\n 429: ManualRetryLimitExceeded,\n });\n };\n};\n\nexport function createOrdersService(client: ClientBase) {\n return {\n list: listOrders(client),\n get: getOrders(client),\n update: updateOrders(client),\n invoice: invoiceOrders(client),\n generateInvoice: generateInvoiceOrders(client),\n receipt: receiptOrders(client),\n getPaymentStatus: getPaymentStatusOrders(client),\n confirmRetryPayment: confirmRetryPaymentOrders(client),\n iterList: iterListOrders(client),\n };\n}\n\nexport type Orders = ReturnType<typeof createOrdersService>;\n"],"mappings":";;AAwBA,MAAa,cAAc,WAAuB;;;;;;;;;;;CAWhD,OAAO,OAAO,UAQ4B;EACxC,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,YAAY,OAAO;GACnB,sBAAsB,OAAO;GAC7B,iBAAiB,OAAO;GACxB,OAAO,OAAO;GACd,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;EAC3C;EACA,MAAM,UAAU,OAAO,aACrB,OACA,+BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAyC,UAAU,QAAQ,EACvE,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;AAWA,MAAa,kBAAkB,WAAuB;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M;EAC7B,iBAAiB,sBAAsB,MAAM;EAC7C,SAAS,cAAc,MAAM;EAC7B,kBAAkB,uBAAuB,MAAM;EAC/C,qBAAqB,0BAA0B,MAAM;EACrD,UAAU,eAAe,MAAM;CACjC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ut as CustomerOrganizationData } from "../../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/organizations.d.ts
|
|
4
4
|
declare const getOrganizations: (client: ClientBase) => (slug: string) => Promise<CustomerOrganizationData>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ut as CustomerOrganizationData } from "../../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/organizations.d.ts
|
|
4
4
|
declare const getOrganizations: (client: ClientBase) => (slug: string) => Promise<CustomerOrganizationData>;
|
|
@@ -150,7 +150,7 @@ const listClaimedSubscriptionsSeats = (client) => {
|
|
|
150
150
|
* @throws {ListClaimedSubscriptions401Error} Authentication required
|
|
151
151
|
* @throws {HTTPValidationError} Validation Error
|
|
152
152
|
*/
|
|
153
|
-
const
|
|
153
|
+
const iterListClaimedSubscriptionsSeats = (client) => {
|
|
154
154
|
return async function* (query) {
|
|
155
155
|
let page;
|
|
156
156
|
page = query?.page ?? 1;
|
|
@@ -175,13 +175,13 @@ function createSeatsService(client) {
|
|
|
175
175
|
revokeSeat: revokeSeatSeats(client),
|
|
176
176
|
resendInvitation: resendInvitationSeats(client),
|
|
177
177
|
listClaimedSubscriptions: listClaimedSubscriptionsSeats(client),
|
|
178
|
-
|
|
178
|
+
iterListClaimedSubscriptions: iterListClaimedSubscriptionsSeats(client)
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
//#endregion
|
|
182
182
|
exports.assignSeatSeats = assignSeatSeats;
|
|
183
183
|
exports.createSeatsService = createSeatsService;
|
|
184
|
-
exports.
|
|
184
|
+
exports.iterListClaimedSubscriptionsSeats = iterListClaimedSubscriptionsSeats;
|
|
185
185
|
exports.listClaimedSubscriptionsSeats = listClaimedSubscriptionsSeats;
|
|
186
186
|
exports.listSeatsSeats = listSeatsSeats;
|
|
187
187
|
exports.resendInvitationSeats = resendInvitationSeats;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seats.cjs","names":["ListSeats401Error","ListSeats403Error","ListSeats404Error","HTTPValidationError","AssignSeat400Error","AssignSeat401Error","AssignSeat403Error","AssignSeat404Error","RevokeSeat401Error","RevokeSeat403Error","RevokeSeat404Error","ResendInvitation400Error","ResendInvitation401Error","ResendInvitation403Error","ResendInvitation404Error","ListClaimedSubscriptions401Error"],"sources":["../../../../src/2026-04/services/customer_portal/seats.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSeat,\n CustomerSeatAssign,\n CustomerSubscription,\n ListResourceCustomerSubscription,\n SeatsList,\n} from \"../../models\";\n\nimport {\n AssignSeat400Error,\n AssignSeat401Error,\n AssignSeat403Error,\n AssignSeat404Error,\n HTTPValidationError,\n ListClaimedSubscriptions401Error,\n ListSeats401Error,\n ListSeats403Error,\n ListSeats404Error,\n ResendInvitation400Error,\n ResendInvitation401Error,\n ResendInvitation403Error,\n ResendInvitation404Error,\n RevokeSeat401Error,\n RevokeSeat403Error,\n RevokeSeat404Error,\n} from \"../../errors\";\n\nexport const listSeatsSeats = (client: ClientBase) => {\n /**\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {SeatsList}\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 {ListSeats401Error} Authentication required\n * @throws {ListSeats403Error} Not permitted or seat-based pricing not enabled\n * @throws {ListSeats404Error} Subscription or order not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n subscription_id?: string | null;\n order_id?: string | null;\n }): Promise<SeatsList> => {\n const pathParams = {};\n const queryParams = {\n subscription_id: query?.subscription_id,\n order_id: query?.order_id,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<SeatsList>(response, \"json\", {\n 401: ListSeats401Error,\n 403: ListSeats403Error,\n 404: ListSeats404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const assignSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param body - Request body\n * @returns {CustomerSeat}\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 {AssignSeat400Error} No available seats or customer already has a seat\n * @throws {AssignSeat401Error} Authentication required\n * @throws {AssignSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {AssignSeat404Error} Subscription, order, or customer not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: CustomerSeatAssign): Promise<CustomerSeat> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: AssignSeat400Error,\n 401: AssignSeat401Error,\n 403: AssignSeat403Error,\n 404: AssignSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const revokeSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {RevokeSeat401Error} Authentication required\n * @throws {RevokeSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {RevokeSeat404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customer-portal/seats/{seat_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 401: RevokeSeat401Error,\n 403: RevokeSeat403Error,\n 404: RevokeSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resendInvitationSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {ResendInvitation400Error} Seat is not pending or already claimed\n * @throws {ResendInvitation401Error} Authentication required\n * @throws {ResendInvitation403Error} Not permitted or seat-based pricing not enabled\n * @throws {ResendInvitation404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats/{seat_id}/resend\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: ResendInvitation400Error,\n 401: ResendInvitation401Error,\n 403: ResendInvitation403Error,\n 404: ResendInvitation404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listClaimedSubscriptionsSeats = (client: ClientBase) => {\n /**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n page?: number;\n limit?: number;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats/subscriptions\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 401: ListClaimedSubscriptions401Error,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistClaimedSubscriptionsSeats = (client: ClientBase) => {\n return async function* (query?: {\n page?: number;\n limit?: number;\n }): AsyncGenerator<CustomerSubscription> {\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 listClaimedSubscriptionsSeats(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};\n\nexport function createSeatsService(client: ClientBase) {\n return {\n listSeats: listSeatsSeats(client),\n assignSeat: assignSeatSeats(client),\n revokeSeat: revokeSeatSeats(client),\n resendInvitation: resendInvitationSeats(client),\n listClaimedSubscriptions: listClaimedSubscriptionsSeats(client),\n iterlistClaimedSubscriptions: iterlistClaimedSubscriptionsSeats(client),\n };\n}\n\nexport type Seats = ReturnType<typeof createSeatsService>;\n"],"mappings":";;;AA4BA,MAAa,kBAAkB,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AAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAA4B,UAAU,QAAQ;GAC1D,KAAKQ,eAAAA;GACL,KAAKC,eAAAA;GACL,KAAKC,eAAAA;GACL,KAAKC,eAAAA;GACL,KAAKX,eAAAA;EACP,CAAC;CACH;AACF;AACA,MAAa,iCAAiC,WAAuB;;;;;;;;;;;;;;CAcnE,OAAO,OAAO,UAGmC;EAC/C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;EACzB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,2CACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAgD,UAAU,QAAQ;GAC9E,KAAKY,eAAAA;GACL,KAAKZ,eAAAA;EACP,CAAC;CACH;AACF;;;;;;;;;;;;;;AAcA,MAAa,qCAAqC,WAAuB;CACvE,OAAO,iBAAiB,OAGiB;EACvC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,8BAA8B,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACtF,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,mBAAmB,QAAoB;CACrD,OAAO;EACL,WAAW,eAAe,MAAM;EAChC,YAAY,gBAAgB,MAAM;EAClC,YAAY,gBAAgB,MAAM;EAClC,kBAAkB,sBAAsB,MAAM;EAC9C,0BAA0B,8BAA8B,MAAM;EAC9D,8BAA8B,kCAAkC,MAAM;CACxE;AACF"}
|
|
1
|
+
{"version":3,"file":"seats.cjs","names":["ListSeats401Error","ListSeats403Error","ListSeats404Error","HTTPValidationError","AssignSeat400Error","AssignSeat401Error","AssignSeat403Error","AssignSeat404Error","RevokeSeat401Error","RevokeSeat403Error","RevokeSeat404Error","ResendInvitation400Error","ResendInvitation401Error","ResendInvitation403Error","ResendInvitation404Error","ListClaimedSubscriptions401Error"],"sources":["../../../../src/2026-04/services/customer_portal/seats.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSeat,\n CustomerSeatAssign,\n CustomerSubscription,\n ListResourceCustomerSubscription,\n SeatsList,\n} from \"../../models\";\n\nimport {\n AssignSeat400Error,\n AssignSeat401Error,\n AssignSeat403Error,\n AssignSeat404Error,\n HTTPValidationError,\n ListClaimedSubscriptions401Error,\n ListSeats401Error,\n ListSeats403Error,\n ListSeats404Error,\n ResendInvitation400Error,\n ResendInvitation401Error,\n ResendInvitation403Error,\n ResendInvitation404Error,\n RevokeSeat401Error,\n RevokeSeat403Error,\n RevokeSeat404Error,\n} from \"../../errors\";\n\nexport const listSeatsSeats = (client: ClientBase) => {\n /**\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {SeatsList}\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 {ListSeats401Error} Authentication required\n * @throws {ListSeats403Error} Not permitted or seat-based pricing not enabled\n * @throws {ListSeats404Error} Subscription or order not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n subscription_id?: string | null;\n order_id?: string | null;\n }): Promise<SeatsList> => {\n const pathParams = {};\n const queryParams = {\n subscription_id: query?.subscription_id,\n order_id: query?.order_id,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<SeatsList>(response, \"json\", {\n 401: ListSeats401Error,\n 403: ListSeats403Error,\n 404: ListSeats404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const assignSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param body - Request body\n * @returns {CustomerSeat}\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 {AssignSeat400Error} No available seats or customer already has a seat\n * @throws {AssignSeat401Error} Authentication required\n * @throws {AssignSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {AssignSeat404Error} Subscription, order, or customer not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: CustomerSeatAssign): Promise<CustomerSeat> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: AssignSeat400Error,\n 401: AssignSeat401Error,\n 403: AssignSeat403Error,\n 404: AssignSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const revokeSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {RevokeSeat401Error} Authentication required\n * @throws {RevokeSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {RevokeSeat404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customer-portal/seats/{seat_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 401: RevokeSeat401Error,\n 403: RevokeSeat403Error,\n 404: RevokeSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resendInvitationSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {ResendInvitation400Error} Seat is not pending or already claimed\n * @throws {ResendInvitation401Error} Authentication required\n * @throws {ResendInvitation403Error} Not permitted or seat-based pricing not enabled\n * @throws {ResendInvitation404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats/{seat_id}/resend\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: ResendInvitation400Error,\n 401: ResendInvitation401Error,\n 403: ResendInvitation403Error,\n 404: ResendInvitation404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listClaimedSubscriptionsSeats = (client: ClientBase) => {\n /**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n page?: number;\n limit?: number;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats/subscriptions\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 401: ListClaimedSubscriptions401Error,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListClaimedSubscriptionsSeats = (client: ClientBase) => {\n return async function* (query?: {\n page?: number;\n limit?: number;\n }): AsyncGenerator<CustomerSubscription> {\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 listClaimedSubscriptionsSeats(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};\n\nexport function createSeatsService(client: ClientBase) {\n return {\n listSeats: listSeatsSeats(client),\n assignSeat: assignSeatSeats(client),\n revokeSeat: revokeSeatSeats(client),\n resendInvitation: resendInvitationSeats(client),\n listClaimedSubscriptions: listClaimedSubscriptionsSeats(client),\n iterListClaimedSubscriptions: iterListClaimedSubscriptionsSeats(client),\n };\n}\n\nexport type Seats = ReturnType<typeof createSeatsService>;\n"],"mappings":";;;AA4BA,MAAa,kBAAkB,WAAuB;;;;;;;;;;;;;;CAcpD,OAAO,OAAO,UAGY;EACxB,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,UAAU,OAAO;EACnB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,6BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAyB,UAAU,QAAQ;GACvD,KAAKA,eAAAA;GACL,KAAKC,eAAAA;GACL,KAAKC,eAAAA;GACL,KAAKC,eAAAA;EACP,CAAC;CACH;AACF;AACA,MAAa,mBAAmB,WAAuB;;;;;;;;;;;;;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MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAgD,UAAU,QAAQ;GAC9E,KAAKY,eAAAA;GACL,KAAKZ,eAAAA;EACP,CAAC;CACH;AACF;;;;;;;;;;;;;;AAcA,MAAa,qCAAqC,WAAuB;CACvE,OAAO,iBAAiB,OAGiB;EACvC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,8BAA8B,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACtF,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,mBAAmB,QAAoB;CACrD,OAAO;EACL,WAAW,eAAe,MAAM;EAChC,YAAY,gBAAgB,MAAM;EAClC,YAAY,gBAAgB,MAAM;EAClC,kBAAkB,sBAAsB,MAAM;EAC9C,0BAA0B,8BAA8B,MAAM;EAC9D,8BAA8B,kCAAkC,MAAM;CACxE;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ot as CustomerSubscription, bt as CustomerSeat, ci as SeatsList, kn as ListResourceCustomerSubscription, xt as CustomerSeatAssign } from "../../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/seats.d.ts
|
|
4
4
|
declare const listSeatsSeats: (client: ClientBase) => (query?: {
|
|
@@ -25,7 +25,7 @@ declare const listClaimedSubscriptionsSeats: (client: ClientBase) => (query?: {
|
|
|
25
25
|
* @throws {ListClaimedSubscriptions401Error} Authentication required
|
|
26
26
|
* @throws {HTTPValidationError} Validation Error
|
|
27
27
|
*/
|
|
28
|
-
declare const
|
|
28
|
+
declare const iterListClaimedSubscriptionsSeats: (client: ClientBase) => (query?: {
|
|
29
29
|
page?: number;
|
|
30
30
|
limit?: number;
|
|
31
31
|
}) => AsyncGenerator<CustomerSubscription>;
|
|
@@ -41,12 +41,12 @@ declare function createSeatsService(client: ClientBase): {
|
|
|
41
41
|
page?: number;
|
|
42
42
|
limit?: number;
|
|
43
43
|
}) => Promise<ListResourceCustomerSubscription>;
|
|
44
|
-
|
|
44
|
+
iterListClaimedSubscriptions: (query?: {
|
|
45
45
|
page?: number;
|
|
46
46
|
limit?: number;
|
|
47
47
|
}) => AsyncGenerator<CustomerSubscription>;
|
|
48
48
|
};
|
|
49
49
|
type Seats = ReturnType<typeof createSeatsService>;
|
|
50
50
|
//#endregion
|
|
51
|
-
export { Seats, assignSeatSeats, createSeatsService,
|
|
51
|
+
export { Seats, assignSeatSeats, createSeatsService, iterListClaimedSubscriptionsSeats, listClaimedSubscriptionsSeats, listSeatsSeats, resendInvitationSeats, revokeSeatSeats };
|
|
52
52
|
//# sourceMappingURL=seats.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ot as CustomerSubscription, bt as CustomerSeat, ci as SeatsList, kn as ListResourceCustomerSubscription, xt as CustomerSeatAssign } from "../../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/seats.d.ts
|
|
4
4
|
declare const listSeatsSeats: (client: ClientBase) => (query?: {
|
|
@@ -25,7 +25,7 @@ declare const listClaimedSubscriptionsSeats: (client: ClientBase) => (query?: {
|
|
|
25
25
|
* @throws {ListClaimedSubscriptions401Error} Authentication required
|
|
26
26
|
* @throws {HTTPValidationError} Validation Error
|
|
27
27
|
*/
|
|
28
|
-
declare const
|
|
28
|
+
declare const iterListClaimedSubscriptionsSeats: (client: ClientBase) => (query?: {
|
|
29
29
|
page?: number;
|
|
30
30
|
limit?: number;
|
|
31
31
|
}) => AsyncGenerator<CustomerSubscription>;
|
|
@@ -41,12 +41,12 @@ declare function createSeatsService(client: ClientBase): {
|
|
|
41
41
|
page?: number;
|
|
42
42
|
limit?: number;
|
|
43
43
|
}) => Promise<ListResourceCustomerSubscription>;
|
|
44
|
-
|
|
44
|
+
iterListClaimedSubscriptions: (query?: {
|
|
45
45
|
page?: number;
|
|
46
46
|
limit?: number;
|
|
47
47
|
}) => AsyncGenerator<CustomerSubscription>;
|
|
48
48
|
};
|
|
49
49
|
type Seats = ReturnType<typeof createSeatsService>;
|
|
50
50
|
//#endregion
|
|
51
|
-
export { Seats, assignSeatSeats, createSeatsService,
|
|
51
|
+
export { Seats, assignSeatSeats, createSeatsService, iterListClaimedSubscriptionsSeats, listClaimedSubscriptionsSeats, listSeatsSeats, resendInvitationSeats, revokeSeatSeats };
|
|
52
52
|
//# sourceMappingURL=seats.d.mts.map
|
|
@@ -149,7 +149,7 @@ const listClaimedSubscriptionsSeats = (client) => {
|
|
|
149
149
|
* @throws {ListClaimedSubscriptions401Error} Authentication required
|
|
150
150
|
* @throws {HTTPValidationError} Validation Error
|
|
151
151
|
*/
|
|
152
|
-
const
|
|
152
|
+
const iterListClaimedSubscriptionsSeats = (client) => {
|
|
153
153
|
return async function* (query) {
|
|
154
154
|
let page;
|
|
155
155
|
page = query?.page ?? 1;
|
|
@@ -174,10 +174,10 @@ function createSeatsService(client) {
|
|
|
174
174
|
revokeSeat: revokeSeatSeats(client),
|
|
175
175
|
resendInvitation: resendInvitationSeats(client),
|
|
176
176
|
listClaimedSubscriptions: listClaimedSubscriptionsSeats(client),
|
|
177
|
-
|
|
177
|
+
iterListClaimedSubscriptions: iterListClaimedSubscriptionsSeats(client)
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
181
|
-
export { assignSeatSeats, createSeatsService,
|
|
181
|
+
export { assignSeatSeats, createSeatsService, iterListClaimedSubscriptionsSeats, listClaimedSubscriptionsSeats, listSeatsSeats, resendInvitationSeats, revokeSeatSeats };
|
|
182
182
|
|
|
183
183
|
//# sourceMappingURL=seats.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seats.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/seats.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSeat,\n CustomerSeatAssign,\n CustomerSubscription,\n ListResourceCustomerSubscription,\n SeatsList,\n} from \"../../models\";\n\nimport {\n AssignSeat400Error,\n AssignSeat401Error,\n AssignSeat403Error,\n AssignSeat404Error,\n HTTPValidationError,\n ListClaimedSubscriptions401Error,\n ListSeats401Error,\n ListSeats403Error,\n ListSeats404Error,\n ResendInvitation400Error,\n ResendInvitation401Error,\n ResendInvitation403Error,\n ResendInvitation404Error,\n RevokeSeat401Error,\n RevokeSeat403Error,\n RevokeSeat404Error,\n} from \"../../errors\";\n\nexport const listSeatsSeats = (client: ClientBase) => {\n /**\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {SeatsList}\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 {ListSeats401Error} Authentication required\n * @throws {ListSeats403Error} Not permitted or seat-based pricing not enabled\n * @throws {ListSeats404Error} Subscription or order not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n subscription_id?: string | null;\n order_id?: string | null;\n }): Promise<SeatsList> => {\n const pathParams = {};\n const queryParams = {\n subscription_id: query?.subscription_id,\n order_id: query?.order_id,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<SeatsList>(response, \"json\", {\n 401: ListSeats401Error,\n 403: ListSeats403Error,\n 404: ListSeats404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const assignSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param body - Request body\n * @returns {CustomerSeat}\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 {AssignSeat400Error} No available seats or customer already has a seat\n * @throws {AssignSeat401Error} Authentication required\n * @throws {AssignSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {AssignSeat404Error} Subscription, order, or customer not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: CustomerSeatAssign): Promise<CustomerSeat> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: AssignSeat400Error,\n 401: AssignSeat401Error,\n 403: AssignSeat403Error,\n 404: AssignSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const revokeSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {RevokeSeat401Error} Authentication required\n * @throws {RevokeSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {RevokeSeat404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customer-portal/seats/{seat_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 401: RevokeSeat401Error,\n 403: RevokeSeat403Error,\n 404: RevokeSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resendInvitationSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {ResendInvitation400Error} Seat is not pending or already claimed\n * @throws {ResendInvitation401Error} Authentication required\n * @throws {ResendInvitation403Error} Not permitted or seat-based pricing not enabled\n * @throws {ResendInvitation404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats/{seat_id}/resend\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: ResendInvitation400Error,\n 401: ResendInvitation401Error,\n 403: ResendInvitation403Error,\n 404: ResendInvitation404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listClaimedSubscriptionsSeats = (client: ClientBase) => {\n /**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n page?: number;\n limit?: number;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats/subscriptions\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 401: ListClaimedSubscriptions401Error,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterlistClaimedSubscriptionsSeats = (client: ClientBase) => {\n return async function* (query?: {\n page?: number;\n limit?: number;\n }): AsyncGenerator<CustomerSubscription> {\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 listClaimedSubscriptionsSeats(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};\n\nexport function createSeatsService(client: ClientBase) {\n return {\n listSeats: listSeatsSeats(client),\n assignSeat: assignSeatSeats(client),\n revokeSeat: revokeSeatSeats(client),\n resendInvitation: resendInvitationSeats(client),\n listClaimedSubscriptions: listClaimedSubscriptionsSeats(client),\n iterlistClaimedSubscriptions: iterlistClaimedSubscriptionsSeats(client),\n };\n}\n\nexport type Seats = ReturnType<typeof createSeatsService>;\n"],"mappings":";;AA4BA,MAAa,kBAAkB,WAAuB;;;;;;;;;;;;;;CAcpD,OAAO,OAAO,UAGY;EACxB,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,iBAAiB,OAAO;GACxB,UAAU,OAAO;EACnB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,6BACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAyB,UAAU,QAAQ;GACvD,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,mBAAmB,WAAuB;;;;;;;;;;;;;;CAcrD,OAAO,OAAO,SAAoD;EAGhE,MAAM,UAAU,OAAO,aACrB,QACA,6BACA,C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ACvC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,8BAA8B,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACtF,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,mBAAmB,QAAoB;CACrD,OAAO;EACL,WAAW,eAAe,MAAM;EAChC,YAAY,gBAAgB,MAAM;EAClC,YAAY,gBAAgB,MAAM;EAClC,kBAAkB,sBAAsB,MAAM;EAC9C,0BAA0B,8BAA8B,MAAM;EAC9D,8BAA8B,kCAAkC,MAAM;CACxE;AACF"}
|
|
1
|
+
{"version":3,"file":"seats.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/seats.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSeat,\n CustomerSeatAssign,\n CustomerSubscription,\n ListResourceCustomerSubscription,\n SeatsList,\n} from \"../../models\";\n\nimport {\n AssignSeat400Error,\n AssignSeat401Error,\n AssignSeat403Error,\n AssignSeat404Error,\n HTTPValidationError,\n ListClaimedSubscriptions401Error,\n ListSeats401Error,\n ListSeats403Error,\n ListSeats404Error,\n ResendInvitation400Error,\n ResendInvitation401Error,\n ResendInvitation403Error,\n ResendInvitation404Error,\n RevokeSeat401Error,\n RevokeSeat403Error,\n RevokeSeat404Error,\n} from \"../../errors\";\n\nexport const listSeatsSeats = (client: ClientBase) => {\n /**\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {SeatsList}\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 {ListSeats401Error} Authentication required\n * @throws {ListSeats403Error} Not permitted or seat-based pricing not enabled\n * @throws {ListSeats404Error} Subscription or order not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n subscription_id?: string | null;\n order_id?: string | null;\n }): Promise<SeatsList> => {\n const pathParams = {};\n const queryParams = {\n subscription_id: query?.subscription_id,\n order_id: query?.order_id,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<SeatsList>(response, \"json\", {\n 401: ListSeats401Error,\n 403: ListSeats403Error,\n 404: ListSeats404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const assignSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param body - Request body\n * @returns {CustomerSeat}\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 {AssignSeat400Error} No available seats or customer already has a seat\n * @throws {AssignSeat401Error} Authentication required\n * @throws {AssignSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {AssignSeat404Error} Subscription, order, or customer not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (body: CustomerSeatAssign): Promise<CustomerSeat> => {\n const pathParams = {};\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: AssignSeat400Error,\n 401: AssignSeat401Error,\n 403: AssignSeat403Error,\n 404: AssignSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const revokeSeatSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {RevokeSeat401Error} Authentication required\n * @throws {RevokeSeat403Error} Not permitted or seat-based pricing not enabled\n * @throws {RevokeSeat404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customer-portal/seats/{seat_id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 401: RevokeSeat401Error,\n 403: RevokeSeat403Error,\n 404: RevokeSeat404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const resendInvitationSeats = (client: ClientBase) => {\n /**\n *\n * @param seat_id\n * @returns {CustomerSeat}\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 {ResendInvitation400Error} Seat is not pending or already claimed\n * @throws {ResendInvitation401Error} Authentication required\n * @throws {ResendInvitation403Error} Not permitted or seat-based pricing not enabled\n * @throws {ResendInvitation404Error} Seat not found\n * @throws {HTTPValidationError} Validation Error\n */\n return async (seat_id: string): Promise<CustomerSeat> => {\n const pathParams = {\n seat_id: seat_id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"POST\",\n \"/v1/customer-portal/seats/{seat_id}/resend\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSeat>(response, \"json\", {\n 400: ResendInvitation400Error,\n 401: ResendInvitation401Error,\n 403: ResendInvitation403Error,\n 404: ResendInvitation404Error,\n 422: HTTPValidationError,\n });\n };\n};\nexport const listClaimedSubscriptionsSeats = (client: ClientBase) => {\n /**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\n return async (query?: {\n page?: number;\n limit?: number;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/seats/subscriptions\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 401: ListClaimedSubscriptions401Error,\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List all subscriptions where the authenticated customer has claimed a seat.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\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 {ListClaimedSubscriptions401Error} Authentication required\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListClaimedSubscriptionsSeats = (client: ClientBase) => {\n return async function* (query?: {\n page?: number;\n limit?: number;\n }): AsyncGenerator<CustomerSubscription> {\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 listClaimedSubscriptionsSeats(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};\n\nexport function createSeatsService(client: ClientBase) {\n return {\n listSeats: listSeatsSeats(client),\n assignSeat: assignSeatSeats(client),\n revokeSeat: revokeSeatSeats(client),\n resendInvitation: resendInvitationSeats(client),\n listClaimedSubscriptions: listClaimedSubscriptionsSeats(client),\n iterListClaimedSubscriptions: iterListClaimedSubscriptionsSeats(client),\n };\n}\n\nexport type Seats = ReturnType<typeof createSeatsService>;\n"],"mappings":";;AA4BA,MAAa,kBAAkB,WAAuB;;;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P,CAAC;CACH;AACF;AACA,MAAa,iCAAiC,WAAuB;;;;;;;;;;;;;;CAcnE,OAAO,OAAO,UAGmC;EAC/C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;EACzB;EACA,MAAM,UAAU,OAAO,aACrB,OACA,2CACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAgD,UAAU,QAAQ;GAC9E,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;;;;;;;;;;;;;;AAcA,MAAa,qCAAqC,WAAuB;CACvE,OAAO,iBAAiB,OAGiB;EACvC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,8BAA8B,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GACtF,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAEA,SAAgB,mBAAmB,QAAoB;CACrD,OAAO;EACL,WAAW,eAAe,MAAM;EAChC,YAAY,gBAAgB,MAAM;EAClC,YAAY,gBAAgB,MAAM;EAClC,kBAAkB,sBAAsB,MAAM;EAC9C,0BAA0B,8BAA8B,MAAM;EAC9D,8BAA8B,kCAAkC,MAAM;CACxE;AACF"}
|
|
@@ -41,7 +41,7 @@ const listSubscriptions = (client) => {
|
|
|
41
41
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
42
42
|
* @throws {HTTPValidationError} Validation Error
|
|
43
43
|
*/
|
|
44
|
-
const
|
|
44
|
+
const iterListSubscriptions = (client) => {
|
|
45
45
|
return async function* (query) {
|
|
46
46
|
let page;
|
|
47
47
|
page = query?.page ?? 1;
|
|
@@ -140,14 +140,14 @@ function createSubscriptionsService(client) {
|
|
|
140
140
|
get: getSubscriptions(client),
|
|
141
141
|
cancel: cancelSubscriptions(client),
|
|
142
142
|
update: updateSubscriptions(client),
|
|
143
|
-
|
|
143
|
+
iterList: iterListSubscriptions(client)
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
exports.cancelSubscriptions = cancelSubscriptions;
|
|
148
148
|
exports.createSubscriptionsService = createSubscriptionsService;
|
|
149
149
|
exports.getSubscriptions = getSubscriptions;
|
|
150
|
-
exports.
|
|
150
|
+
exports.iterListSubscriptions = iterListSubscriptions;
|
|
151
151
|
exports.listSubscriptions = listSubscriptions;
|
|
152
152
|
exports.updateSubscriptions = updateSubscriptions;
|
|
153
153
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.cjs","names":["HTTPValidationError","ResourceNotFound","AlreadyCanceledSubscription","PaymentFailed","Update403Error"],"sources":["../../../../src/2026-04/services/customer_portal/subscriptions.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSubscription,\n CustomerSubscriptionSortProperty,\n CustomerSubscriptionUpdate,\n ListResourceCustomerSubscription,\n} from \"../../models\";\n\nimport {\n AlreadyCanceledSubscription,\n HTTPValidationError,\n PaymentFailed,\n ResourceNotFound,\n Update403Error,\n} from \"../../errors\";\n\nexport const listSubscriptions = (client: ClientBase) => {\n /**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 product_id?: string | string[] | null;\n active?: boolean | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSubscriptionSortProperty[] | null;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n product_id: query?.product_id,\n active: query?.active,\n query: query?.query,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-started_at\"],\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/subscriptions/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\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":"subscriptions.cjs","names":["HTTPValidationError","ResourceNotFound","AlreadyCanceledSubscription","PaymentFailed","Update403Error"],"sources":["../../../../src/2026-04/services/customer_portal/subscriptions.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSubscription,\n CustomerSubscriptionSortProperty,\n CustomerSubscriptionUpdate,\n ListResourceCustomerSubscription,\n} from \"../../models\";\n\nimport {\n AlreadyCanceledSubscription,\n HTTPValidationError,\n PaymentFailed,\n ResourceNotFound,\n Update403Error,\n} from \"../../errors\";\n\nexport const listSubscriptions = (client: ClientBase) => {\n /**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 product_id?: string | string[] | null;\n active?: boolean | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSubscriptionSortProperty[] | null;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n product_id: query?.product_id,\n active: query?.active,\n query: query?.query,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-started_at\"],\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/subscriptions/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListSubscriptions = (client: ClientBase) => {\n return async function* (query?: {\n product_id?: string | string[] | null;\n active?: boolean | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSubscriptionSortProperty[] | null;\n }): AsyncGenerator<CustomerSubscription> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listSubscriptions(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const getSubscriptions = (client: ClientBase) => {\n /**\n * Get a subscription for the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param id - The subscription ID.\n * @returns {CustomerSubscription}\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 subscription was not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerSubscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSubscription>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const cancelSubscriptions = (client: ClientBase) => {\n /**\n * Cancel a subscription of the authenticated customer.\n *\n * @param id - The subscription ID.\n * @returns {CustomerSubscription}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {AlreadyCanceledSubscription} Customer subscription is already canceled or will be at the end of the period, or the user lacks billing permissions.\n * @throws {ResourceNotFound} Customer subscription was not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerSubscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customer-portal/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSubscription>(response, \"json\", {\n 403: AlreadyCanceledSubscription,\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateSubscriptions = (client: ClientBase) => {\n /**\n * Update a subscription of the authenticated customer.\n *\n * @param id - The subscription ID.\n * @param body - Request body\n * @returns {CustomerSubscription}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {PaymentFailed} Payment required to apply the subscription update.\n * @throws {Update403Error} Customer subscription is already canceled or will be at the end of the period, the user lacks billing permissions, or pausing/resuming is not enabled for the organization.\n * @throws {ResourceNotFound} Customer subscription was not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerSubscriptionUpdate): Promise<CustomerSubscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customer-portal/subscriptions/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSubscription>(response, \"json\", {\n 402: PaymentFailed,\n 403: Update403Error,\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createSubscriptionsService(client: ClientBase) {\n return {\n list: listSubscriptions(client),\n get: getSubscriptions(client),\n cancel: cancelSubscriptions(client),\n update: updateSubscriptions(client),\n iterList: iterListSubscriptions(client),\n };\n}\n\nexport type Subscriptions = ReturnType<typeof createSubscriptionsService>;\n"],"mappings":";;;AAgBA,MAAa,qBAAqB,WAAuB;;;;;;;;;;;;;CAavD,OAAO,OAAO,UAOmC;EAC/C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,OAAO,OAAO;GACd,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;EAC3C;EACA,MAAM,UAAU,OAAO,aACrB,OACA,sCACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAgD,UAAU,QAAQ,EAC9E,KAAKA,eAAAA,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,yBAAyB,WAAuB;CAC3D,OAAO,iBAAiB,OAOiB;EACvC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,kBAAkB,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GAC1E,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AAC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Ot as CustomerSubscription, kn as ListResourceCustomerSubscription, kt as CustomerSubscriptionSortProperty } from "../../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.cjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/subscriptions.d.ts
|
|
4
4
|
declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
@@ -21,7 +21,7 @@ declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
|
21
21
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
22
22
|
* @throws {HTTPValidationError} Validation Error
|
|
23
23
|
*/
|
|
24
|
-
declare const
|
|
24
|
+
declare const iterListSubscriptions: (client: ClientBase) => (query?: {
|
|
25
25
|
product_id?: string | string[] | null;
|
|
26
26
|
active?: boolean | null;
|
|
27
27
|
query?: string | null;
|
|
@@ -44,7 +44,7 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
44
44
|
get: (id: string) => Promise<CustomerSubscription>;
|
|
45
45
|
cancel: (id: string) => Promise<CustomerSubscription>;
|
|
46
46
|
update: (id: string, body: CustomerSubscriptionUpdate) => Promise<CustomerSubscription>;
|
|
47
|
-
|
|
47
|
+
iterList: (query?: {
|
|
48
48
|
product_id?: string | string[] | null;
|
|
49
49
|
active?: boolean | null;
|
|
50
50
|
query?: string | null;
|
|
@@ -55,5 +55,5 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
55
55
|
};
|
|
56
56
|
type Subscriptions = ReturnType<typeof createSubscriptionsService>;
|
|
57
57
|
//#endregion
|
|
58
|
-
export { Subscriptions, cancelSubscriptions, createSubscriptionsService, getSubscriptions,
|
|
58
|
+
export { Subscriptions, cancelSubscriptions, createSubscriptionsService, getSubscriptions, iterListSubscriptions, listSubscriptions, updateSubscriptions };
|
|
59
59
|
//# sourceMappingURL=subscriptions.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { At as CustomerSubscriptionUpdate, Ot as CustomerSubscription, kn as ListResourceCustomerSubscription, kt as CustomerSubscriptionSortProperty } from "../../../models-DnY24W7g.mjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.mjs";
|
|
3
3
|
//#region src/2026-04/services/customer_portal/subscriptions.d.ts
|
|
4
4
|
declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
@@ -21,7 +21,7 @@ declare const listSubscriptions: (client: ClientBase) => (query?: {
|
|
|
21
21
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
22
22
|
* @throws {HTTPValidationError} Validation Error
|
|
23
23
|
*/
|
|
24
|
-
declare const
|
|
24
|
+
declare const iterListSubscriptions: (client: ClientBase) => (query?: {
|
|
25
25
|
product_id?: string | string[] | null;
|
|
26
26
|
active?: boolean | null;
|
|
27
27
|
query?: string | null;
|
|
@@ -44,7 +44,7 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
44
44
|
get: (id: string) => Promise<CustomerSubscription>;
|
|
45
45
|
cancel: (id: string) => Promise<CustomerSubscription>;
|
|
46
46
|
update: (id: string, body: CustomerSubscriptionUpdate) => Promise<CustomerSubscription>;
|
|
47
|
-
|
|
47
|
+
iterList: (query?: {
|
|
48
48
|
product_id?: string | string[] | null;
|
|
49
49
|
active?: boolean | null;
|
|
50
50
|
query?: string | null;
|
|
@@ -55,5 +55,5 @@ declare function createSubscriptionsService(client: ClientBase): {
|
|
|
55
55
|
};
|
|
56
56
|
type Subscriptions = ReturnType<typeof createSubscriptionsService>;
|
|
57
57
|
//#endregion
|
|
58
|
-
export { Subscriptions, cancelSubscriptions, createSubscriptionsService, getSubscriptions,
|
|
58
|
+
export { Subscriptions, cancelSubscriptions, createSubscriptionsService, getSubscriptions, iterListSubscriptions, listSubscriptions, updateSubscriptions };
|
|
59
59
|
//# sourceMappingURL=subscriptions.d.mts.map
|
|
@@ -40,7 +40,7 @@ const listSubscriptions = (client) => {
|
|
|
40
40
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
41
41
|
* @throws {HTTPValidationError} Validation Error
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
43
|
+
const iterListSubscriptions = (client) => {
|
|
44
44
|
return async function* (query) {
|
|
45
45
|
let page;
|
|
46
46
|
page = query?.page ?? 1;
|
|
@@ -139,10 +139,10 @@ function createSubscriptionsService(client) {
|
|
|
139
139
|
get: getSubscriptions(client),
|
|
140
140
|
cancel: cancelSubscriptions(client),
|
|
141
141
|
update: updateSubscriptions(client),
|
|
142
|
-
|
|
142
|
+
iterList: iterListSubscriptions(client)
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
//#endregion
|
|
146
|
-
export { cancelSubscriptions, createSubscriptionsService, getSubscriptions,
|
|
146
|
+
export { cancelSubscriptions, createSubscriptionsService, getSubscriptions, iterListSubscriptions, listSubscriptions, updateSubscriptions };
|
|
147
147
|
|
|
148
148
|
//# sourceMappingURL=subscriptions.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/subscriptions.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSubscription,\n CustomerSubscriptionSortProperty,\n CustomerSubscriptionUpdate,\n ListResourceCustomerSubscription,\n} from \"../../models\";\n\nimport {\n AlreadyCanceledSubscription,\n HTTPValidationError,\n PaymentFailed,\n ResourceNotFound,\n Update403Error,\n} from \"../../errors\";\n\nexport const listSubscriptions = (client: ClientBase) => {\n /**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 product_id?: string | string[] | null;\n active?: boolean | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSubscriptionSortProperty[] | null;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n product_id: query?.product_id,\n active: query?.active,\n query: query?.query,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-started_at\"],\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/subscriptions/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\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":"subscriptions.mjs","names":[],"sources":["../../../../src/2026-04/services/customer_portal/subscriptions.ts"],"sourcesContent":["import type { ClientBase } from \"../../../base\";\nimport type {\n CustomerSubscription,\n CustomerSubscriptionSortProperty,\n CustomerSubscriptionUpdate,\n ListResourceCustomerSubscription,\n} from \"../../models\";\n\nimport {\n AlreadyCanceledSubscription,\n HTTPValidationError,\n PaymentFailed,\n ResourceNotFound,\n Update403Error,\n} from \"../../errors\";\n\nexport const listSubscriptions = (client: ClientBase) => {\n /**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {ListResourceCustomerSubscription}\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 product_id?: string | string[] | null;\n active?: boolean | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSubscriptionSortProperty[] | null;\n }): Promise<ListResourceCustomerSubscription> => {\n const pathParams = {};\n const queryParams = {\n product_id: query?.product_id,\n active: query?.active,\n query: query?.query,\n page: query?.page ?? 1,\n limit: query?.limit ?? 10,\n sorting: query?.sorting ?? [\"-started_at\"],\n };\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/subscriptions/\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<ListResourceCustomerSubscription>(response, \"json\", {\n 422: HTTPValidationError,\n });\n };\n};\n/**\n * List subscriptions of the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param query - Query parameters\n * @returns {AsyncGenerator<CustomerSubscription>} A generator that yields items of type CustomerSubscription.\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {HTTPValidationError} Validation Error\n */\nexport const iterListSubscriptions = (client: ClientBase) => {\n return async function* (query?: {\n product_id?: string | string[] | null;\n active?: boolean | null;\n query?: string | null;\n page?: number;\n limit?: number;\n sorting?: CustomerSubscriptionSortProperty[] | null;\n }): AsyncGenerator<CustomerSubscription> {\n let page: number;\n page = query?.page ?? 1;\n let limit: number | undefined;\n limit = query?.limit;\n\n while (true) {\n const response = await listSubscriptions(client)({ ...query, page, limit });\n for (const item of response.items) {\n yield item;\n }\n if (page >= response.pagination.max_page) {\n break;\n }\n page++;\n }\n };\n};\nexport const getSubscriptions = (client: ClientBase) => {\n /**\n * Get a subscription for the authenticated customer.\n *\n * **Scopes**: `customer_portal:read` `customer_portal:write`\n *\n * @param id - The subscription ID.\n * @returns {CustomerSubscription}\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 subscription was not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerSubscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"GET\",\n \"/v1/customer-portal/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSubscription>(response, \"json\", {\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const cancelSubscriptions = (client: ClientBase) => {\n /**\n * Cancel a subscription of the authenticated customer.\n *\n * @param id - The subscription ID.\n * @returns {CustomerSubscription}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {AlreadyCanceledSubscription} Customer subscription is already canceled or will be at the end of the period, or the user lacks billing permissions.\n * @throws {ResourceNotFound} Customer subscription was not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string): Promise<CustomerSubscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"DELETE\",\n \"/v1/customer-portal/subscriptions/{id}\",\n pathParams,\n queryParams,\n undefined,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSubscription>(response, \"json\", {\n 403: AlreadyCanceledSubscription,\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\nexport const updateSubscriptions = (client: ClientBase) => {\n /**\n * Update a subscription of the authenticated customer.\n *\n * @param id - The subscription ID.\n * @param body - Request body\n * @returns {CustomerSubscription}\n * @throws {PolarNetworkError} When a network error occurs\n * @throws {PolarRateLimitError} When the rate limit is exceeded\n * @throws {PolarServerError} When the server returns a 5xx error\n * @throws {PaymentFailed} Payment required to apply the subscription update.\n * @throws {Update403Error} Customer subscription is already canceled or will be at the end of the period, the user lacks billing permissions, or pausing/resuming is not enabled for the organization.\n * @throws {ResourceNotFound} Customer subscription was not found.\n * @throws {HTTPValidationError} Validation Error\n */\n return async (id: string, body: CustomerSubscriptionUpdate): Promise<CustomerSubscription> => {\n const pathParams = {\n id: id,\n };\n const queryParams = {};\n const request = client.buildRequest(\n \"PATCH\",\n \"/v1/customer-portal/subscriptions/{id}\",\n pathParams,\n queryParams,\n body,\n );\n const response = await client.sendRequest(request);\n return client.parseResponse<CustomerSubscription>(response, \"json\", {\n 402: PaymentFailed,\n 403: Update403Error,\n 404: ResourceNotFound,\n 422: HTTPValidationError,\n });\n };\n};\n\nexport function createSubscriptionsService(client: ClientBase) {\n return {\n list: listSubscriptions(client),\n get: getSubscriptions(client),\n cancel: cancelSubscriptions(client),\n update: updateSubscriptions(client),\n iterList: iterListSubscriptions(client),\n };\n}\n\nexport type Subscriptions = ReturnType<typeof createSubscriptionsService>;\n"],"mappings":";;AAgBA,MAAa,qBAAqB,WAAuB;;;;;;;;;;;;;CAavD,OAAO,OAAO,UAOmC;EAC/C,MAAM,aAAa,CAAC;EACpB,MAAM,cAAc;GAClB,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,OAAO,OAAO;GACd,MAAM,OAAO,QAAQ;GACrB,OAAO,OAAO,SAAS;GACvB,SAAS,OAAO,WAAW,CAAC,aAAa;EAC3C;EACA,MAAM,UAAU,OAAO,aACrB,OACA,sCACA,YACA,aACA,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAgD,UAAU,QAAQ,EAC9E,KAAK,oBACP,CAAC;CACH;AACF;;;;;;;;;;;;;AAaA,MAAa,yBAAyB,WAAuB;CAC3D,OAAO,iBAAiB,OAOiB;EACvC,IAAI;EACJ,OAAO,OAAO,QAAQ;EACtB,IAAI;EACJ,QAAQ,OAAO;EAEf,OAAO,MAAM;GACX,MAAM,WAAW,MAAM,kBAAkB,MAAM,CAAC,CAAC;IAAE,GAAG;IAAO;IAAM;GAAM,CAAC;GAC1E,KAAK,MAAM,QAAQ,SAAS,OAC1B,MAAM;GAER,IAAI,QAAQ,SAAS,WAAW,UAC9B;GAEF;EACF;CACF;AACF;AACA,MAAa,oBAAoB,WAAuB;;;;;;;;;;;;;;CActD,OAAO,OAAO,OAA8C;EAC1D,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,OACA,0CACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAoC,UAAU,QAAQ;GAClE,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,uBAAuB,WAAuB;;;;;;;;;;;;;CAazD,OAAO,OAAO,OAA8C;EAC1D,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,UACA,0CACA,YACA,CAAU,GACV,KAAA,CACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAoC,UAAU,QAAQ;GAClE,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AACA,MAAa,uBAAuB,WAAuB;;;;;;;;;;;;;;;CAezD,OAAO,OAAO,IAAY,SAAoE;EAC5F,MAAM,aAAa,EACb,GACN;EAEA,MAAM,UAAU,OAAO,aACrB,SACA,0CACA,YACA,CAAU,GACV,IACF;EACA,MAAM,WAAW,MAAM,OAAO,YAAY,OAAO;EACjD,OAAO,OAAO,cAAoC,UAAU,QAAQ;GAClE,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,CAAC;CACH;AACF;AAEA,SAAgB,2BAA2B,QAAoB;CAC7D,OAAO;EACL,MAAM,kBAAkB,MAAM;EAC9B,KAAK,iBAAiB,MAAM;EAC5B,QAAQ,oBAAoB,MAAM;EAClC,QAAQ,oBAAoB,MAAM;EAClC,UAAU,sBAAsB,MAAM;CACxC;AACF"}
|
|
@@ -34,7 +34,7 @@ const listWallets = (client) => {
|
|
|
34
34
|
* @throws {PolarServerError} When the server returns a 5xx error
|
|
35
35
|
* @throws {HTTPValidationError} Validation Error
|
|
36
36
|
*/
|
|
37
|
-
const
|
|
37
|
+
const iterListWallets = (client) => {
|
|
38
38
|
return async function* (query) {
|
|
39
39
|
let page;
|
|
40
40
|
page = query?.page ?? 1;
|
|
@@ -78,13 +78,13 @@ function createWalletsService(client) {
|
|
|
78
78
|
return {
|
|
79
79
|
list: listWallets(client),
|
|
80
80
|
get: getWallets(client),
|
|
81
|
-
|
|
81
|
+
iterList: iterListWallets(client)
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
//#endregion
|
|
85
85
|
exports.createWalletsService = createWalletsService;
|
|
86
86
|
exports.getWallets = getWallets;
|
|
87
|
-
exports.
|
|
87
|
+
exports.iterListWallets = iterListWallets;
|
|
88
88
|
exports.listWallets = listWallets;
|
|
89
89
|
|
|
90
90
|
//# sourceMappingURL=wallets.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallets.cjs","names":["HTTPValidationError","ResourceNotFound"],"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.cjs","names":["HTTPValidationError","ResourceNotFound"],"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,KAAKA,eAAAA,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,KAAKC,eAAAA;GACL,KAAKD,eAAAA;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 { An as ListResourceCustomerWallet, Nt as CustomerWallet, Pt as CustomerWalletSortProperty } from "../../../models-i5yDo5sm.cjs";
|
|
2
2
|
import { t as ClientBase } from "../../../base-CmjkkyNf.cjs";
|
|
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.cts.map
|