diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 145583eb..891d0ff0 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: e7042734-e669-4c36-85da-bbb4a7500ac8 management: - docChecksum: e6d7a897b9f314fe7ea1d7ed55b6a2e3 + docChecksum: 70f4b001216eeab70ec5d029d5e430c3 docVersion: 0.1.0 - speakeasyVersion: 1.567.1 - generationVersion: 2.632.0 - releaseVersion: 0.22.1 - configChecksum: d8ba569e13cef31c7dac9cb145567a31 + speakeasyVersion: 1.581.2 + generationVersion: 2.656.9 + releaseVersion: 0.22.2 + configChecksum: 2ded8da8aff22d65399e1ec73e55d93e repoURL: https://github.com/polarsource/polar-python.git installationURL: https://github.com/polarsource/polar-python.git published: true @@ -14,7 +14,7 @@ features: python: additionalDependencies: 1.0.0 constsAndDefaults: 1.0.5 - core: 5.19.3 + core: 5.19.4 customCodeRegions: 0.1.1 defaultEnabledRetries: 0.2.0 deprecations: 3.0.2 @@ -44,7 +44,6 @@ generatedFiles: - .devcontainer/devcontainer.json - .devcontainer/setup.sh - .gitattributes - - .python-version - .vscode/settings.json - USAGE.md - docs/models/activesubscriptions.md @@ -162,16 +161,17 @@ generatedFiles: - docs/models/benefittype.md - docs/models/benefittypefilter.md - docs/models/benefitupdatedevent.md + - docs/models/billingaddressfieldmode.md - docs/models/cardpayment.md - docs/models/cardpaymentmetadata.md - docs/models/checkout.md + - docs/models/checkoutbillingaddressfields.md - docs/models/checkoutconfirmstripe.md - docs/models/checkoutconfirmstripecustomfielddata.md - docs/models/checkoutcreate.md - docs/models/checkoutcreatecustomermetadata.md - docs/models/checkoutcreatecustomfielddata.md - docs/models/checkoutcreatemetadata.md - - docs/models/checkoutcustomerbillingaddressfields.md - docs/models/checkoutcustomfielddata.md - docs/models/checkoutdiscount.md - docs/models/checkoutdiscountfixedonceforeverduration.md @@ -304,14 +304,13 @@ generatedFiles: - docs/models/customerportalcustomersaddpaymentmethodsecurity.md - docs/models/customerportalcustomersdeletepaymentmethodrequest.md - docs/models/customerportalcustomersdeletepaymentmethodsecurity.md - - docs/models/customerportalcustomersgetpaymentmethodsrequest.md - - docs/models/customerportalcustomersgetpaymentmethodsresponse.md - - docs/models/customerportalcustomersgetpaymentmethodssecurity.md - docs/models/customerportalcustomersgetsecurity.md + - docs/models/customerportalcustomerslistpaymentmethodsrequest.md + - docs/models/customerportalcustomerslistpaymentmethodsresponse.md + - docs/models/customerportalcustomerslistpaymentmethodssecurity.md - docs/models/customerportalcustomersupdatesecurity.md - docs/models/customerportalcustomertaxid.md - docs/models/customerportalcustomerupdate.md - - docs/models/customerportaldownloadablescustomerportaldownloadablesgetrequest.md - docs/models/customerportaldownloadableslistqueryparambenefitidfilter.md - docs/models/customerportaldownloadableslistqueryparamorganizationidfilter.md - docs/models/customerportaldownloadableslistrequest.md @@ -501,6 +500,7 @@ generatedFiles: - docs/models/eventsingest.md - docs/models/eventsingestresponse.md - docs/models/eventslistnamesqueryparamcustomeridfilter.md + - docs/models/eventslistnamesqueryparamexternalcustomeridfilter.md - docs/models/eventslistnamesqueryparamorganizationidfilter.md - docs/models/eventslistnamesrequest.md - docs/models/eventslistnamesresponse.md @@ -536,7 +536,6 @@ generatedFiles: - docs/models/filteroperator.md - docs/models/func.md - docs/models/genericpayment.md - - docs/models/granttypes.md - docs/models/httpvalidationerror.md - docs/models/introspecttokenrequest.md - docs/models/introspecttokenrequesttokentypehint.md @@ -587,7 +586,6 @@ generatedFiles: - docs/models/listresourcefileread.md - docs/models/listresourcelicensekeyread.md - docs/models/listresourcemeter.md - - docs/models/listresourceoauth2client.md - docs/models/listresourceorder.md - docs/models/listresourceorganization.md - docs/models/listresourceproduct.md @@ -662,19 +660,7 @@ generatedFiles: - docs/models/notpaidorder.md - docs/models/notpermitted.md - docs/models/oauth2authorizeresponseoauth2authorize.md - - docs/models/oauth2client.md - - docs/models/oauth2clientconfiguration.md - - docs/models/oauth2clientconfigurationgranttypes.md - - docs/models/oauth2clientconfigurationtokenendpointauthmethod.md - - docs/models/oauth2clientconfigurationupdate.md - - docs/models/oauth2clientconfigurationupdategranttypes.md - - docs/models/oauth2clientconfigurationupdatetokenendpointauthmethod.md - docs/models/oauth2clientpublic.md - - docs/models/oauth2clientslistrequest.md - - docs/models/oauth2clientslistresponse.md - - docs/models/oauth2clientsoauth2deleteclientrequest.md - - docs/models/oauth2clientsoauth2getclientrequest.md - - docs/models/oauth2clientsoauth2updateclientrequest.md - docs/models/oauth2requesttokenrequestbody.md - docs/models/oauth2userinforesponseoauth2userinfo.md - docs/models/onetimeproducts.md @@ -716,6 +702,7 @@ generatedFiles: - docs/models/organizationfeaturesettings.md - docs/models/organizationid.md - docs/models/organizationidfilter.md + - docs/models/organizationnotificationsettings.md - docs/models/organizationsgetrequest.md - docs/models/organizationslistrequest.md - docs/models/organizationslistresponse.md @@ -729,7 +716,7 @@ generatedFiles: - docs/models/payment.md - docs/models/paymenterror.md - docs/models/paymentmethodcard.md - - docs/models/paymentmethodcarddata.md + - docs/models/paymentmethodcardmetadata.md - docs/models/paymentmethodgeneric.md - docs/models/paymentprocessor.md - docs/models/paymentsgetrequest.md @@ -853,7 +840,6 @@ generatedFiles: - docs/models/taxidformat.md - docs/models/timeframe.md - docs/models/timeinterval.md - - docs/models/tokenendpointauthmethod.md - docs/models/tokenresponse.md - docs/models/tokentype.md - docs/models/tokentypehint.md @@ -913,7 +899,6 @@ generatedFiles: - docs/sdks/benefits/README.md - docs/sdks/checkoutlinks/README.md - docs/sdks/checkouts/README.md - - docs/sdks/clients/README.md - docs/sdks/customermeters/README.md - docs/sdks/customerportal/README.md - docs/sdks/customers/README.md @@ -957,7 +942,6 @@ generatedFiles: - src/polar_sdk/benefits.py - src/polar_sdk/checkout_links.py - src/polar_sdk/checkouts.py - - src/polar_sdk/clients.py - src/polar_sdk/custom_fields.py - src/polar_sdk/customer_meters.py - src/polar_sdk/customer_portal.py @@ -1050,6 +1034,7 @@ generatedFiles: - src/polar_sdk/models/benefitsortproperty.py - src/polar_sdk/models/benefittype.py - src/polar_sdk/models/benefitupdatedevent.py + - src/polar_sdk/models/billingaddressfieldmode.py - src/polar_sdk/models/cardpayment.py - src/polar_sdk/models/cardpaymentmetadata.py - src/polar_sdk/models/checkout.py @@ -1058,9 +1043,9 @@ generatedFiles: - src/polar_sdk/models/checkout_links_getop.py - src/polar_sdk/models/checkout_links_listop.py - src/polar_sdk/models/checkout_links_updateop.py + - src/polar_sdk/models/checkoutbillingaddressfields.py - src/polar_sdk/models/checkoutconfirmstripe.py - src/polar_sdk/models/checkoutcreate.py - - src/polar_sdk/models/checkoutcustomerbillingaddressfields.py - src/polar_sdk/models/checkoutdiscountfixedonceforeverduration.py - src/polar_sdk/models/checkoutdiscountfixedrepeatduration.py - src/polar_sdk/models/checkoutdiscountpercentageonceforeverduration.py @@ -1101,10 +1086,9 @@ generatedFiles: - src/polar_sdk/models/customer_portal_customer_meters_listop.py - src/polar_sdk/models/customer_portal_customers_add_payment_methodop.py - src/polar_sdk/models/customer_portal_customers_delete_payment_methodop.py - - src/polar_sdk/models/customer_portal_customers_get_payment_methodsop.py - src/polar_sdk/models/customer_portal_customers_getop.py + - src/polar_sdk/models/customer_portal_customers_list_payment_methodsop.py - src/polar_sdk/models/customer_portal_customers_updateop.py - - src/polar_sdk/models/customer_portal_downloadables_customer_portal_downloadables_getop.py - src/polar_sdk/models/customer_portal_downloadables_listop.py - src/polar_sdk/models/customer_portal_license_keys_getop.py - src/polar_sdk/models/customer_portal_license_keys_listop.py @@ -1303,7 +1287,6 @@ generatedFiles: - src/polar_sdk/models/listresource_fileread_.py - src/polar_sdk/models/listresource_licensekeyread_.py - src/polar_sdk/models/listresource_meter_.py - - src/polar_sdk/models/listresource_oauth2client_.py - src/polar_sdk/models/listresource_order_.py - src/polar_sdk/models/listresource_organization_.py - src/polar_sdk/models/listresource_product_.py @@ -1335,19 +1318,13 @@ generatedFiles: - src/polar_sdk/models/metricstotals.py - src/polar_sdk/models/metrictype.py - src/polar_sdk/models/missinginvoicebillingdetails.py + - src/polar_sdk/models/no_response_error.py - src/polar_sdk/models/notopencheckout.py - src/polar_sdk/models/notpaidorder.py - src/polar_sdk/models/notpermitted.py - src/polar_sdk/models/oauth2_authorizeop.py - - src/polar_sdk/models/oauth2_clients_listop.py - - src/polar_sdk/models/oauth2_clients_oauth2_delete_clientop.py - - src/polar_sdk/models/oauth2_clients_oauth2_get_clientop.py - - src/polar_sdk/models/oauth2_clients_oauth2_update_clientop.py - src/polar_sdk/models/oauth2_request_tokenop.py - src/polar_sdk/models/oauth2_userinfoop.py - - src/polar_sdk/models/oauth2client.py - - src/polar_sdk/models/oauth2clientconfiguration.py - - src/polar_sdk/models/oauth2clientconfigurationupdate.py - src/polar_sdk/models/oauth2clientpublic.py - src/polar_sdk/models/order.py - src/polar_sdk/models/orderbillingreason.py @@ -1369,6 +1346,7 @@ generatedFiles: - src/polar_sdk/models/organizationcreate.py - src/polar_sdk/models/organizationdetails.py - src/polar_sdk/models/organizationfeaturesettings.py + - src/polar_sdk/models/organizationnotificationsettings.py - src/polar_sdk/models/organizations_getop.py - src/polar_sdk/models/organizations_listop.py - src/polar_sdk/models/organizations_updateop.py @@ -1381,13 +1359,14 @@ generatedFiles: - src/polar_sdk/models/payment.py - src/polar_sdk/models/paymenterror.py - src/polar_sdk/models/paymentmethodcard.py - - src/polar_sdk/models/paymentmethodcarddata.py + - src/polar_sdk/models/paymentmethodcardmetadata.py - src/polar_sdk/models/paymentmethodgeneric.py - src/polar_sdk/models/paymentprocessor.py - src/polar_sdk/models/payments_getop.py - src/polar_sdk/models/payments_listop.py - src/polar_sdk/models/paymentsortproperty.py - src/polar_sdk/models/paymentstatus.py + - src/polar_sdk/models/polarerror.py - src/polar_sdk/models/product.py - src/polar_sdk/models/productbenefitsupdate.py - src/polar_sdk/models/productbillingtype.py @@ -1421,6 +1400,7 @@ generatedFiles: - src/polar_sdk/models/refundsortproperty.py - src/polar_sdk/models/refundstatus.py - src/polar_sdk/models/resourcenotfound.py + - src/polar_sdk/models/responsevalidationerror.py - src/polar_sdk/models/revoketokenrequest.py - src/polar_sdk/models/revoketokenresponse.py - src/polar_sdk/models/s3downloadurl.py @@ -1532,6 +1512,7 @@ generatedFiles: - src/polar_sdk/utils/retries.py - src/polar_sdk/utils/security.py - src/polar_sdk/utils/serializers.py + - src/polar_sdk/utils/unmarshal_json_response.py - src/polar_sdk/utils/url.py - src/polar_sdk/utils/values.py - src/polar_sdk/webhooks.py @@ -1539,7 +1520,7 @@ examples: _endpointcheckout_created_post: speakeasy-default-endpointcheckout-created-post: requestBody: - application/json: {"type": "checkout.created", "data": {"created_at": "2023-02-15T15:44:21.478Z", "modified_at": "2023-09-13T08:36:46.434Z", "id": "", "payment_processor": "stripe", "status": "expired", "client_secret": "", "url": "https://whole-aftermath.net/", "expires_at": "2023-12-28T10:30:56.042Z", "success_url": "https://moral-premier.name/", "embed_origin": "", "amount": 929514, "discount_amount": 323773, "net_amount": 115799, "tax_amount": 97012, "total_amount": 859980, "currency": "Fiji Dollar", "product_id": "", "product_price_id": "", "discount_id": null, "allow_discount_codes": true, "require_billing_address": true, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": false, "customer_name": "", "customer_email": null, "customer_ip_address": null, "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": "", "key2": ""}, "customer_billing_address_fields": {"country": true, "state": false, "city": false, "postal_code": true, "line1": true, "line2": false}, "metadata": {"key": false, "key1": false}, "external_customer_id": null, "customer_external_id": "", "products": [{"created_at": "2025-07-23T17:21:51.405Z", "modified_at": "2024-01-17T03:32:08.030Z", "id": "", "name": "", "description": "funny abscond fairly except slight", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2023-09-13T08:36:46.434Z", "modified_at": "2023-10-05T12:55:46.428Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/log", "mime_type": "", "size": 982910, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-13T03:57:17.676Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-23T06:47:50.944Z", "size_readable": "", "public_url": "https://yummy-ocelot.biz/"}, {"id": "", "organization_id": "", "name": "", "path": "/var/log", "mime_type": "", "size": 982910, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-13T03:57:17.676Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-23T06:47:50.944Z", "size_readable": "", "public_url": "https://yummy-ocelot.biz/"}, {"id": "", "organization_id": "", "name": "", "path": "/var/log", "mime_type": "", "size": 982910, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-13T03:57:17.676Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-23T06:47:50.944Z", "size_readable": "", "public_url": "https://yummy-ocelot.biz/"}]}], "product": {"created_at": "2023-03-01T03:35:30.257Z", "modified_at": "2024-12-19T15:40:11.887Z", "id": "", "name": "", "description": "until joyful how", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-05-02T18:25:33.974Z", "modified_at": "2025-02-06T12:55:07.640Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 115799}, {"created_at": "2025-07-31T12:54:47.590Z", "modified_at": "2023-01-11T22:31:47.320Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 203013, "maximum_amount": null, "preset_amount": 119260, "legacy": true}, {"created_at": "2024-04-06T18:48:21.449Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "benefits": [{"id": "", "created_at": "2023-11-22T11:07:53.319Z", "modified_at": "2025-09-17T18:38:51.288Z", "type": "discord", "description": "brr now psst", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2023-11-22T11:07:53.319Z", "modified_at": "2025-09-17T18:38:51.288Z", "type": "discord", "description": "brr now psst", "selectable": true, "deletable": true, "organization_id": ""}], "medias": []}, "product_price": {"created_at": "2024-08-14T23:26:30.929Z", "modified_at": "2025-01-15T11:59:21.523Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 499786, "legacy": true}, "discount": {"duration": "repeating", "duration_in_months": 470604, "type": "fixed", "basis_points": 567071, "id": "", "name": "", "code": ""}, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-01-27T12:44:05.844Z", "modified_at": "2023-11-12T13:10:44.040Z", "id": "", "metadata": {"key": 833527, "key1": false}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 786803, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-01-27T12:44:05.844Z", "modified_at": "2023-11-12T13:10:44.040Z", "id": "", "metadata": {"key": 833527, "key1": false}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 786803, "required": false}], "customer_metadata": {}}} + application/json: {"type": "checkout.created", "data": {"created_at": "2023-02-15T15:44:21.478Z", "modified_at": "2023-09-13T08:36:46.434Z", "id": "", "payment_processor": "stripe", "status": "expired", "client_secret": "", "url": "https://whole-aftermath.net/", "expires_at": "2023-12-28T10:30:56.042Z", "success_url": "https://moral-premier.name/", "embed_origin": "", "amount": 929514, "discount_amount": 323773, "net_amount": 115799, "tax_amount": 97012, "total_amount": 859980, "currency": "Fiji Dollar", "product_id": "", "product_price_id": "", "discount_id": null, "allow_discount_codes": true, "require_billing_address": true, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": false, "customer_name": "", "customer_email": null, "customer_ip_address": null, "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": "", "key2": ""}, "billing_address_fields": {"country": "required", "state": "disabled", "city": "required", "postal_code": "required", "line1": "required", "line2": "disabled"}, "metadata": {"key": false, "key1": false}, "external_customer_id": null, "customer_external_id": "", "products": [{"created_at": "2025-07-23T17:21:51.405Z", "modified_at": "2024-01-17T03:32:08.030Z", "id": "", "name": "", "description": "funny abscond fairly except slight", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2023-09-13T08:36:46.434Z", "modified_at": "2023-10-05T12:55:46.428Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/log", "mime_type": "", "size": 982910, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-13T03:57:17.676Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-23T06:47:50.944Z", "size_readable": "", "public_url": "https://yummy-ocelot.biz/"}, {"id": "", "organization_id": "", "name": "", "path": "/var/log", "mime_type": "", "size": 982910, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-13T03:57:17.676Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-23T06:47:50.944Z", "size_readable": "", "public_url": "https://yummy-ocelot.biz/"}, {"id": "", "organization_id": "", "name": "", "path": "/var/log", "mime_type": "", "size": 982910, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-13T03:57:17.676Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-23T06:47:50.944Z", "size_readable": "", "public_url": "https://yummy-ocelot.biz/"}]}], "product": {"created_at": "2023-03-01T03:35:30.257Z", "modified_at": "2024-12-19T15:40:11.887Z", "id": "", "name": "", "description": "until joyful how", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-05-02T18:25:33.974Z", "modified_at": "2025-02-06T12:55:07.640Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 115799, "legacy": true}, {"created_at": "2025-07-31T12:54:47.590Z", "modified_at": "2023-01-11T22:31:47.320Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 203013, "maximum_amount": null, "preset_amount": 119260, "legacy": true}, {"created_at": "2024-04-06T18:48:21.449Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "benefits": [{"id": "", "created_at": "2023-11-22T11:07:53.319Z", "modified_at": "2025-09-17T18:38:51.288Z", "type": "discord", "description": "brr now psst", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2023-11-22T11:07:53.319Z", "modified_at": "2025-09-17T18:38:51.288Z", "type": "discord", "description": "brr now psst", "selectable": true, "deletable": true, "organization_id": ""}], "medias": []}, "product_price": {"created_at": "2024-08-14T23:26:30.929Z", "modified_at": "2025-01-15T11:59:21.523Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 499786, "legacy": true}, "discount": {"duration": "repeating", "duration_in_months": 470604, "type": "fixed", "basis_points": 567071, "id": "", "name": "", "code": ""}, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-01-27T12:44:05.844Z", "modified_at": "2023-11-12T13:10:44.040Z", "id": "", "metadata": {"key": 833527, "key1": false}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 786803, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-01-27T12:44:05.844Z", "modified_at": "2023-11-12T13:10:44.040Z", "id": "", "metadata": {"key": 833527, "key1": false}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 786803, "required": false}], "customer_metadata": {}}} responses: "200": application/json: "" @@ -1548,7 +1529,7 @@ examples: _endpointcheckout_updated_post: speakeasy-default-endpointcheckout-updated-post: requestBody: - application/json: {"type": "checkout.updated", "data": {"created_at": "2023-03-19T05:40:46.816Z", "modified_at": "2025-01-17T21:45:54.449Z", "id": "", "payment_processor": "stripe", "status": "succeeded", "client_secret": "", "url": "https://wasteful-kinase.net/", "expires_at": "2024-07-13T07:40:45.762Z", "success_url": "https://unwieldy-lift.name", "embed_origin": "", "amount": 328864, "discount_amount": 67168, "net_amount": 710560, "tax_amount": 164230, "total_amount": 754328, "currency": "New Taiwan Dollar", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": true, "require_billing_address": true, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": false, "is_payment_form_required": true, "customer_id": null, "is_business_customer": false, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {}, "customer_billing_address_fields": {"country": true, "state": false, "city": false, "postal_code": false, "line1": false, "line2": false}, "metadata": {"key": 8729.81, "key1": "", "key2": 302746}, "external_customer_id": null, "customer_external_id": "", "products": [{"created_at": "2024-02-06T13:10:07.718Z", "modified_at": "2025-05-28T09:18:17.409Z", "id": "", "name": "", "description": "gee unlike aboard entice which break", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-01-17T21:45:54.449Z", "modified_at": "2024-01-01T01:21:07.047Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 720125, "legacy": true}, {"created_at": "2025-09-27T00:00:25.178Z", "modified_at": "2024-09-03T16:16:06.332Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": null}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": []}, {"created_at": "2024-02-06T13:10:07.718Z", "modified_at": "2025-05-28T09:18:17.409Z", "id": "", "name": "", "description": "gee unlike aboard entice which break", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-06-29T23:54:25.932Z", "modified_at": "2025-08-08T18:57:45.007Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "month", "price_currency": "", "unit_amount": "", "cap_amount": null, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2024-04-12T18:30:19.906Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": []}, {"created_at": "2024-02-06T13:10:07.718Z", "modified_at": "2025-05-28T09:18:17.409Z", "id": "", "name": "", "description": "gee unlike aboard entice which break", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-04-08T09:51:58.249Z", "modified_at": "2025-07-16T15:01:26.410Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year"}, {"created_at": "2023-11-28T19:26:30.837Z", "modified_at": "2025-10-14T04:57:44.285Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 801449, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": []}], "product": {"created_at": "2024-04-04T09:43:29.328Z", "modified_at": "2024-01-03T07:24:30.583Z", "id": "", "name": "", "description": "patroller fax sadly sick bitterly indeed grandson bravely loyally wholly", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-27T17:16:31.119Z", "modified_at": "2025-06-04T15:43:18.802Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 72487, "legacy": true}, {"created_at": "2024-06-14T15:19:42.985Z", "modified_at": "2025-08-21T13:42:50.786Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "month"}, {"created_at": "2025-02-06T04:48:01.265Z", "modified_at": "2024-01-15T02:31:30.334Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "month", "price_currency": "", "minimum_amount": 849243, "maximum_amount": 295343, "preset_amount": 994380}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 349206, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T22:00:21.061Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-01T19:20:04.513Z", "size_readable": "", "public_url": "https://noted-availability.info"}, {"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 349206, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T22:00:21.061Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-01T19:20:04.513Z", "size_readable": "", "public_url": "https://noted-availability.info"}, {"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 349206, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T22:00:21.061Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-01T19:20:04.513Z", "size_readable": "", "public_url": "https://noted-availability.info"}]}, "product_price": {"created_at": "2025-11-24T07:57:40.732Z", "modified_at": "2025-12-23T16:30:04.627Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month"}, "discount": {"duration": "once", "duration_in_months": 187379, "type": "fixed", "basis_points": 373595, "id": "", "name": "", "code": ""}, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-09-18T09:12:02.157Z", "modified_at": "2023-07-11T01:18:07.226Z", "id": "", "metadata": {"key": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 704552, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2024-09-18T09:12:02.157Z", "modified_at": "2023-07-11T01:18:07.226Z", "id": "", "metadata": {"key": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 704552, "required": true}], "customer_metadata": {"key": 384374, "key1": 126671, "key2": 568803}}} + application/json: {"type": "checkout.updated", "data": {"created_at": "2023-03-19T05:40:46.816Z", "modified_at": "2025-01-17T21:45:54.449Z", "id": "", "payment_processor": "stripe", "status": "succeeded", "client_secret": "", "url": "https://wasteful-kinase.net/", "expires_at": "2024-07-13T07:40:45.762Z", "success_url": "https://unwieldy-lift.name", "embed_origin": "", "amount": 328864, "discount_amount": 67168, "net_amount": 710560, "tax_amount": 164230, "total_amount": 754328, "currency": "New Taiwan Dollar", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": true, "require_billing_address": true, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": false, "is_payment_form_required": true, "customer_id": null, "is_business_customer": false, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {}, "billing_address_fields": {"country": "required", "state": "optional", "city": "disabled", "postal_code": "optional", "line1": "required", "line2": "disabled"}, "metadata": {"key": 8729.81, "key1": "", "key2": 302746}, "external_customer_id": null, "customer_external_id": "", "products": [{"created_at": "2024-02-06T13:10:07.718Z", "modified_at": "2025-05-28T09:18:17.409Z", "id": "", "name": "", "description": "gee unlike aboard entice which break", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-01-17T21:45:54.449Z", "modified_at": "2024-01-01T01:21:07.047Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 720125, "legacy": true}, {"created_at": "2025-09-27T00:00:25.178Z", "modified_at": "2024-09-03T16:16:06.332Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": []}, {"created_at": "2024-02-06T13:10:07.718Z", "modified_at": "2025-05-28T09:18:17.409Z", "id": "", "name": "", "description": "gee unlike aboard entice which break", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-06-29T23:54:25.932Z", "modified_at": "2025-08-08T18:57:45.007Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "month", "price_currency": "", "unit_amount": "", "cap_amount": null, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2024-04-12T18:30:19.906Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": []}, {"created_at": "2024-02-06T13:10:07.718Z", "modified_at": "2025-05-28T09:18:17.409Z", "id": "", "name": "", "description": "gee unlike aboard entice which break", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-04-08T09:51:58.249Z", "modified_at": "2025-07-16T15:01:26.410Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-11-28T19:26:30.837Z", "modified_at": "2025-10-14T04:57:44.285Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 801449, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": []}], "product": {"created_at": "2024-04-04T09:43:29.328Z", "modified_at": "2024-01-03T07:24:30.583Z", "id": "", "name": "", "description": "patroller fax sadly sick bitterly indeed grandson bravely loyally wholly", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-27T17:16:31.119Z", "modified_at": "2025-06-04T15:43:18.802Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 72487, "legacy": true}, {"created_at": "2024-06-14T15:19:42.985Z", "modified_at": "2025-08-21T13:42:50.786Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2025-02-06T04:48:01.265Z", "modified_at": "2024-01-15T02:31:30.334Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 849243, "maximum_amount": 295343, "preset_amount": 994380, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-05T15:21:14.498Z", "modified_at": "2023-11-21T02:59:50.838Z", "type": "downloadables", "description": "highlight sandy overspend scratchy yet by", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 349206, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T22:00:21.061Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-01T19:20:04.513Z", "size_readable": "", "public_url": "https://noted-availability.info"}, {"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 349206, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T22:00:21.061Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-01T19:20:04.513Z", "size_readable": "", "public_url": "https://noted-availability.info"}, {"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 349206, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T22:00:21.061Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-01T19:20:04.513Z", "size_readable": "", "public_url": "https://noted-availability.info"}]}, "product_price": {"created_at": "2025-11-24T07:57:40.732Z", "modified_at": "2025-12-23T16:30:04.627Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, "discount": {"duration": "once", "duration_in_months": 187379, "type": "fixed", "basis_points": 373595, "id": "", "name": "", "code": ""}, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-09-18T09:12:02.157Z", "modified_at": "2023-07-11T01:18:07.226Z", "id": "", "metadata": {"key": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 704552, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2024-09-18T09:12:02.157Z", "modified_at": "2023-07-11T01:18:07.226Z", "id": "", "metadata": {"key": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 704552, "required": true}], "customer_metadata": {"key": 384374, "key1": 126671, "key2": 568803}}} responses: "200": application/json: "" @@ -1557,7 +1538,7 @@ examples: _endpointcustomer_created_post: speakeasy-default-endpointcustomer-created-post: requestBody: - application/json: {"type": "customer.created", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-10-24T17:37:29.711Z", "modified_at": "2025-07-16T19:46:09.413Z", "metadata": {"key": "", "key1": 9709.6}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-10-26T06:10:46.111Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}} + application/json: {"type": "customer.created", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-10-24T17:37:29.711Z", "modified_at": "2025-07-16T19:46:09.413Z", "metadata": {"key": "", "key1": 9709.6}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-10-26T06:10:46.111Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}} responses: "200": application/json: "" @@ -1566,7 +1547,7 @@ examples: _endpointcustomer_updated_post: speakeasy-default-endpointcustomer-updated-post: requestBody: - application/json: {"type": "customer.updated", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-09T20:22:33.716Z", "modified_at": "2024-10-16T21:39:43.150Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-12-14T00:37:03.564Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}} + application/json: {"type": "customer.updated", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-09T20:22:33.716Z", "modified_at": "2024-10-16T21:39:43.150Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-12-14T00:37:03.564Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}} responses: "200": application/json: "" @@ -1575,7 +1556,7 @@ examples: _endpointcustomer_deleted_post: speakeasy-default-endpointcustomer-deleted-post: requestBody: - application/json: {"type": "customer.deleted", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-12T21:40:34.752Z", "modified_at": "2025-02-26T09:36:28.870Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-07-08T00:32:27.730Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}} + application/json: {"type": "customer.deleted", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-12T21:40:34.752Z", "modified_at": "2025-02-26T09:36:28.870Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-07-08T00:32:27.730Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}} responses: "200": application/json: "" @@ -1584,7 +1565,7 @@ examples: _endpointcustomer_state_changed_post: speakeasy-default-endpointcustomer-state-changed-post: requestBody: - application/json: {"type": "customer.state_changed", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-05-22T16:03:32.369Z", "modified_at": "2023-04-17T22:11:17.879Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-09-08T18:19:10.187Z", "active_subscriptions": [{"id": "e5149aae-e521-42b9-b24c-abb3d71eea2e", "created_at": "2025-06-22T09:12:55.079Z", "modified_at": "2025-03-01T22:24:58.561Z", "metadata": {"key": true}, "status": "active", "amount": 1000, "currency": "usd", "recurring_interval": "year", "current_period_start": "2025-02-03T13:37:00Z", "current_period_end": "2025-03-03T13:37:00Z", "cancel_at_period_end": false, "canceled_at": null, "started_at": "2025-01-03T13:37:00Z", "ends_at": null, "product_id": "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23", "discount_id": null, "meters": []}], "granted_benefits": [], "active_meters": [{"id": "", "created_at": "2023-10-04T09:01:19.436Z", "modified_at": "2025-07-31T21:26:56.213Z", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75}, {"id": "", "created_at": "2023-10-04T09:01:19.436Z", "modified_at": "2025-07-31T21:26:56.213Z", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75}], "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}} + application/json: {"type": "customer.state_changed", "data": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-05-22T16:03:32.369Z", "modified_at": "2023-04-17T22:11:17.879Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-09-08T18:19:10.187Z", "active_subscriptions": [{"id": "e5149aae-e521-42b9-b24c-abb3d71eea2e", "created_at": "2025-06-22T09:12:55.079Z", "modified_at": "2025-03-01T22:24:58.561Z", "metadata": {"key": true}, "status": "active", "amount": 1000, "currency": "usd", "recurring_interval": "year", "current_period_start": "2025-02-03T13:37:00Z", "current_period_end": "2025-03-03T13:37:00Z", "cancel_at_period_end": false, "canceled_at": null, "started_at": "2025-01-03T13:37:00Z", "ends_at": null, "product_id": "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23", "discount_id": null, "meters": []}], "granted_benefits": [], "active_meters": [{"id": "", "created_at": "2023-10-04T09:01:19.436Z", "modified_at": "2025-07-31T21:26:56.213Z", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75}, {"id": "", "created_at": "2023-10-04T09:01:19.436Z", "modified_at": "2025-07-31T21:26:56.213Z", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75}], "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}} responses: "200": application/json: "" @@ -1593,7 +1574,7 @@ examples: _endpointorder_created_post: speakeasy-default-endpointorder-created-post: requestBody: - application/json: {"type": "order.created", "data": {"id": "", "created_at": "2024-08-21T06:55:49.348Z", "modified_at": null, "status": "refunded", "paid": true, "subtotal_amount": 952546, "discount_amount": 47294, "net_amount": 220865, "amount": 835005, "tax_amount": 913636, "total_amount": 727987, "refunded_amount": 597376, "refunded_tax_amount": 864844, "currency": "Kip", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": true, "key1": 2184.01, "key2": ""}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-11-07T09:52:21.455Z", "modified_at": "2025-06-03T19:46:15.179Z", "metadata": {"key": 526331}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-10-25T07:11:48.501Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "user_id": "", "product": {"metadata": {}, "created_at": "2025-02-09T20:19:15.400Z", "modified_at": "2023-03-30T07:05:37.419Z", "id": "", "name": "", "description": "against outbid to petty yeast off meanwhile colonialism", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "repeating", "duration_in_months": 425196, "type": "fixed", "amount": 778891, "currency": "Armenian Dram", "created_at": "2023-03-20T16:46:25.677Z", "modified_at": "2023-03-06T18:58:41.541Z", "id": "", "metadata": {"key": 298954}, "name": "", "code": "", "starts_at": "2023-04-08T15:39:19.572Z", "ends_at": "2024-01-04T15:31:18.185Z", "max_redemptions": 313467, "redemptions_count": 237254, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": null, "items": [{"created_at": "2023-10-09T05:35:46.860Z", "modified_at": "2025-11-19T12:55:15.055Z", "id": "", "label": "", "amount": 921740, "tax_amount": 964357, "proration": true, "product_price_id": ""}, {"created_at": "2023-10-09T05:35:46.860Z", "modified_at": "2025-11-19T12:55:15.055Z", "id": "", "label": "", "amount": 921740, "tax_amount": 964357, "proration": true, "product_price_id": ""}]}} + application/json: {"type": "order.created", "data": {"id": "", "created_at": "2024-08-21T06:55:49.348Z", "modified_at": null, "status": "refunded", "paid": true, "subtotal_amount": 952546, "discount_amount": 47294, "net_amount": 220865, "amount": 835005, "tax_amount": 913636, "total_amount": 727987, "refunded_amount": 597376, "refunded_tax_amount": 864844, "currency": "Kip", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": true, "key1": 2184.01, "key2": ""}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-11-07T09:52:21.455Z", "modified_at": "2025-06-03T19:46:15.179Z", "metadata": {"key": 526331}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-10-25T07:11:48.501Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "user_id": "", "product": {"metadata": {}, "created_at": "2025-02-09T20:19:15.400Z", "modified_at": "2023-03-30T07:05:37.419Z", "id": "", "name": "", "description": "against outbid to petty yeast off meanwhile colonialism", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "repeating", "duration_in_months": 425196, "type": "fixed", "amount": 778891, "currency": "Armenian Dram", "created_at": "2023-03-20T16:46:25.677Z", "modified_at": "2023-03-06T18:58:41.541Z", "id": "", "metadata": {"key": 298954}, "name": "", "code": "", "starts_at": "2023-04-08T15:39:19.572Z", "ends_at": "2024-01-04T15:31:18.185Z", "max_redemptions": 313467, "redemptions_count": 237254, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": null, "items": [{"created_at": "2023-10-09T05:35:46.860Z", "modified_at": "2025-11-19T12:55:15.055Z", "id": "", "label": "", "amount": 921740, "tax_amount": 964357, "proration": true, "product_price_id": ""}, {"created_at": "2023-10-09T05:35:46.860Z", "modified_at": "2025-11-19T12:55:15.055Z", "id": "", "label": "", "amount": 921740, "tax_amount": 964357, "proration": true, "product_price_id": ""}]}} responses: "200": application/json: "" @@ -1602,7 +1583,7 @@ examples: _endpointorder_updated_post: speakeasy-default-endpointorder-updated-post: requestBody: - application/json: {"type": "order.updated", "data": {"id": "", "created_at": "2023-10-25T00:08:50.290Z", "modified_at": "2024-01-08T20:00:47.692Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 198772, "discount_amount": 338283, "net_amount": 321919, "amount": 827864, "tax_amount": 380359, "total_amount": 596980, "refunded_amount": 404069, "refunded_tax_amount": 718668, "currency": "Nuevo Sol", "billing_reason": "subscription_create", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": false, "key1": 187509}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-12-03T05:16:11.415Z", "modified_at": "2023-03-11T05:58:05.184Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-06-26T15:51:37.068Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "user_id": "", "product": {"metadata": {}, "created_at": "2024-07-10T12:45:44.731Z", "modified_at": "2024-09-19T13:13:25.785Z", "id": "", "name": "", "description": "bossy direct reservation quaintly atop interestingly", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": ""}, "discount": {"duration": "once", "duration_in_months": 227959, "type": "fixed", "amount": 785594, "currency": "Barbados Dollar", "created_at": "2025-08-02T14:17:04.679Z", "modified_at": "2023-04-10T21:27:35.876Z", "id": "", "metadata": {"key": "", "key1": 330083}, "name": "", "code": "", "starts_at": "2023-09-01T14:56:03.459Z", "ends_at": "2024-10-01T02:03:16.161Z", "max_redemptions": 723901, "redemptions_count": 125128, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {}, "created_at": "2024-10-31T22:22:01.280Z", "modified_at": "2025-05-03T18:27:32.620Z", "id": "", "amount": 405025, "currency": "Pa'anga", "recurring_interval": "month", "status": "unpaid", "current_period_start": "2023-08-26T12:56:24.423Z", "current_period_end": "2024-02-06T09:06:51.703Z", "cancel_at_period_end": true, "canceled_at": "2024-03-28T15:10:13.508Z", "started_at": "2023-11-03T05:13:30.202Z", "ends_at": "2024-03-03T03:52:46.888Z", "ended_at": "2025-07-30T00:35:38.035Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": null, "customer_cancellation_reason": "switched_service", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-01-03T16:01:28.999Z", "modified_at": null, "id": "", "label": "", "amount": 516134, "tax_amount": 41202, "proration": false, "product_price_id": ""}, {"created_at": "2025-01-03T16:01:28.999Z", "modified_at": null, "id": "", "label": "", "amount": 516134, "tax_amount": 41202, "proration": false, "product_price_id": ""}, {"created_at": "2025-01-03T16:01:28.999Z", "modified_at": null, "id": "", "label": "", "amount": 516134, "tax_amount": 41202, "proration": false, "product_price_id": ""}]}} + application/json: {"type": "order.updated", "data": {"id": "", "created_at": "2023-10-25T00:08:50.290Z", "modified_at": "2024-01-08T20:00:47.692Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 198772, "discount_amount": 338283, "net_amount": 321919, "amount": 827864, "tax_amount": 380359, "total_amount": 596980, "refunded_amount": 404069, "refunded_tax_amount": 718668, "currency": "Nuevo Sol", "billing_reason": "subscription_create", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": false, "key1": 187509}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-12-03T05:16:11.415Z", "modified_at": "2023-03-11T05:58:05.184Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-06-26T15:51:37.068Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "user_id": "", "product": {"metadata": {}, "created_at": "2024-07-10T12:45:44.731Z", "modified_at": "2024-09-19T13:13:25.785Z", "id": "", "name": "", "description": "bossy direct reservation quaintly atop interestingly", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": ""}, "discount": {"duration": "once", "duration_in_months": 227959, "type": "fixed", "amount": 785594, "currency": "Barbados Dollar", "created_at": "2025-08-02T14:17:04.679Z", "modified_at": "2023-04-10T21:27:35.876Z", "id": "", "metadata": {"key": "", "key1": 330083}, "name": "", "code": "", "starts_at": "2023-09-01T14:56:03.459Z", "ends_at": "2024-10-01T02:03:16.161Z", "max_redemptions": 723901, "redemptions_count": 125128, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {}, "created_at": "2024-10-31T22:22:01.280Z", "modified_at": "2025-05-03T18:27:32.620Z", "id": "", "amount": 405025, "currency": "Pa'anga", "recurring_interval": "month", "status": "unpaid", "current_period_start": "2023-08-26T12:56:24.423Z", "current_period_end": "2024-02-06T09:06:51.703Z", "cancel_at_period_end": true, "canceled_at": "2024-03-28T15:10:13.508Z", "started_at": "2023-11-03T05:13:30.202Z", "ends_at": "2024-03-03T03:52:46.888Z", "ended_at": "2025-07-30T00:35:38.035Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": null, "customer_cancellation_reason": "switched_service", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-01-03T16:01:28.999Z", "modified_at": null, "id": "", "label": "", "amount": 516134, "tax_amount": 41202, "proration": false, "product_price_id": ""}, {"created_at": "2025-01-03T16:01:28.999Z", "modified_at": null, "id": "", "label": "", "amount": 516134, "tax_amount": 41202, "proration": false, "product_price_id": ""}, {"created_at": "2025-01-03T16:01:28.999Z", "modified_at": null, "id": "", "label": "", "amount": 516134, "tax_amount": 41202, "proration": false, "product_price_id": ""}]}} responses: "200": application/json: "" @@ -1611,7 +1592,7 @@ examples: _endpointorder_paid_post: speakeasy-default-endpointorder-paid-post: requestBody: - application/json: {"type": "order.paid", "data": {"id": "", "created_at": "2025-12-05T07:44:21.172Z", "modified_at": "2024-12-11T22:14:44.762Z", "status": "refunded", "paid": true, "subtotal_amount": 806442, "discount_amount": 990825, "net_amount": 746396, "amount": 341385, "tax_amount": 486648, "total_amount": 562504, "refunded_amount": 314047, "refunded_tax_amount": 570780, "currency": "Norwegian Krone", "billing_reason": "subscription_create", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-30T09:47:22.437Z", "modified_at": "2025-04-20T14:41:24.727Z", "metadata": {"key": 154136, "key1": false, "key2": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-06-08T00:11:47.056Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "user_id": "", "product": {"metadata": {"key": "", "key1": false, "key2": 1122.47}, "created_at": "2024-03-19T01:07:15.346Z", "modified_at": "2025-03-22T13:41:39.854Z", "id": "", "name": "", "description": "instead unnaturally curly scared but definite knowledgeably", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "forever", "duration_in_months": 458129, "type": "fixed", "basis_points": 400985, "created_at": "2025-12-02T15:10:04.656Z", "modified_at": "2024-10-30T18:07:50.242Z", "id": "", "metadata": {"key": 4652.15}, "name": "", "code": "", "starts_at": "2023-11-24T17:59:56.836Z", "ends_at": "2025-08-12T18:11:29.547Z", "max_redemptions": 727805, "redemptions_count": 584469, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {}, "created_at": "2025-07-17T03:39:23.964Z", "modified_at": "2025-10-30T20:20:46.051Z", "id": "", "amount": 540428, "currency": "Moroccan Dirham", "recurring_interval": "year", "status": "canceled", "current_period_start": "2023-02-24T15:15:22.018Z", "current_period_end": "2023-12-07T15:09:08.144Z", "cancel_at_period_end": false, "canceled_at": "2023-07-01T03:36:16.430Z", "started_at": "2024-09-21T14:56:16.106Z", "ends_at": "2023-01-21T03:35:38.158Z", "ended_at": "2023-12-02T06:46:04.196Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "other", "customer_cancellation_comment": ""}, "items": []}} + application/json: {"type": "order.paid", "data": {"id": "", "created_at": "2025-12-05T07:44:21.172Z", "modified_at": "2024-12-11T22:14:44.762Z", "status": "refunded", "paid": true, "subtotal_amount": 806442, "discount_amount": 990825, "net_amount": 746396, "amount": 341385, "tax_amount": 486648, "total_amount": 562504, "refunded_amount": 314047, "refunded_tax_amount": 570780, "currency": "Norwegian Krone", "billing_reason": "subscription_create", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-30T09:47:22.437Z", "modified_at": "2025-04-20T14:41:24.727Z", "metadata": {"key": 154136, "key1": false, "key2": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-06-08T00:11:47.056Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "user_id": "", "product": {"metadata": {"key": "", "key1": false, "key2": 1122.47}, "created_at": "2024-03-19T01:07:15.346Z", "modified_at": "2025-03-22T13:41:39.854Z", "id": "", "name": "", "description": "instead unnaturally curly scared but definite knowledgeably", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "forever", "duration_in_months": 458129, "type": "fixed", "basis_points": 400985, "created_at": "2025-12-02T15:10:04.656Z", "modified_at": "2024-10-30T18:07:50.242Z", "id": "", "metadata": {"key": 4652.15}, "name": "", "code": "", "starts_at": "2023-11-24T17:59:56.836Z", "ends_at": "2025-08-12T18:11:29.547Z", "max_redemptions": 727805, "redemptions_count": 584469, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {}, "created_at": "2025-07-17T03:39:23.964Z", "modified_at": "2025-10-30T20:20:46.051Z", "id": "", "amount": 540428, "currency": "Moroccan Dirham", "recurring_interval": "year", "status": "canceled", "current_period_start": "2023-02-24T15:15:22.018Z", "current_period_end": "2023-12-07T15:09:08.144Z", "cancel_at_period_end": false, "canceled_at": "2023-07-01T03:36:16.430Z", "started_at": "2024-09-21T14:56:16.106Z", "ends_at": "2023-01-21T03:35:38.158Z", "ended_at": "2023-12-02T06:46:04.196Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "other", "customer_cancellation_comment": ""}, "items": []}} responses: "200": application/json: "" @@ -1620,7 +1601,7 @@ examples: _endpointorder_refunded_post: speakeasy-default-endpointorder-refunded-post: requestBody: - application/json: {"type": "order.refunded", "data": {"id": "", "created_at": "2024-07-23T18:00:11.615Z", "modified_at": "2024-08-23T03:13:11.383Z", "status": "refunded", "paid": true, "subtotal_amount": 678552, "discount_amount": 294178, "net_amount": 721778, "amount": 913001, "tax_amount": 518308, "total_amount": 820663, "refunded_amount": 472431, "refunded_tax_amount": 879331, "currency": "Hong Kong Dollar", "billing_reason": "subscription_create", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": 4542.91}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-08-11T17:50:11.031Z", "modified_at": "2023-02-24T05:25:29.794Z", "metadata": {"key": 97027, "key1": 958634}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-01-16T07:26:04.196Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "user_id": "", "product": {"metadata": {"key": 4016.73, "key1": 9058.31, "key2": true}, "created_at": "2024-10-26T18:25:25.517Z", "modified_at": "2023-07-26T10:28:20.791Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "forever", "duration_in_months": 333301, "type": "percentage", "amount": 985928, "currency": "Tunisian Dinar", "created_at": "2025-03-31T17:18:12.309Z", "modified_at": "2025-04-04T07:20:27.321Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": null, "ends_at": "2025-11-07T12:21:07.975Z", "max_redemptions": 986922, "redemptions_count": 691292, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {}, "created_at": "2023-03-16T14:38:58.849Z", "modified_at": "2024-08-12T02:18:50.288Z", "id": "", "amount": 443730, "currency": "Pa'anga", "recurring_interval": "month", "status": "past_due", "current_period_start": "2025-08-22T13:19:25.286Z", "current_period_end": "2025-05-03T08:49:50.424Z", "cancel_at_period_end": true, "canceled_at": "2023-11-21T12:57:47.903Z", "started_at": "2023-09-21T04:07:05.991Z", "ends_at": "2023-10-30T23:29:28.584Z", "ended_at": "2025-05-20T18:28:46.249Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": ""}, "items": [{"created_at": "2023-01-22T05:05:29.797Z", "modified_at": "2025-11-07T21:20:59.535Z", "id": "", "label": "", "amount": 287841, "tax_amount": 922801, "proration": false, "product_price_id": ""}]}} + application/json: {"type": "order.refunded", "data": {"id": "", "created_at": "2024-07-23T18:00:11.615Z", "modified_at": "2024-08-23T03:13:11.383Z", "status": "refunded", "paid": true, "subtotal_amount": 678552, "discount_amount": 294178, "net_amount": 721778, "amount": 913001, "tax_amount": 518308, "total_amount": 820663, "refunded_amount": 472431, "refunded_tax_amount": 879331, "currency": "Hong Kong Dollar", "billing_reason": "subscription_create", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": 4542.91}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-08-11T17:50:11.031Z", "modified_at": "2023-02-24T05:25:29.794Z", "metadata": {"key": 97027, "key1": 958634}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-01-16T07:26:04.196Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "user_id": "", "product": {"metadata": {"key": 4016.73, "key1": 9058.31, "key2": true}, "created_at": "2024-10-26T18:25:25.517Z", "modified_at": "2023-07-26T10:28:20.791Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "forever", "duration_in_months": 333301, "type": "percentage", "amount": 985928, "currency": "Tunisian Dinar", "created_at": "2025-03-31T17:18:12.309Z", "modified_at": "2025-04-04T07:20:27.321Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": null, "ends_at": "2025-11-07T12:21:07.975Z", "max_redemptions": 986922, "redemptions_count": 691292, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {}, "created_at": "2023-03-16T14:38:58.849Z", "modified_at": "2024-08-12T02:18:50.288Z", "id": "", "amount": 443730, "currency": "Pa'anga", "recurring_interval": "month", "status": "past_due", "current_period_start": "2025-08-22T13:19:25.286Z", "current_period_end": "2025-05-03T08:49:50.424Z", "cancel_at_period_end": true, "canceled_at": "2023-11-21T12:57:47.903Z", "started_at": "2023-09-21T04:07:05.991Z", "ends_at": "2023-10-30T23:29:28.584Z", "ended_at": "2025-05-20T18:28:46.249Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": ""}, "items": [{"created_at": "2023-01-22T05:05:29.797Z", "modified_at": "2025-11-07T21:20:59.535Z", "id": "", "label": "", "amount": 287841, "tax_amount": 922801, "proration": false, "product_price_id": ""}]}} responses: "200": application/json: "" @@ -1629,7 +1610,7 @@ examples: _endpointsubscription_created_post: speakeasy-default-endpointsubscription-created-post: requestBody: - application/json: {"type": "subscription.created", "data": {"created_at": "2024-05-03T11:46:21.459Z", "modified_at": "2025-01-12T06:30:14.360Z", "id": "", "amount": 469182, "currency": "Boliviano boliviano", "recurring_interval": "year", "status": "incomplete", "current_period_start": "2024-01-07T06:33:36.381Z", "current_period_end": "2024-07-30T16:54:44.427Z", "cancel_at_period_end": true, "canceled_at": "2023-09-10T18:39:16.136Z", "started_at": "2025-08-30T21:29:16.432Z", "ends_at": "2024-06-27T22:01:23.333Z", "ended_at": "2024-07-24T19:43:04.879Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "missing_features", "customer_cancellation_comment": "", "metadata": {"key": false}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-05-18T22:55:50.482Z", "modified_at": "2024-08-04T23:52:10.438Z", "metadata": {"key": false, "key1": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-05-15T22:05:41.858Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-05-25T09:51:02.679Z", "modified_at": "2025-12-23T23:39:23.705Z", "id": "", "name": "", "description": "slink needily cemetery hydrocarbon a fledgling knit shirk appertain rural", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {}, "prices": [{"created_at": "2025-01-12T06:30:14.360Z", "modified_at": "2023-05-11T16:29:33.481Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 363951, "maximum_amount": 267138, "preset_amount": 230636, "legacy": true}, {"created_at": "2024-09-02T19:02:23.015Z", "modified_at": "2023-08-19T21:45:43.735Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [{"id": "", "created_at": "2024-08-16T04:04:01.242Z", "modified_at": "2023-08-30T05:19:40.088Z", "type": "meter_credit", "description": "courageously quick-witted out equally toward though quietly", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": 3195.27}, "properties": {"units": 371901, "rollover": false, "meter_id": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/lost+found", "mime_type": "", "size": 719695, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-08-21T14:37:14.488Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2025-10-28T06:08:47.416Z", "size_readable": "", "public_url": "https://repentant-unit.org/"}, {"id": "", "organization_id": "", "name": "", "path": "/lost+found", "mime_type": "", "size": 719695, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-08-21T14:37:14.488Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2025-10-28T06:08:47.416Z", "size_readable": "", "public_url": "https://repentant-unit.org/"}, {"id": "", "organization_id": "", "name": "", "path": "/lost+found", "mime_type": "", "size": 719695, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-08-21T14:37:14.488Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2025-10-28T06:08:47.416Z", "size_readable": "", "public_url": "https://repentant-unit.org/"}], "attached_custom_fields": []}, "discount": {"duration": "once", "type": "fixed", "basis_points": 745503, "created_at": "2024-04-19T20:53:32.186Z", "modified_at": "2024-11-15T00:04:04.545Z", "id": "", "metadata": {"key": 3699.53}, "name": "", "code": "", "starts_at": "2024-10-15T21:24:43.202Z", "ends_at": "2025-09-26T06:55:01.272Z", "max_redemptions": 104800, "redemptions_count": 570322, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-11-26T09:15:00.973Z", "modified_at": "2024-01-19T16:01:53.249Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 125871, "legacy": true}], "meters": [{"created_at": "2025-05-17T01:58:02.155Z", "modified_at": "2024-09-29T09:35:40.427Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 201601, "key1": true, "key2": 2057.75}, "created_at": "2025-03-06T04:32:46.256Z", "modified_at": "2024-01-13T00:47:03.334Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": []}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2025-05-17T01:58:02.155Z", "modified_at": "2024-09-29T09:35:40.427Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 201601, "key1": true, "key2": 2057.75}, "created_at": "2025-03-06T04:32:46.256Z", "modified_at": "2024-01-13T00:47:03.334Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": []}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2025-05-17T01:58:02.155Z", "modified_at": "2024-09-29T09:35:40.427Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 201601, "key1": true, "key2": 2057.75}, "created_at": "2025-03-06T04:32:46.256Z", "modified_at": "2024-01-13T00:47:03.334Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": []}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}]}} + application/json: {"type": "subscription.created", "data": {"created_at": "2024-05-03T11:46:21.459Z", "modified_at": "2025-01-12T06:30:14.360Z", "id": "", "amount": 469182, "currency": "Boliviano boliviano", "recurring_interval": "year", "status": "incomplete", "current_period_start": "2024-01-07T06:33:36.381Z", "current_period_end": "2024-07-30T16:54:44.427Z", "cancel_at_period_end": true, "canceled_at": "2023-09-10T18:39:16.136Z", "started_at": "2025-08-30T21:29:16.432Z", "ends_at": "2024-06-27T22:01:23.333Z", "ended_at": "2024-07-24T19:43:04.879Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "missing_features", "customer_cancellation_comment": "", "metadata": {"key": false}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-05-18T22:55:50.482Z", "modified_at": "2024-08-04T23:52:10.438Z", "metadata": {"key": false, "key1": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-05-15T22:05:41.858Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2024-05-25T09:51:02.679Z", "modified_at": "2025-12-23T23:39:23.705Z", "id": "", "name": "", "description": "slink needily cemetery hydrocarbon a fledgling knit shirk appertain rural", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {}, "prices": [{"created_at": "2025-01-12T06:30:14.360Z", "modified_at": "2023-05-11T16:29:33.481Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 363951, "maximum_amount": 267138, "preset_amount": 230636, "legacy": true}, {"created_at": "2024-09-02T19:02:23.015Z", "modified_at": "2023-08-19T21:45:43.735Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [{"id": "", "created_at": "2024-08-16T04:04:01.242Z", "modified_at": "2023-08-30T05:19:40.088Z", "type": "meter_credit", "description": "courageously quick-witted out equally toward though quietly", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": 3195.27}, "properties": {"units": 371901, "rollover": false, "meter_id": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/lost+found", "mime_type": "", "size": 719695, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-08-21T14:37:14.488Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2025-10-28T06:08:47.416Z", "size_readable": "", "public_url": "https://repentant-unit.org/"}, {"id": "", "organization_id": "", "name": "", "path": "/lost+found", "mime_type": "", "size": 719695, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-08-21T14:37:14.488Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2025-10-28T06:08:47.416Z", "size_readable": "", "public_url": "https://repentant-unit.org/"}, {"id": "", "organization_id": "", "name": "", "path": "/lost+found", "mime_type": "", "size": 719695, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-08-21T14:37:14.488Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2025-10-28T06:08:47.416Z", "size_readable": "", "public_url": "https://repentant-unit.org/"}], "attached_custom_fields": []}, "discount": {"duration": "once", "type": "fixed", "basis_points": 745503, "created_at": "2024-04-19T20:53:32.186Z", "modified_at": "2024-11-15T00:04:04.545Z", "id": "", "metadata": {"key": 3699.53}, "name": "", "code": "", "starts_at": "2024-10-15T21:24:43.202Z", "ends_at": "2025-09-26T06:55:01.272Z", "max_redemptions": 104800, "redemptions_count": 570322, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-11-26T09:15:00.973Z", "modified_at": "2024-01-19T16:01:53.249Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 125871, "legacy": true}], "meters": [{"created_at": "2025-05-17T01:58:02.155Z", "modified_at": "2024-09-29T09:35:40.427Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 201601, "key1": true, "key2": 2057.75}, "created_at": "2025-03-06T04:32:46.256Z", "modified_at": "2024-01-13T00:47:03.334Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": []}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2025-05-17T01:58:02.155Z", "modified_at": "2024-09-29T09:35:40.427Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 201601, "key1": true, "key2": 2057.75}, "created_at": "2025-03-06T04:32:46.256Z", "modified_at": "2024-01-13T00:47:03.334Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": []}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2025-05-17T01:58:02.155Z", "modified_at": "2024-09-29T09:35:40.427Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 201601, "key1": true, "key2": 2057.75}, "created_at": "2025-03-06T04:32:46.256Z", "modified_at": "2024-01-13T00:47:03.334Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": []}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}]}} responses: "200": application/json: "" @@ -1638,7 +1619,7 @@ examples: _endpointsubscription_updated_post: speakeasy-default-endpointsubscription-updated-post: requestBody: - application/json: {"type": "subscription.updated", "data": {"created_at": "2023-06-24T13:26:25.969Z", "modified_at": "2024-10-16T16:24:20.274Z", "id": "", "amount": 505562, "currency": "Guyana Dollar", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-06-19T12:29:28.503Z", "current_period_end": "2023-08-24T22:14:10.131Z", "cancel_at_period_end": false, "canceled_at": "2025-08-31T06:08:08.476Z", "started_at": "2023-06-01T08:01:27.951Z", "ends_at": "2025-01-23T22:07:32.693Z", "ended_at": "2025-05-14T13:55:44.367Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {"key": 477870, "key1": true, "key2": 485359}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-01-10T06:45:35.933Z", "modified_at": "2024-01-24T02:08:13.039Z", "metadata": {"key": 117983, "key1": 8500.16}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-08-09T14:29:57.545Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-12-02T17:09:45.787Z", "modified_at": "2025-03-11T00:51:56.943Z", "id": "", "name": "", "description": "obnoxiously save following clinch striking juicy", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": false, "key1": 884041, "key2": 4257.66}, "prices": [{"created_at": "2024-10-16T16:24:20.274Z", "modified_at": "2024-01-05T22:20:15.867Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 488614, "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 29348, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": null, "last_modified_at": "2023-10-03T10:28:13.472Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-07T09:47:56.854Z", "size_readable": "", "public_url": "https://flowery-promise.org/"}, {"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 29348, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": null, "last_modified_at": "2023-10-03T10:28:13.472Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-07T09:47:56.854Z", "size_readable": "", "public_url": "https://flowery-promise.org/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-01-10T20:33:55.554Z", "modified_at": "2023-03-14T14:16:19.041Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 766194, "required": false}]}, "discount": {"duration": "once", "duration_in_months": 892166, "type": "fixed", "amount": 996997, "currency": "Canadian Dollar", "created_at": "2023-06-09T06:11:59.062Z", "modified_at": "2024-09-28T05:16:48.757Z", "id": "", "metadata": {"key": 962223, "key1": 587522}, "name": "", "code": "", "starts_at": "2023-04-12T20:54:06.410Z", "ends_at": "2025-03-19T14:28:57.223Z", "max_redemptions": 852845, "redemptions_count": 658199, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [], "meters": [{"created_at": "2025-06-07T13:44:19.881Z", "modified_at": "2023-12-06T20:26:36.699Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 6882, "key1": 556425, "key2": 117069}, "created_at": "2023-05-21T02:26:27.963Z", "modified_at": "2025-06-09T17:54:52.162Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": [{"conjunction": "or", "clauses": []}, {"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-06-07T13:44:19.881Z", "modified_at": "2023-12-06T20:26:36.699Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 6882, "key1": 556425, "key2": 117069}, "created_at": "2023-05-21T02:26:27.963Z", "modified_at": "2025-06-09T17:54:52.162Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": [{"conjunction": "or", "clauses": []}, {"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}]}} + application/json: {"type": "subscription.updated", "data": {"created_at": "2023-06-24T13:26:25.969Z", "modified_at": "2024-10-16T16:24:20.274Z", "id": "", "amount": 505562, "currency": "Guyana Dollar", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-06-19T12:29:28.503Z", "current_period_end": "2023-08-24T22:14:10.131Z", "cancel_at_period_end": false, "canceled_at": "2025-08-31T06:08:08.476Z", "started_at": "2023-06-01T08:01:27.951Z", "ends_at": "2025-01-23T22:07:32.693Z", "ended_at": "2025-05-14T13:55:44.367Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {"key": 477870, "key1": true, "key2": 485359}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-01-10T06:45:35.933Z", "modified_at": "2024-01-24T02:08:13.039Z", "metadata": {"key": 117983, "key1": 8500.16}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-08-09T14:29:57.545Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2024-12-02T17:09:45.787Z", "modified_at": "2025-03-11T00:51:56.943Z", "id": "", "name": "", "description": "obnoxiously save following clinch striking juicy", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": false, "key1": 884041, "key2": 4257.66}, "prices": [{"created_at": "2024-10-16T16:24:20.274Z", "modified_at": "2024-01-05T22:20:15.867Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 488614, "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 29348, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": null, "last_modified_at": "2023-10-03T10:28:13.472Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-07T09:47:56.854Z", "size_readable": "", "public_url": "https://flowery-promise.org/"}, {"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 29348, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": null, "last_modified_at": "2023-10-03T10:28:13.472Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-10-07T09:47:56.854Z", "size_readable": "", "public_url": "https://flowery-promise.org/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-01-10T20:33:55.554Z", "modified_at": "2023-03-14T14:16:19.041Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 766194, "required": false}]}, "discount": {"duration": "once", "duration_in_months": 892166, "type": "fixed", "amount": 996997, "currency": "Canadian Dollar", "created_at": "2023-06-09T06:11:59.062Z", "modified_at": "2024-09-28T05:16:48.757Z", "id": "", "metadata": {"key": 962223, "key1": 587522}, "name": "", "code": "", "starts_at": "2023-04-12T20:54:06.410Z", "ends_at": "2025-03-19T14:28:57.223Z", "max_redemptions": 852845, "redemptions_count": 658199, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [], "meters": [{"created_at": "2025-06-07T13:44:19.881Z", "modified_at": "2023-12-06T20:26:36.699Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 6882, "key1": 556425, "key2": 117069}, "created_at": "2023-05-21T02:26:27.963Z", "modified_at": "2025-06-09T17:54:52.162Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": [{"conjunction": "or", "clauses": []}, {"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-06-07T13:44:19.881Z", "modified_at": "2023-12-06T20:26:36.699Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 6882, "key1": 556425, "key2": 117069}, "created_at": "2023-05-21T02:26:27.963Z", "modified_at": "2025-06-09T17:54:52.162Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": [{"conjunction": "or", "clauses": []}, {"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}]}} responses: "200": application/json: "" @@ -1647,7 +1628,7 @@ examples: _endpointsubscription_active_post: speakeasy-default-endpointsubscription-active-post: requestBody: - application/json: {"type": "subscription.active", "data": {"created_at": "2023-08-13T01:28:21.362Z", "modified_at": "2024-06-25T00:41:05.678Z", "id": "", "amount": 320436, "currency": "Peso Uruguayo", "recurring_interval": "month", "status": "past_due", "current_period_start": "2023-06-09T14:14:48.363Z", "current_period_end": null, "cancel_at_period_end": true, "canceled_at": null, "started_at": "2023-07-21T07:29:31.409Z", "ends_at": "2025-08-05T11:38:46.213Z", "ended_at": "2024-09-05T04:27:23.768Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "too_complex", "customer_cancellation_comment": "", "metadata": {"key": false}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-08-17T18:35:42.212Z", "modified_at": "2025-01-01T23:32:39.659Z", "metadata": {"key": 7303.56, "key1": 796236}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2025-11-05T10:18:40.300Z", "modified_at": "2024-04-23T18:24:43.408Z", "id": "", "name": "", "description": "athwart fail wound oh nor boohoo reasoning against since", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": 722592}, "prices": [], "benefits": [{"id": "", "created_at": "2025-05-21T10:49:13.924Z", "modified_at": null, "type": "license_keys", "description": "chime softly outgoing gray", "selectable": false, "deletable": false, "organization_id": "", "metadata": {}, "properties": {"prefix": "", "expires": {"ttl": 18256, "timeframe": "day"}, "activations": {"limit": 776442, "enable_customer_admin": false}, "limit_usage": 89994}}, {"id": "", "created_at": "2023-02-11T00:08:34.711Z", "modified_at": "2024-10-21T08:00:16.195Z", "type": "github_repository", "description": "as draft noon kettledrum alligator", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 331688, "key1": 10869, "key2": true}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "maintain"}}, {"id": "", "created_at": "2023-02-11T00:08:34.711Z", "modified_at": "2024-10-21T08:00:16.195Z", "type": "github_repository", "description": "as draft noon kettledrum alligator", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 331688, "key1": 10869, "key2": true}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "maintain"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/libexec", "mime_type": "", "size": 980211, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-01T03:11:19.881Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-05-05T22:00:20.852Z", "size_readable": "", "public_url": "https://shabby-integer.org"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/libexec", "mime_type": "", "size": 980211, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-01T03:11:19.881Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-05-05T22:00:20.852Z", "size_readable": "", "public_url": "https://shabby-integer.org"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/libexec", "mime_type": "", "size": 980211, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-01T03:11:19.881Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-05-05T22:00:20.852Z", "size_readable": "", "public_url": "https://shabby-integer.org"}], "attached_custom_fields": []}, "discount": {"duration": "repeating", "duration_in_months": 482318, "type": "percentage", "amount": 489921, "currency": "Chilean Peso", "created_at": "2023-10-09T08:41:16.911Z", "modified_at": "2025-08-16T07:28:28.929Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2024-04-06T16:40:05.860Z", "ends_at": "2023-01-06T22:21:47.288Z", "max_redemptions": null, "redemptions_count": 313365, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2024-06-25T00:41:05.678Z", "modified_at": "2025-09-12T00:30:21.037Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 89762, "maximum_amount": null, "preset_amount": null, "legacy": true}, {"created_at": "2024-09-14T15:19:58.463Z", "modified_at": "2024-07-30T05:01:30.550Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "month", "price_currency": "", "minimum_amount": 720352, "maximum_amount": 761885, "preset_amount": 542678}, {"created_at": "2025-02-14T12:59:50.680Z", "modified_at": "2025-03-11T11:17:02.540Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "meters": []}} + application/json: {"type": "subscription.active", "data": {"created_at": "2023-08-13T01:28:21.362Z", "modified_at": "2024-06-25T00:41:05.678Z", "id": "", "amount": 320436, "currency": "Peso Uruguayo", "recurring_interval": "month", "status": "past_due", "current_period_start": "2023-06-09T14:14:48.363Z", "current_period_end": null, "cancel_at_period_end": true, "canceled_at": null, "started_at": "2023-07-21T07:29:31.409Z", "ends_at": "2025-08-05T11:38:46.213Z", "ended_at": "2024-09-05T04:27:23.768Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "too_complex", "customer_cancellation_comment": "", "metadata": {"key": false}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-08-17T18:35:42.212Z", "modified_at": "2025-01-01T23:32:39.659Z", "metadata": {"key": 7303.56, "key1": 796236}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2025-11-05T10:18:40.300Z", "modified_at": "2024-04-23T18:24:43.408Z", "id": "", "name": "", "description": "athwart fail wound oh nor boohoo reasoning against since", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": 722592}, "prices": [], "benefits": [{"id": "", "created_at": "2025-05-21T10:49:13.924Z", "modified_at": null, "type": "license_keys", "description": "chime softly outgoing gray", "selectable": false, "deletable": false, "organization_id": "", "metadata": {}, "properties": {"prefix": "", "expires": {"ttl": 18256, "timeframe": "day"}, "activations": {"limit": 776442, "enable_customer_admin": false}, "limit_usage": 89994}}, {"id": "", "created_at": "2023-02-11T00:08:34.711Z", "modified_at": "2024-10-21T08:00:16.195Z", "type": "github_repository", "description": "as draft noon kettledrum alligator", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 331688, "key1": 10869, "key2": true}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "maintain"}}, {"id": "", "created_at": "2023-02-11T00:08:34.711Z", "modified_at": "2024-10-21T08:00:16.195Z", "type": "github_repository", "description": "as draft noon kettledrum alligator", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 331688, "key1": 10869, "key2": true}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "maintain"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/libexec", "mime_type": "", "size": 980211, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-01T03:11:19.881Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-05-05T22:00:20.852Z", "size_readable": "", "public_url": "https://shabby-integer.org"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/libexec", "mime_type": "", "size": 980211, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-01T03:11:19.881Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-05-05T22:00:20.852Z", "size_readable": "", "public_url": "https://shabby-integer.org"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/libexec", "mime_type": "", "size": 980211, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-01T03:11:19.881Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-05-05T22:00:20.852Z", "size_readable": "", "public_url": "https://shabby-integer.org"}], "attached_custom_fields": []}, "discount": {"duration": "repeating", "duration_in_months": 482318, "type": "percentage", "amount": 489921, "currency": "Chilean Peso", "created_at": "2023-10-09T08:41:16.911Z", "modified_at": "2025-08-16T07:28:28.929Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2024-04-06T16:40:05.860Z", "ends_at": "2023-01-06T22:21:47.288Z", "max_redemptions": null, "redemptions_count": 313365, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2024-06-25T00:41:05.678Z", "modified_at": "2025-09-12T00:30:21.037Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 89762, "maximum_amount": null, "preset_amount": null, "legacy": true}, {"created_at": "2024-09-14T15:19:58.463Z", "modified_at": "2024-07-30T05:01:30.550Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 720352, "maximum_amount": 761885, "preset_amount": 542678, "legacy": true}, {"created_at": "2025-02-14T12:59:50.680Z", "modified_at": "2025-03-11T11:17:02.540Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "meters": []}} responses: "200": application/json: "" @@ -1656,7 +1637,7 @@ examples: _endpointsubscription_canceled_post: speakeasy-default-endpointsubscription-canceled-post: requestBody: - application/json: {"type": "subscription.canceled", "data": {"created_at": "2025-02-09T04:39:02.332Z", "modified_at": "2023-04-18T10:38:03.481Z", "id": "", "amount": 137392, "currency": "New Taiwan Dollar", "recurring_interval": "month", "status": "active", "current_period_start": "2023-06-17T04:15:56.819Z", "current_period_end": "2023-06-02T15:48:16.857Z", "cancel_at_period_end": false, "canceled_at": "2024-01-07T18:54:45.602Z", "started_at": "2025-02-23T12:23:49.579Z", "ends_at": "2023-11-16T08:24:59.166Z", "ended_at": "2023-07-21T16:25:14.433Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": null, "customer_cancellation_reason": null, "customer_cancellation_comment": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-10-25T05:52:42.846Z", "modified_at": "2023-09-20T10:20:50.540Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-07-13T08:26:56.650Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2025-06-11T17:21:10.206Z", "modified_at": "2025-03-18T13:26:34.470Z", "id": "", "name": "", "description": "unimpressively stiffen promptly", "recurring_interval": "year", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": true}, "prices": [{"created_at": "2023-04-18T10:38:03.481Z", "modified_at": "2025-08-08T10:15:56.533Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "unit_amount": "", "cap_amount": 739654, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2025-04-18T11:08:34.147Z", "modified_at": "2023-05-05T03:28:24.281Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 25751}], "benefits": [{"id": "", "created_at": "2024-09-21T18:00:22.332Z", "modified_at": "2023-05-12T19:14:12.206Z", "type": "downloadables", "description": "ostrich smog zowie loyally naturally noisily castanet pace deliberately", "selectable": false, "deletable": true, "organization_id": "", "metadata": {}, "properties": {"archived": {"key": true, "key1": true}, "files": []}}, {"id": "", "created_at": "2025-12-18T22:12:17.302Z", "modified_at": "2024-10-10T09:48:09.804Z", "type": "custom", "description": "knavishly goat programme intrigue elegantly fooey decisive", "selectable": false, "deletable": false, "organization_id": "", "metadata": {"key": false, "key1": 922.01, "key2": 5307.16}, "properties": {"note": ""}}, {"id": "", "created_at": "2024-06-11T13:23:03.299Z", "modified_at": "2024-10-18T20:00:03.185Z", "type": "meter_credit", "description": "at like through stale yum corny", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": false}, "properties": {"units": 743161, "rollover": false, "meter_id": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/yp", "mime_type": "", "size": 91402, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-02-20T02:39:11.781Z", "size_readable": "", "public_url": "https://young-obesity.org"}, {"id": "", "organization_id": "", "name": "", "path": "/var/yp", "mime_type": "", "size": 91402, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-02-20T02:39:11.781Z", "size_readable": "", "public_url": "https://young-obesity.org"}], "attached_custom_fields": []}, "discount": {"duration": "once", "type": "fixed", "basis_points": 942713, "created_at": "2025-05-02T10:03:23.149Z", "modified_at": "2024-03-07T17:30:21.663Z", "id": "", "metadata": {"key": "", "key1": false, "key2": ""}, "name": "", "code": "", "starts_at": "2025-11-05T08:42:03.906Z", "ends_at": null, "max_redemptions": 510938, "redemptions_count": 760335, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-08-10T09:00:25.178Z", "modified_at": "2023-05-20T04:28:47.140Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "meters": []}} + application/json: {"type": "subscription.canceled", "data": {"created_at": "2025-02-09T04:39:02.332Z", "modified_at": "2023-04-18T10:38:03.481Z", "id": "", "amount": 137392, "currency": "New Taiwan Dollar", "recurring_interval": "month", "status": "active", "current_period_start": "2023-06-17T04:15:56.819Z", "current_period_end": "2023-06-02T15:48:16.857Z", "cancel_at_period_end": false, "canceled_at": "2024-01-07T18:54:45.602Z", "started_at": "2025-02-23T12:23:49.579Z", "ends_at": "2023-11-16T08:24:59.166Z", "ended_at": "2023-07-21T16:25:14.433Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": null, "customer_cancellation_reason": null, "customer_cancellation_comment": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-10-25T05:52:42.846Z", "modified_at": "2023-09-20T10:20:50.540Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-07-13T08:26:56.650Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2025-06-11T17:21:10.206Z", "modified_at": "2025-03-18T13:26:34.470Z", "id": "", "name": "", "description": "unimpressively stiffen promptly", "recurring_interval": "year", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": true}, "prices": [{"created_at": "2023-04-18T10:38:03.481Z", "modified_at": "2025-08-08T10:15:56.533Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "unit_amount": "", "cap_amount": 739654, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2025-04-18T11:08:34.147Z", "modified_at": "2023-05-05T03:28:24.281Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 25751, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-09-21T18:00:22.332Z", "modified_at": "2023-05-12T19:14:12.206Z", "type": "downloadables", "description": "ostrich smog zowie loyally naturally noisily castanet pace deliberately", "selectable": false, "deletable": true, "organization_id": "", "metadata": {}, "properties": {"archived": {"key": true, "key1": true}, "files": []}}, {"id": "", "created_at": "2025-12-18T22:12:17.302Z", "modified_at": "2024-10-10T09:48:09.804Z", "type": "custom", "description": "knavishly goat programme intrigue elegantly fooey decisive", "selectable": false, "deletable": false, "organization_id": "", "metadata": {"key": false, "key1": 922.01, "key2": 5307.16}, "properties": {"note": ""}}, {"id": "", "created_at": "2024-06-11T13:23:03.299Z", "modified_at": "2024-10-18T20:00:03.185Z", "type": "meter_credit", "description": "at like through stale yum corny", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": false}, "properties": {"units": 743161, "rollover": false, "meter_id": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/yp", "mime_type": "", "size": 91402, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-02-20T02:39:11.781Z", "size_readable": "", "public_url": "https://young-obesity.org"}, {"id": "", "organization_id": "", "name": "", "path": "/var/yp", "mime_type": "", "size": 91402, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-02-20T02:39:11.781Z", "size_readable": "", "public_url": "https://young-obesity.org"}], "attached_custom_fields": []}, "discount": {"duration": "once", "type": "fixed", "basis_points": 942713, "created_at": "2025-05-02T10:03:23.149Z", "modified_at": "2024-03-07T17:30:21.663Z", "id": "", "metadata": {"key": "", "key1": false, "key2": ""}, "name": "", "code": "", "starts_at": "2025-11-05T08:42:03.906Z", "ends_at": null, "max_redemptions": 510938, "redemptions_count": 760335, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-08-10T09:00:25.178Z", "modified_at": "2023-05-20T04:28:47.140Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "meters": []}} responses: "200": application/json: "" @@ -1665,7 +1646,7 @@ examples: _endpointsubscription_uncanceled_post: speakeasy-default-endpointsubscription-uncanceled-post: requestBody: - application/json: {"type": "subscription.uncanceled", "data": {"created_at": "2023-02-06T17:25:10.106Z", "modified_at": "2023-01-25T07:20:02.381Z", "id": "", "amount": 755736, "currency": "Iceland Krona", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-04-11T19:08:16.655Z", "current_period_end": "2023-08-23T01:03:59.107Z", "cancel_at_period_end": true, "canceled_at": "2024-11-16T02:01:16.824Z", "started_at": null, "ends_at": "2023-12-23T04:50:00.016Z", "ended_at": "2024-10-18T16:25:47.209Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": null, "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-10-01T20:42:25.530Z", "modified_at": "2024-07-04T17:30:56.477Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-12-20T09:31:52.259Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-03-26T06:19:23.237Z", "modified_at": "2024-05-11T18:08:21.251Z", "id": "", "name": "", "description": "questioningly proliferate yet vanish mooch yowza hopeful", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {}, "prices": [{"created_at": "2023-01-25T07:20:02.381Z", "modified_at": "2024-03-21T16:37:42.322Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 107066, "maximum_amount": 251812, "preset_amount": 625077, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-07-09T11:35:46.121Z", "modified_at": "2024-07-14T11:45:04.348Z", "type": "downloadables", "description": "esteemed aha arcade", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 549444}, "properties": {"archived": {"key": false, "key1": false, "key2": true}, "files": [""]}}, {"id": "", "created_at": "2023-07-17T10:10:30.145Z", "modified_at": "2024-02-22T01:39:19.437Z", "type": "github_repository", "description": "hmph frantically for into unfurl rapidly when", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": ""}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "admin"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/namedb", "mime_type": "", "size": 865781, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2024-09-05T02:35:48.322Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-06T10:04:39.843Z", "size_readable": "", "public_url": "https://normal-giant.org/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2025-05-08T20:53:14.936Z", "modified_at": "2025-08-01T19:32:49.347Z", "id": "", "metadata": {"key": 791230}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 887720, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2025-05-08T20:53:14.936Z", "modified_at": "2025-08-01T19:32:49.347Z", "id": "", "metadata": {"key": 791230}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 887720, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2025-05-08T20:53:14.936Z", "modified_at": "2025-08-01T19:32:49.347Z", "id": "", "metadata": {"key": 791230}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 887720, "required": false}]}, "discount": {"duration": "once", "type": "fixed", "basis_points": 408479, "created_at": "2023-03-14T02:37:49.424Z", "modified_at": "2025-12-23T02:41:08.695Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2024-07-07T16:21:42.534Z", "ends_at": "2023-05-08T21:16:10.476Z", "max_redemptions": 431440, "redemptions_count": 127195, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-12-23T04:50:00.016Z", "modified_at": "2024-10-18T16:25:47.209Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 138645, "maximum_amount": 95755, "preset_amount": 417130, "legacy": true}], "meters": [{"created_at": "2025-11-08T06:13:24.540Z", "modified_at": "2023-05-26T16:36:35.734Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 479423, "key1": 327992}, "created_at": "2025-01-03T20:59:19.837Z", "modified_at": "2024-09-23T23:32:35.223Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": []}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-11-08T06:13:24.540Z", "modified_at": "2023-05-26T16:36:35.734Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 479423, "key1": 327992}, "created_at": "2025-01-03T20:59:19.837Z", "modified_at": "2024-09-23T23:32:35.223Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": []}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-11-08T06:13:24.540Z", "modified_at": "2023-05-26T16:36:35.734Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 479423, "key1": 327992}, "created_at": "2025-01-03T20:59:19.837Z", "modified_at": "2024-09-23T23:32:35.223Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": []}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}]}} + application/json: {"type": "subscription.uncanceled", "data": {"created_at": "2023-02-06T17:25:10.106Z", "modified_at": "2023-01-25T07:20:02.381Z", "id": "", "amount": 755736, "currency": "Iceland Krona", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-04-11T19:08:16.655Z", "current_period_end": "2023-08-23T01:03:59.107Z", "cancel_at_period_end": true, "canceled_at": "2024-11-16T02:01:16.824Z", "started_at": null, "ends_at": "2023-12-23T04:50:00.016Z", "ended_at": "2024-10-18T16:25:47.209Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": null, "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-10-01T20:42:25.530Z", "modified_at": "2024-07-04T17:30:56.477Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-12-20T09:31:52.259Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2024-03-26T06:19:23.237Z", "modified_at": "2024-05-11T18:08:21.251Z", "id": "", "name": "", "description": "questioningly proliferate yet vanish mooch yowza hopeful", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {}, "prices": [{"created_at": "2023-01-25T07:20:02.381Z", "modified_at": "2024-03-21T16:37:42.322Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 107066, "maximum_amount": 251812, "preset_amount": 625077, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-07-09T11:35:46.121Z", "modified_at": "2024-07-14T11:45:04.348Z", "type": "downloadables", "description": "esteemed aha arcade", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 549444}, "properties": {"archived": {"key": false, "key1": false, "key2": true}, "files": [""]}}, {"id": "", "created_at": "2023-07-17T10:10:30.145Z", "modified_at": "2024-02-22T01:39:19.437Z", "type": "github_repository", "description": "hmph frantically for into unfurl rapidly when", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": ""}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "admin"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/namedb", "mime_type": "", "size": 865781, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2024-09-05T02:35:48.322Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-06T10:04:39.843Z", "size_readable": "", "public_url": "https://normal-giant.org/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2025-05-08T20:53:14.936Z", "modified_at": "2025-08-01T19:32:49.347Z", "id": "", "metadata": {"key": 791230}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 887720, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2025-05-08T20:53:14.936Z", "modified_at": "2025-08-01T19:32:49.347Z", "id": "", "metadata": {"key": 791230}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 887720, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2025-05-08T20:53:14.936Z", "modified_at": "2025-08-01T19:32:49.347Z", "id": "", "metadata": {"key": 791230}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 887720, "required": false}]}, "discount": {"duration": "once", "type": "fixed", "basis_points": 408479, "created_at": "2023-03-14T02:37:49.424Z", "modified_at": "2025-12-23T02:41:08.695Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2024-07-07T16:21:42.534Z", "ends_at": "2023-05-08T21:16:10.476Z", "max_redemptions": 431440, "redemptions_count": 127195, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-12-23T04:50:00.016Z", "modified_at": "2024-10-18T16:25:47.209Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 138645, "maximum_amount": 95755, "preset_amount": 417130, "legacy": true}], "meters": [{"created_at": "2025-11-08T06:13:24.540Z", "modified_at": "2023-05-26T16:36:35.734Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 479423, "key1": 327992}, "created_at": "2025-01-03T20:59:19.837Z", "modified_at": "2024-09-23T23:32:35.223Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": []}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-11-08T06:13:24.540Z", "modified_at": "2023-05-26T16:36:35.734Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 479423, "key1": 327992}, "created_at": "2025-01-03T20:59:19.837Z", "modified_at": "2024-09-23T23:32:35.223Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": []}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-11-08T06:13:24.540Z", "modified_at": "2023-05-26T16:36:35.734Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": 479423, "key1": 327992}, "created_at": "2025-01-03T20:59:19.837Z", "modified_at": "2024-09-23T23:32:35.223Z", "id": "", "name": "", "filter": {"conjunction": "and", "clauses": []}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}]}} responses: "200": application/json: "" @@ -1674,7 +1655,7 @@ examples: _endpointsubscription_revoked_post: speakeasy-default-endpointsubscription-revoked-post: requestBody: - application/json: {"type": "subscription.revoked", "data": {"created_at": "2024-01-02T06:40:50.860Z", "modified_at": null, "id": "", "amount": 357630, "currency": "Fiji Dollar", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-04-30T10:39:59.432Z", "current_period_end": "2025-03-19T11:29:47.842Z", "cancel_at_period_end": true, "canceled_at": "2023-02-17T04:59:11.584Z", "started_at": "2024-02-14T23:20:57.498Z", "ends_at": "2025-04-28T23:19:31.379Z", "ended_at": "2023-04-29T06:37:50.213Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": "", "metadata": {"key": 764246}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-03-17T11:47:03.932Z", "modified_at": "2025-12-12T02:48:12.123Z", "metadata": {"key": true, "key1": 683572}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-12-09T13:41:39.970Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2025-05-31T05:10:14.997Z", "modified_at": "2024-05-08T09:12:04.956Z", "id": "", "name": "", "description": "pace aside typewriter if oh almost supposing twine", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": 956675}, "prices": [], "benefits": [{"id": "", "created_at": "2024-06-28T04:33:55.419Z", "modified_at": "2023-04-08T23:58:31.520Z", "type": "github_repository", "description": "eventually holster drab finished than sanity wiggly surprisingly judicious", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": false, "key1": 683668, "key2": 4880.9}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "admin"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 789606, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-10-08T06:21:41.000Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2024-12-10T00:21:44.017Z", "size_readable": "", "public_url": "https://poor-duster.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 789606, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-10-08T06:21:41.000Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2024-12-10T00:21:44.017Z", "size_readable": "", "public_url": "https://poor-duster.name/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-02-06T03:19:32.386Z", "modified_at": "2023-10-17T04:09:43.608Z", "id": "", "metadata": {}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 575720, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-02-06T03:19:32.386Z", "modified_at": "2023-10-17T04:09:43.608Z", "id": "", "metadata": {}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 575720, "required": false}]}, "discount": null, "prices": [], "meters": []}} + application/json: {"type": "subscription.revoked", "data": {"created_at": "2024-01-02T06:40:50.860Z", "modified_at": null, "id": "", "amount": 357630, "currency": "Fiji Dollar", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-04-30T10:39:59.432Z", "current_period_end": "2025-03-19T11:29:47.842Z", "cancel_at_period_end": true, "canceled_at": "2023-02-17T04:59:11.584Z", "started_at": "2024-02-14T23:20:57.498Z", "ends_at": "2025-04-28T23:19:31.379Z", "ended_at": "2023-04-29T06:37:50.213Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": "", "metadata": {"key": 764246}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-03-17T11:47:03.932Z", "modified_at": "2025-12-12T02:48:12.123Z", "metadata": {"key": true, "key1": 683572}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-12-09T13:41:39.970Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2025-05-31T05:10:14.997Z", "modified_at": "2024-05-08T09:12:04.956Z", "id": "", "name": "", "description": "pace aside typewriter if oh almost supposing twine", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": 956675}, "prices": [], "benefits": [{"id": "", "created_at": "2024-06-28T04:33:55.419Z", "modified_at": "2023-04-08T23:58:31.520Z", "type": "github_repository", "description": "eventually holster drab finished than sanity wiggly surprisingly judicious", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": false, "key1": 683668, "key2": 4880.9}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "admin"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 789606, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-10-08T06:21:41.000Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2024-12-10T00:21:44.017Z", "size_readable": "", "public_url": "https://poor-duster.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 789606, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-10-08T06:21:41.000Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2024-12-10T00:21:44.017Z", "size_readable": "", "public_url": "https://poor-duster.name/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-02-06T03:19:32.386Z", "modified_at": "2023-10-17T04:09:43.608Z", "id": "", "metadata": {}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 575720, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-02-06T03:19:32.386Z", "modified_at": "2023-10-17T04:09:43.608Z", "id": "", "metadata": {}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 575720, "required": false}]}, "discount": null, "prices": [], "meters": []}} responses: "200": application/json: "" @@ -1701,7 +1682,7 @@ examples: _endpointproduct_created_post: speakeasy-default-endpointproduct-created-post: requestBody: - application/json: {"type": "product.created", "data": {"created_at": "2023-10-13T02:47:55.082Z", "modified_at": null, "id": "", "name": "", "description": "till that ew put", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": 785881, "key1": false, "key2": false}, "prices": [{"created_at": "2024-07-28T01:37:16.074Z", "modified_at": "2024-06-21T04:06:38.404Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 351958, "maximum_amount": 675813, "preset_amount": 835712, "legacy": true}, {"created_at": "2024-01-23T05:50:45.318Z", "modified_at": "2024-12-09T02:07:21.938Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2023-09-12T18:18:34.397Z", "modified_at": null, "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 575460, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-07-31T20:09:09.874Z", "modified_at": "2023-08-27T06:26:02.524Z", "type": "discord", "description": "aha than before frugal ornery thoroughly once provided cork", "selectable": false, "deletable": false, "organization_id": "", "metadata": {"key": "", "key1": 919470, "key2": 8910.27}, "properties": {"guild_id": "", "role_id": "", "guild_token": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 616062, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-10-29T10:58:55.115Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-02-03T23:25:29.448Z", "size_readable": "", "public_url": "https://livid-stool.biz/"}], "attached_custom_fields": []}} + application/json: {"type": "product.created", "data": {"created_at": "2023-10-13T02:47:55.082Z", "modified_at": null, "id": "", "name": "", "description": "till that ew put", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": 785881, "key1": false, "key2": false}, "prices": [{"created_at": "2024-07-28T01:37:16.074Z", "modified_at": "2024-06-21T04:06:38.404Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 351958, "maximum_amount": 675813, "preset_amount": 835712, "legacy": true}, {"created_at": "2024-01-23T05:50:45.318Z", "modified_at": "2024-12-09T02:07:21.938Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2023-09-12T18:18:34.397Z", "modified_at": null, "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 575460, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-01-15T03:15:59.062Z", "modified_at": "2023-07-04T11:33:29.001Z", "type": "discord", "description": "soybean till mortise brr yet sympathetically", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": 247381}, "properties": {"guild_id": "", "role_id": "", "kick_member": true, "guild_token": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 616062, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-10-29T10:58:55.115Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-02-03T23:25:29.448Z", "size_readable": "", "public_url": "https://livid-stool.biz/"}], "attached_custom_fields": []}} responses: "200": application/json: "" @@ -1710,7 +1691,7 @@ examples: _endpointproduct_updated_post: speakeasy-default-endpointproduct-updated-post: requestBody: - application/json: {"type": "product.updated", "data": {"created_at": "2024-08-25T02:00:54.049Z", "modified_at": "2023-07-21T03:22:42.071Z", "id": "", "name": "", "description": "fooey optimistic beyond dress helpfully whispered structure heartfelt consequently", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "metadata": {"key": 495401, "key1": true}, "prices": [{"created_at": "2023-07-21T03:22:42.071Z", "modified_at": "2025-05-10T05:05:05.968Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year"}, {"created_at": "2023-08-10T13:22:51.241Z", "modified_at": "2024-10-05T01:46:47.680Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 753291, "maximum_amount": 103642, "preset_amount": 38424, "legacy": true}, {"created_at": "2024-11-15T20:13:31.076Z", "modified_at": "2025-08-03T01:42:10.311Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 586326, "maximum_amount": 272075, "preset_amount": 946258, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-12-26T20:43:42.655Z", "modified_at": "2023-11-13T02:29:49.304Z", "type": "downloadables", "description": "towards avaricious oof after nutritious", "selectable": true, "deletable": true, "organization_id": "", "metadata": {}, "properties": {"archived": {"key": false}, "files": ["", "", ""]}}, {"id": "", "created_at": "2023-09-18T01:08:29.935Z", "modified_at": "2025-06-15T04:30:20.706Z", "type": "meter_credit", "description": "where patroller after aw arid", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": true, "key1": ""}, "properties": {"units": 292879, "rollover": true, "meter_id": ""}}, {"id": "", "created_at": "2023-08-06T07:32:57.958Z", "modified_at": "2023-04-29T20:41:41.892Z", "type": "github_repository", "description": "once however abnormally pace wretched presell", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": false}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "pull"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 435627, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-04-14T07:39:07.142Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-04-21T20:24:54.389Z", "size_readable": "", "public_url": "https://uneven-juggernaut.net"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2025-10-22T03:22:15.717Z", "modified_at": "2024-11-21T19:59:56.303Z", "id": "", "metadata": {"key": true, "key1": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 876633, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2025-10-22T03:22:15.717Z", "modified_at": "2024-11-21T19:59:56.303Z", "id": "", "metadata": {"key": true, "key1": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 876633, "required": true}]}} + application/json: {"type": "product.updated", "data": {"created_at": "2024-08-25T02:00:54.049Z", "modified_at": "2023-07-21T03:22:42.071Z", "id": "", "name": "", "description": "fooey optimistic beyond dress helpfully whispered structure heartfelt consequently", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "metadata": {"key": 495401, "key1": true}, "prices": [{"created_at": "2023-07-21T03:22:42.071Z", "modified_at": "2025-05-10T05:05:05.968Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-08-10T13:22:51.241Z", "modified_at": "2024-10-05T01:46:47.680Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 753291, "maximum_amount": 103642, "preset_amount": 38424, "legacy": true}, {"created_at": "2024-11-15T20:13:31.076Z", "modified_at": "2025-08-03T01:42:10.311Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 586326, "maximum_amount": 272075, "preset_amount": 946258, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-12-26T20:43:42.655Z", "modified_at": "2023-11-13T02:29:49.304Z", "type": "downloadables", "description": "towards avaricious oof after nutritious", "selectable": true, "deletable": true, "organization_id": "", "metadata": {}, "properties": {"archived": {"key": false}, "files": ["", "", ""]}}, {"id": "", "created_at": "2023-09-18T01:08:29.935Z", "modified_at": "2025-06-15T04:30:20.706Z", "type": "meter_credit", "description": "where patroller after aw arid", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": true, "key1": ""}, "properties": {"units": 292879, "rollover": true, "meter_id": ""}}, {"id": "", "created_at": "2023-08-06T07:32:57.958Z", "modified_at": "2023-04-29T20:41:41.892Z", "type": "github_repository", "description": "once however abnormally pace wretched presell", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": false}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "pull"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt", "mime_type": "", "size": 435627, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-04-14T07:39:07.142Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-04-21T20:24:54.389Z", "size_readable": "", "public_url": "https://uneven-juggernaut.net"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2025-10-22T03:22:15.717Z", "modified_at": "2024-11-21T19:59:56.303Z", "id": "", "metadata": {"key": true, "key1": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 876633, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2025-10-22T03:22:15.717Z", "modified_at": "2024-11-21T19:59:56.303Z", "id": "", "metadata": {"key": true, "key1": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 876633, "required": true}]}} responses: "200": application/json: "" @@ -1719,7 +1700,7 @@ examples: _endpointorganization_updated_post: speakeasy-default-endpointorganization-updated-post: requestBody: - application/json: {"type": "organization.updated", "data": {"created_at": "2025-08-19T15:02:44.139Z", "modified_at": "2025-08-23T00:45:50.780Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": null, "email": "Lemuel44@gmail.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://grizzled-patroller.info/"}, {"platform": "tiktok", "url": "https://grizzled-patroller.info/"}], "details_submitted_at": null, "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "invoice"}}} + application/json: {"type": "organization.updated", "data": {"created_at": "2025-08-19T15:02:44.139Z", "modified_at": "2025-08-23T00:45:50.780Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": null, "email": "Lemuel44@gmail.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://grizzled-patroller.info/"}, {"platform": "tiktok", "url": "https://grizzled-patroller.info/"}], "details_submitted_at": null, "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "invoice"}, "notification_settings": {"new_order": false, "new_subscription": false}}} responses: "200": application/json: "" @@ -1746,7 +1727,7 @@ examples: _endpointbenefit_grant_created_post: speakeasy-default-endpointbenefit-grant-created-post: requestBody: - application/json: {"type": "benefit_grant.created", "data": {"created_at": "2025-07-29T09:12:26.895Z", "modified_at": "2025-07-26T11:51:14.320Z", "id": "", "is_granted": false, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-05-22T17:07:22.158Z", "modified_at": "2025-05-12T01:27:02.379Z", "metadata": {"key": 74631, "key1": 8472.54, "key2": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-02-04T07:22:26.555Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "properties": {}, "benefit": {"id": "", "created_at": "2023-06-12T14:51:22.188Z", "modified_at": "2023-06-04T11:09:21.440Z", "type": "github_repository", "description": "vibraphone however abseil yet conservative", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": "", "key1": 164738, "key2": 826637}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "maintain"}}}} + application/json: {"type": "benefit_grant.created", "data": {"created_at": "2025-07-29T09:12:26.895Z", "modified_at": "2025-07-26T11:51:14.320Z", "id": "", "is_granted": false, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-05-22T17:07:22.158Z", "modified_at": "2025-05-12T01:27:02.379Z", "metadata": {"key": 74631, "key1": 8472.54, "key2": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-02-04T07:22:26.555Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "properties": {}, "benefit": {"id": "", "created_at": "2023-06-12T14:51:22.188Z", "modified_at": "2023-06-04T11:09:21.440Z", "type": "github_repository", "description": "vibraphone however abseil yet conservative", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": "", "key1": 164738, "key2": 826637}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "maintain"}}}} responses: "200": application/json: "" @@ -1755,7 +1736,7 @@ examples: _endpointbenefit_grant_updated_post: speakeasy-default-endpointbenefit-grant-updated-post: requestBody: - application/json: {"type": "benefit_grant.updated", "data": {"created_at": "2023-06-15T00:42:20.858Z", "modified_at": "2023-09-09T02:35:13.085Z", "id": "", "is_granted": true, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-19T15:08:59.439Z", "modified_at": "2024-06-22T06:57:35.281Z", "metadata": {"key": false, "key1": 322224}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-09-29T05:46:04.457Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "properties": {}, "benefit": {"id": "", "created_at": "2023-12-23T22:21:47.780Z", "modified_at": "2024-02-26T16:39:20.374Z", "type": "downloadables", "description": "cutlet flickering ecstatic materialise verbally appliance", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 2069.39, "key1": ""}, "properties": {"archived": {}, "files": [""]}}}} + application/json: {"type": "benefit_grant.updated", "data": {"created_at": "2023-06-15T00:42:20.858Z", "modified_at": "2023-09-09T02:35:13.085Z", "id": "", "is_granted": true, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-19T15:08:59.439Z", "modified_at": "2024-06-22T06:57:35.281Z", "metadata": {"key": false, "key1": 322224}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-09-29T05:46:04.457Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "properties": {}, "benefit": {"id": "", "created_at": "2023-12-23T22:21:47.780Z", "modified_at": "2024-02-26T16:39:20.374Z", "type": "downloadables", "description": "cutlet flickering ecstatic materialise verbally appliance", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 2069.39, "key1": ""}, "properties": {"archived": {}, "files": [""]}}}} responses: "200": application/json: "" @@ -1764,7 +1745,7 @@ examples: _endpointbenefit_grant_cycled_post: speakeasy-default-endpointbenefit-grant-cycled-post: requestBody: - application/json: {"type": "benefit_grant.cycled", "data": {"created_at": "2023-11-21T13:26:50.948Z", "modified_at": null, "id": "", "is_granted": true, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-02-09T07:31:14.605Z", "modified_at": "2024-01-29T22:31:09.229Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-08-25T13:47:56.433Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "properties": {}, "benefit": {"id": "", "created_at": "2025-07-14T03:36:29.696Z", "modified_at": "2023-08-20T01:19:24.073Z", "type": "downloadables", "description": "witty noisily negative colligate hence geez phew pacemaker marten", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": ""}, "properties": {"archived": {"key": true}, "files": []}}}} + application/json: {"type": "benefit_grant.cycled", "data": {"created_at": "2023-11-21T13:26:50.948Z", "modified_at": null, "id": "", "is_granted": true, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-02-09T07:31:14.605Z", "modified_at": "2024-01-29T22:31:09.229Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-08-25T13:47:56.433Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "properties": {}, "benefit": {"id": "", "created_at": "2025-07-14T03:36:29.696Z", "modified_at": "2023-08-20T01:19:24.073Z", "type": "downloadables", "description": "witty noisily negative colligate hence geez phew pacemaker marten", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": ""}, "properties": {"archived": {"key": true}, "files": []}}}} responses: "200": application/json: "" @@ -1773,7 +1754,7 @@ examples: _endpointbenefit_grant_revoked_post: speakeasy-default-endpointbenefit-grant-revoked-post: requestBody: - application/json: {"type": "benefit_grant.revoked", "data": {"created_at": "2025-10-11T18:40:00.865Z", "modified_at": null, "id": "", "is_granted": true, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-02-19T18:50:01.394Z", "modified_at": "2024-11-20T19:24:54.327Z", "metadata": {"key": 571706}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "properties": {}, "benefit": {"id": "", "created_at": "2024-03-12T16:39:36.178Z", "modified_at": "2024-07-08T07:08:59.377Z", "type": "meter_credit", "description": "grandiose royal surface before ouch silently authentic more override reassuringly", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": "", "key1": 6254.36, "key2": ""}, "properties": {"units": 708154, "rollover": true, "meter_id": ""}}}} + application/json: {"type": "benefit_grant.revoked", "data": {"created_at": "2025-10-11T18:40:00.865Z", "modified_at": null, "id": "", "is_granted": true, "is_revoked": true, "subscription_id": "", "order_id": "", "customer_id": "", "benefit_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-02-19T18:50:01.394Z", "modified_at": "2024-11-20T19:24:54.327Z", "metadata": {"key": 571706}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "properties": {}, "benefit": {"id": "", "created_at": "2024-03-12T16:39:36.178Z", "modified_at": "2024-07-08T07:08:59.377Z", "type": "meter_credit", "description": "grandiose royal surface before ouch silently authentic more override reassuringly", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": "", "key1": 6254.36, "key2": ""}, "properties": {"units": 708154, "rollover": true, "meter_id": ""}}}} responses: "200": application/json: "" @@ -1796,7 +1777,7 @@ examples: application/json: {"name": "", "slug": ""} responses: "201": - application/json: {"created_at": "2024-12-19T02:20:41.368Z", "modified_at": "2024-07-08T16:38:56.712Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://menacing-draft.net", "email": "Ursula99@yahoo.com", "website": "", "socials": [{"platform": "facebook", "url": "https://likable-commodity.biz/"}], "details_submitted_at": "2024-04-04T18:10:47.254Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": true, "proration_behavior": "prorate"}} + application/json: {"created_at": "2024-12-19T02:20:41.368Z", "modified_at": "2024-07-08T16:38:56.712Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://menacing-draft.net", "email": "Ursula99@yahoo.com", "website": "", "socials": [{"platform": "facebook", "url": "https://likable-commodity.biz/"}], "details_submitted_at": "2024-04-04T18:10:47.254Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": true, "proration_behavior": "prorate"}, "notification_settings": {"new_order": false, "new_subscription": false}} "422": application/json: {} organizations:get: @@ -1806,7 +1787,7 @@ examples: id: "1dbfc517-0bbf-4301-9ba8-555ca42b9737" responses: "200": - application/json: {"created_at": "2024-06-18T23:12:24.609Z", "modified_at": "2023-11-22T07:49:02.109Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://far-off-resource.com", "email": "Dejon.Jakubowski-Bashirian6@gmail.com", "website": null, "socials": [{"platform": "other", "url": "https://tedious-habit.com"}, {"platform": "other", "url": "https://tedious-habit.com"}, {"platform": "other", "url": "https://tedious-habit.com"}], "details_submitted_at": "2023-07-16T01:59:28.607Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "prorate"}} + application/json: {"created_at": "2024-06-18T23:12:24.609Z", "modified_at": "2023-11-22T07:49:02.109Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://far-off-resource.com", "email": "Dejon.Jakubowski-Bashirian6@gmail.com", "website": null, "socials": [{"platform": "other", "url": "https://tedious-habit.com"}, {"platform": "other", "url": "https://tedious-habit.com"}, {"platform": "other", "url": "https://tedious-habit.com"}], "details_submitted_at": "2023-07-16T01:59:28.607Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "prorate"}, "notification_settings": {"new_order": true, "new_subscription": true}} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -1820,7 +1801,7 @@ examples: application/json: {} responses: "200": - application/json: {"created_at": "2024-01-10T12:09:47.665Z", "modified_at": "2025-07-12T14:18:16.022Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://juvenile-deed.name/", "email": "Stanford.Streich62@gmail.com", "website": "", "socials": [{"platform": "github", "url": "https://violent-ownership.org/"}], "details_submitted_at": "2024-05-08T13:53:13.516Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}} + application/json: {"created_at": "2024-01-10T12:09:47.665Z", "modified_at": "2025-07-12T14:18:16.022Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://juvenile-deed.name/", "email": "Stanford.Streich62@gmail.com", "website": "", "socials": [{"platform": "github", "url": "https://violent-ownership.org/"}], "details_submitted_at": "2024-05-08T13:53:13.516Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}, "notification_settings": {"new_order": true, "new_subscription": false}} "403": application/json: {"error": "NotPermitted", "detail": ""} "404": @@ -1836,7 +1817,7 @@ examples: limit: 10 responses: "200": - application/json: {"items": [{"created_at": "2024-11-06T13:01:30.486Z", "modified_at": "2024-03-26T10:08:00.196Z", "id": "", "amount": 492124, "currency": "Rial Omani", "recurring_interval": "year", "status": "canceled", "current_period_start": "2025-09-23T15:13:06.761Z", "current_period_end": "2023-09-22T22:50:40.236Z", "cancel_at_period_end": true, "canceled_at": "2024-06-12T10:43:36.497Z", "started_at": "2025-03-14T07:47:35.696Z", "ends_at": "2025-07-03T16:46:46.137Z", "ended_at": "2024-03-20T05:19:38.088Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {"key": true, "key1": 142409}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-24T17:03:16.161Z", "modified_at": "2025-05-07T18:20:34.107Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-06-25T13:44:42.918Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-12-09T00:06:17.749Z", "modified_at": "2025-08-24T16:27:54.472Z", "id": "", "name": "", "description": "er making aha doing offset oh incidentally aside hm", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {"key": false, "key1": false, "key2": false}, "prices": [], "benefits": [{"id": "", "created_at": "2025-04-05T16:53:07.702Z", "modified_at": "2024-05-11T08:58:06.412Z", "type": "custom", "description": "border pink insert sonnet membership access made-up aha an", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": ""}, "properties": {"note": ""}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}]}, "discount": {"duration": "once", "duration_in_months": 68276, "type": "fixed", "amount": 818870, "currency": "Cordoba Oro", "created_at": "2023-04-13T03:33:43.010Z", "modified_at": "2024-12-28T23:48:21.678Z", "id": "", "metadata": {"key": 195279}, "name": "", "code": "", "starts_at": "2024-03-07T23:03:47.221Z", "ends_at": "2024-04-06T03:10:47.055Z", "max_redemptions": 472357, "redemptions_count": 101530, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2024-11-06T13:01:30.486Z", "modified_at": "2024-03-26T10:08:00.196Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year"}, {"created_at": "2023-09-22T22:50:40.236Z", "modified_at": "2025-05-03T04:33:34.190Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "price_amount": 834580}], "meters": []}, {"created_at": "2024-11-06T13:01:30.486Z", "modified_at": "2024-03-26T10:08:00.196Z", "id": "", "amount": 492124, "currency": "Rial Omani", "recurring_interval": "year", "status": "canceled", "current_period_start": "2025-09-23T15:13:06.761Z", "current_period_end": "2023-09-22T22:50:40.236Z", "cancel_at_period_end": true, "canceled_at": "2024-06-12T10:43:36.497Z", "started_at": "2025-03-14T07:47:35.696Z", "ends_at": "2025-07-03T16:46:46.137Z", "ended_at": "2024-03-20T05:19:38.088Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {"key": true, "key1": 142409}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-24T17:03:16.161Z", "modified_at": "2025-05-07T18:20:34.107Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-06-25T13:44:42.918Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-12-09T00:06:17.749Z", "modified_at": "2025-08-24T16:27:54.472Z", "id": "", "name": "", "description": "er making aha doing offset oh incidentally aside hm", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {"key": false, "key1": false, "key2": false}, "prices": [], "benefits": [{"id": "", "created_at": "2025-04-05T16:53:07.702Z", "modified_at": "2024-05-11T08:58:06.412Z", "type": "custom", "description": "border pink insert sonnet membership access made-up aha an", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": ""}, "properties": {"note": ""}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}]}, "discount": {"duration": "once", "duration_in_months": 68276, "type": "fixed", "amount": 818870, "currency": "Cordoba Oro", "created_at": "2023-04-13T03:33:43.010Z", "modified_at": "2024-12-28T23:48:21.678Z", "id": "", "metadata": {"key": 195279}, "name": "", "code": "", "starts_at": "2024-03-07T23:03:47.221Z", "ends_at": "2024-04-06T03:10:47.055Z", "max_redemptions": 472357, "redemptions_count": 101530, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2025-04-30T02:52:35.936Z", "modified_at": "2023-10-29T13:21:35.872Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "price_amount": 262272}, {"created_at": "2023-08-24T17:03:16.161Z", "modified_at": "2025-05-07T18:20:34.107Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 827165, "maximum_amount": 310545, "preset_amount": 154160, "legacy": true}], "meters": []}], "pagination": {"total_count": 947589, "max_page": 388476}} + application/json: {"items": [{"created_at": "2024-11-06T13:01:30.486Z", "modified_at": "2024-03-26T10:08:00.196Z", "id": "", "amount": 492124, "currency": "Rial Omani", "recurring_interval": "year", "status": "canceled", "current_period_start": "2025-09-23T15:13:06.761Z", "current_period_end": "2023-09-22T22:50:40.236Z", "cancel_at_period_end": true, "canceled_at": "2024-06-12T10:43:36.497Z", "started_at": "2025-03-14T07:47:35.696Z", "ends_at": "2025-07-03T16:46:46.137Z", "ended_at": "2024-03-20T05:19:38.088Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {"key": true, "key1": 142409}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-24T17:03:16.161Z", "modified_at": "2025-05-07T18:20:34.107Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-06-25T13:44:42.918Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-12-09T00:06:17.749Z", "modified_at": "2025-08-24T16:27:54.472Z", "id": "", "name": "", "description": "er making aha doing offset oh incidentally aside hm", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {"key": false, "key1": false, "key2": false}, "prices": [], "benefits": [{"id": "", "created_at": "2025-04-05T16:53:07.702Z", "modified_at": "2024-05-11T08:58:06.412Z", "type": "custom", "description": "border pink insert sonnet membership access made-up aha an", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": ""}, "properties": {"note": ""}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}]}, "discount": {"duration": "once", "duration_in_months": 68276, "type": "fixed", "amount": 818870, "currency": "Cordoba Oro", "created_at": "2023-04-13T03:33:43.010Z", "modified_at": "2024-12-28T23:48:21.678Z", "id": "", "metadata": {"key": 195279}, "name": "", "code": "", "starts_at": "2024-03-07T23:03:47.221Z", "ends_at": "2024-04-06T03:10:47.055Z", "max_redemptions": 472357, "redemptions_count": 101530, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2024-11-06T13:01:30.486Z", "modified_at": "2024-03-26T10:08:00.196Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-09-22T22:50:40.236Z", "modified_at": "2025-05-03T04:33:34.190Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 834580, "legacy": true}], "meters": []}, {"created_at": "2024-11-06T13:01:30.486Z", "modified_at": "2024-03-26T10:08:00.196Z", "id": "", "amount": 492124, "currency": "Rial Omani", "recurring_interval": "year", "status": "canceled", "current_period_start": "2025-09-23T15:13:06.761Z", "current_period_end": "2023-09-22T22:50:40.236Z", "cancel_at_period_end": true, "canceled_at": "2024-06-12T10:43:36.497Z", "started_at": "2025-03-14T07:47:35.696Z", "ends_at": "2025-07-03T16:46:46.137Z", "ended_at": "2024-03-20T05:19:38.088Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "metadata": {"key": true, "key1": 142409}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-24T17:03:16.161Z", "modified_at": "2025-05-07T18:20:34.107Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-06-25T13:44:42.918Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-12-09T00:06:17.749Z", "modified_at": "2025-08-24T16:27:54.472Z", "id": "", "name": "", "description": "er making aha doing offset oh incidentally aside hm", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {"key": false, "key1": false, "key2": false}, "prices": [], "benefits": [{"id": "", "created_at": "2025-04-05T16:53:07.702Z", "modified_at": "2024-05-11T08:58:06.412Z", "type": "custom", "description": "border pink insert sonnet membership access made-up aha an", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": ""}, "properties": {"note": ""}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}, {"id": "", "created_at": "2025-05-20T14:55:17.223Z", "modified_at": "2025-04-09T10:13:23.999Z", "type": "github_repository", "description": "quarrelsome joyously diligently mmm joshingly sailor or jury annex", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 810447, "key1": 8377.26, "key2": 623085}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "push"}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/opt/include", "mime_type": "", "size": 39873, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-10-09T14:35:38.900Z", "version": null, "service": "product_media", "is_uploaded": false, "created_at": "2023-06-02T18:03:00.031Z", "size_readable": "", "public_url": "https://aggravating-graffiti.info/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-08-14T02:26:18.152Z", "modified_at": null, "id": "", "metadata": {"key": 496263, "key1": "", "key2": ""}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 561607, "required": false}]}, "discount": {"duration": "once", "duration_in_months": 68276, "type": "fixed", "amount": 818870, "currency": "Cordoba Oro", "created_at": "2023-04-13T03:33:43.010Z", "modified_at": "2024-12-28T23:48:21.678Z", "id": "", "metadata": {"key": 195279}, "name": "", "code": "", "starts_at": "2024-03-07T23:03:47.221Z", "ends_at": "2024-04-06T03:10:47.055Z", "max_redemptions": 472357, "redemptions_count": 101530, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2025-04-30T02:52:35.936Z", "modified_at": "2023-10-29T13:21:35.872Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 262272, "legacy": true}, {"created_at": "2023-08-24T17:03:16.161Z", "modified_at": "2025-05-07T18:20:34.107Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 827165, "maximum_amount": 310545, "preset_amount": 154160, "legacy": true}], "meters": []}], "pagination": {"total_count": 947589, "max_page": 388476}} "422": application/json: {} subscriptions:export: @@ -1856,7 +1837,7 @@ examples: id: "" responses: "200": - application/json: {"created_at": "2023-10-24T15:26:40.431Z", "modified_at": "2023-07-28T23:00:02.724Z", "id": "", "amount": 890847, "currency": "Seychelles Rupee", "recurring_interval": "year", "status": "active", "current_period_start": "2025-04-05T21:01:12.454Z", "current_period_end": null, "cancel_at_period_end": true, "canceled_at": "2025-05-09T12:42:07.453Z", "started_at": "2025-12-16T12:13:32.171Z", "ends_at": "2025-07-23T18:45:11.258Z", "ended_at": null, "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": null, "customer_cancellation_comment": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-06-01T00:25:19.556Z", "modified_at": null, "metadata": {"key": 8941.51, "key1": 393.1}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-03-15T13:55:38.252Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-04-22T11:34:07.174Z", "modified_at": "2024-01-28T05:15:18.595Z", "id": "", "name": "", "description": "solder crossly except yet", "recurring_interval": null, "is_recurring": false, "is_archived": false, "organization_id": "", "metadata": {}, "prices": [{"created_at": "2023-07-28T23:00:02.724Z", "modified_at": "2025-03-22T08:23:39.797Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 753537, "legacy": true}, {"created_at": "2023-10-17T03:10:19.145Z", "modified_at": "2024-12-02T16:50:43.309Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 852903, "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/mail", "mime_type": "", "size": 768823, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-22T03:27:39.662Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-06-30T04:51:26.931Z", "size_readable": "", "public_url": "https://gigantic-spring.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/var/mail", "mime_type": "", "size": 768823, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-22T03:27:39.662Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-06-30T04:51:26.931Z", "size_readable": "", "public_url": "https://gigantic-spring.name/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-20T15:07:05.822Z", "modified_at": "2025-07-11T03:45:02.430Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 61252, "required": true}]}, "discount": {"duration": "once", "duration_in_months": 342177, "type": "fixed", "amount": 861306, "currency": "CFA Franc BCEAO", "created_at": "2023-04-20T11:08:19.373Z", "modified_at": "2023-06-26T04:56:35.602Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2023-05-19T07:23:10.203Z", "ends_at": null, "max_redemptions": 381050, "redemptions_count": 60295, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [], "meters": []} + application/json: {"created_at": "2023-10-24T15:26:40.431Z", "modified_at": "2023-07-28T23:00:02.724Z", "id": "", "amount": 890847, "currency": "Seychelles Rupee", "recurring_interval": "year", "status": "active", "current_period_start": "2025-04-05T21:01:12.454Z", "current_period_end": null, "cancel_at_period_end": true, "canceled_at": "2025-05-09T12:42:07.453Z", "started_at": "2025-12-16T12:13:32.171Z", "ends_at": "2025-07-23T18:45:11.258Z", "ended_at": null, "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": null, "customer_cancellation_comment": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-06-01T00:25:19.556Z", "modified_at": null, "metadata": {"key": 8941.51, "key1": 393.1}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-03-15T13:55:38.252Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2024-04-22T11:34:07.174Z", "modified_at": "2024-01-28T05:15:18.595Z", "id": "", "name": "", "description": "solder crossly except yet", "recurring_interval": null, "is_recurring": false, "is_archived": false, "organization_id": "", "metadata": {}, "prices": [{"created_at": "2023-07-28T23:00:02.724Z", "modified_at": "2025-03-22T08:23:39.797Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 753537, "legacy": true}, {"created_at": "2023-10-17T03:10:19.145Z", "modified_at": "2024-12-02T16:50:43.309Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 852903, "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/mail", "mime_type": "", "size": 768823, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-22T03:27:39.662Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-06-30T04:51:26.931Z", "size_readable": "", "public_url": "https://gigantic-spring.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/var/mail", "mime_type": "", "size": 768823, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-22T03:27:39.662Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-06-30T04:51:26.931Z", "size_readable": "", "public_url": "https://gigantic-spring.name/"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-20T15:07:05.822Z", "modified_at": "2025-07-11T03:45:02.430Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 61252, "required": true}]}, "discount": {"duration": "once", "duration_in_months": 342177, "type": "fixed", "amount": 861306, "currency": "CFA Franc BCEAO", "created_at": "2023-04-20T11:08:19.373Z", "modified_at": "2023-06-26T04:56:35.602Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2023-05-19T07:23:10.203Z", "ends_at": null, "max_redemptions": 381050, "redemptions_count": 60295, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [], "meters": []} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -1870,7 +1851,7 @@ examples: application/json: {"product_id": ""} responses: "200": - application/json: {"created_at": "2023-12-04T14:44:14.136Z", "modified_at": "2023-05-01T08:54:32.351Z", "id": "", "amount": 145953, "currency": "Rand", "recurring_interval": "year", "status": "canceled", "current_period_start": "2024-10-27T19:14:25.505Z", "current_period_end": "2025-11-08T09:51:13.337Z", "cancel_at_period_end": false, "canceled_at": "2023-05-16T23:35:19.423Z", "started_at": "2023-11-02T08:09:24.083Z", "ends_at": "2025-04-12T21:04:51.008Z", "ended_at": "2023-12-10T00:14:34.013Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "missing_features", "customer_cancellation_comment": null, "metadata": {"key": 7847.22, "key1": true}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-12-28T05:26:01.320Z", "modified_at": "2023-07-10T03:03:20.499Z", "metadata": {"key": 6844.97}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-09-09T13:23:35.812Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2024-08-15T15:06:53.828Z", "modified_at": "2025-03-30T01:15:57.619Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {"key": "", "key1": 6842.69}, "prices": [{"created_at": "2025-09-04T13:39:15.428Z", "modified_at": "2023-06-09T23:09:57.743Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 607483, "maximum_amount": 951105, "preset_amount": 838393, "legacy": true}], "benefits": [], "medias": [], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2025-08-28T05:31:36.934Z", "modified_at": "2025-01-12T20:56:10.352Z", "id": "", "metadata": {"key": "", "key1": true}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 610180, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2025-08-28T05:31:36.934Z", "modified_at": "2025-01-12T20:56:10.352Z", "id": "", "metadata": {"key": "", "key1": true}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 610180, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2025-08-28T05:31:36.934Z", "modified_at": "2025-01-12T20:56:10.352Z", "id": "", "metadata": {"key": "", "key1": true}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 610180, "required": true}]}, "discount": {"duration": "forever", "duration_in_months": 913858, "type": "percentage", "amount": 925698, "currency": "Pound Sterling", "created_at": "2025-01-31T19:57:33.256Z", "modified_at": "2024-11-08T18:43:15.968Z", "id": "", "metadata": {"key": 2646.89}, "name": "", "code": "", "starts_at": "2025-02-01T12:19:14.944Z", "ends_at": "2023-04-23T06:57:38.844Z", "max_redemptions": 467745, "redemptions_count": 167766, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-11-02T08:09:24.083Z", "modified_at": "2025-04-12T21:04:51.008Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 203413, "legacy": true}, {"created_at": "2024-02-05T08:01:02.549Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year"}, {"created_at": "2023-12-26T01:37:45.354Z", "modified_at": "2023-11-30T02:22:41.602Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 563833, "legacy": true}], "meters": [{"created_at": "2025-04-18T21:57:33.981Z", "modified_at": "2024-10-02T20:14:14.923Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {}, "created_at": "2024-07-09T16:42:12.156Z", "modified_at": "2025-01-04T07:19:55.953Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "and", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-04-18T21:57:33.981Z", "modified_at": "2024-10-02T20:14:14.923Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {}, "created_at": "2024-07-09T16:42:12.156Z", "modified_at": "2025-01-04T07:19:55.953Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "and", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}]} + application/json: {"created_at": "2023-12-04T14:44:14.136Z", "modified_at": "2023-05-01T08:54:32.351Z", "id": "", "amount": 145953, "currency": "Rand", "recurring_interval": "year", "status": "canceled", "current_period_start": "2024-10-27T19:14:25.505Z", "current_period_end": "2025-11-08T09:51:13.337Z", "cancel_at_period_end": false, "canceled_at": "2023-05-16T23:35:19.423Z", "started_at": "2023-11-02T08:09:24.083Z", "ends_at": "2025-04-12T21:04:51.008Z", "ended_at": "2023-12-10T00:14:34.013Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "missing_features", "customer_cancellation_comment": null, "metadata": {"key": 7847.22, "key1": true}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-12-28T05:26:01.320Z", "modified_at": "2023-07-10T03:03:20.499Z", "metadata": {"key": 6844.97}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-09-09T13:23:35.812Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2024-08-15T15:06:53.828Z", "modified_at": "2025-03-30T01:15:57.619Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "metadata": {"key": "", "key1": 6842.69}, "prices": [{"created_at": "2025-09-04T13:39:15.428Z", "modified_at": "2023-06-09T23:09:57.743Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 607483, "maximum_amount": 951105, "preset_amount": 838393, "legacy": true}], "benefits": [], "medias": [], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2025-08-28T05:31:36.934Z", "modified_at": "2025-01-12T20:56:10.352Z", "id": "", "metadata": {"key": "", "key1": true}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 610180, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2025-08-28T05:31:36.934Z", "modified_at": "2025-01-12T20:56:10.352Z", "id": "", "metadata": {"key": "", "key1": true}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 610180, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2025-08-28T05:31:36.934Z", "modified_at": "2025-01-12T20:56:10.352Z", "id": "", "metadata": {"key": "", "key1": true}, "type": "date", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 610180, "required": true}]}, "discount": {"duration": "forever", "duration_in_months": 913858, "type": "percentage", "amount": 925698, "currency": "Pound Sterling", "created_at": "2025-01-31T19:57:33.256Z", "modified_at": "2024-11-08T18:43:15.968Z", "id": "", "metadata": {"key": 2646.89}, "name": "", "code": "", "starts_at": "2025-02-01T12:19:14.944Z", "ends_at": "2023-04-23T06:57:38.844Z", "max_redemptions": 467745, "redemptions_count": 167766, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2023-11-02T08:09:24.083Z", "modified_at": "2025-04-12T21:04:51.008Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 203413, "legacy": true}, {"created_at": "2024-02-05T08:01:02.549Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-12-26T01:37:45.354Z", "modified_at": "2023-11-30T02:22:41.602Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 563833, "legacy": true}], "meters": [{"created_at": "2025-04-18T21:57:33.981Z", "modified_at": "2024-10-02T20:14:14.923Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {}, "created_at": "2024-07-09T16:42:12.156Z", "modified_at": "2025-01-04T07:19:55.953Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "and", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}, {"created_at": "2025-04-18T21:57:33.981Z", "modified_at": "2024-10-02T20:14:14.923Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {}, "created_at": "2024-07-09T16:42:12.156Z", "modified_at": "2025-01-04T07:19:55.953Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "and", "clauses": []}]}, "aggregation": {"func": "avg", "property": ""}, "organization_id": ""}}]} "403": application/json: {"error": "AlreadyCanceledSubscription", "detail": ""} "404": @@ -1884,7 +1865,7 @@ examples: id: "" responses: "200": - application/json: {"created_at": "2023-04-13T16:53:14.377Z", "modified_at": "2023-10-09T16:03:24.107Z", "id": "", "amount": 301434, "currency": "Ethiopian Birr", "recurring_interval": "month", "status": "past_due", "current_period_start": "2024-09-21T11:35:55.569Z", "current_period_end": "2025-03-29T10:01:06.463Z", "cancel_at_period_end": true, "canceled_at": "2025-09-12T16:35:27.128Z", "started_at": "2025-07-19T10:57:44.516Z", "ends_at": "2023-01-14T16:02:07.001Z", "ended_at": "2024-04-09T01:58:52.778Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": "", "metadata": {"key": "", "key1": false}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-02-06T08:24:11.064Z", "modified_at": null, "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-08-01T19:22:16.612Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "product": {"created_at": "2023-04-14T01:49:23.359Z", "modified_at": "2023-02-27T03:18:26.391Z", "id": "", "name": "", "description": "yowza meh ethyl where once exotic", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": 3063.89, "key1": true}, "prices": [{"created_at": "2023-10-09T16:03:24.107Z", "modified_at": "2023-10-18T20:01:51.483Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 574346, "legacy": true}, {"created_at": "2023-03-31T11:27:51.165Z", "modified_at": "2025-09-12T16:35:27.128Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month"}, {"created_at": "2025-09-25T04:14:25.732Z", "modified_at": "2025-11-14T15:31:42.442Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 606069, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-10-30T15:15:07.973Z", "modified_at": "2025-02-25T11:02:14.286Z", "type": "meter_credit", "description": "circa cassava because", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 3478.81, "key1": "", "key2": true}, "properties": {"units": 921282, "rollover": false, "meter_id": ""}}, {"id": "", "created_at": "2023-10-30T15:15:07.973Z", "modified_at": "2025-02-25T11:02:14.286Z", "type": "meter_credit", "description": "circa cassava because", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 3478.81, "key1": "", "key2": true}, "properties": {"units": 921282, "rollover": false, "meter_id": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 105567, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-10-02T19:01:45.651Z", "size_readable": "", "public_url": "https://inconsequential-slide.com"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 105567, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-10-02T19:01:45.651Z", "size_readable": "", "public_url": "https://inconsequential-slide.com"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 105567, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-10-02T19:01:45.651Z", "size_readable": "", "public_url": "https://inconsequential-slide.com"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-04-12T03:15:38.858Z", "modified_at": "2025-07-13T21:55:11.751Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 712744, "required": false}]}, "discount": {"duration": "repeating", "duration_in_months": 153470, "type": "fixed", "basis_points": 284416, "created_at": "2024-03-23T02:00:57.683Z", "modified_at": "2025-01-27T19:18:40.809Z", "id": "", "metadata": {"key": 4126.15, "key1": 3937.48}, "name": "", "code": null, "starts_at": "2025-06-08T16:09:35.643Z", "ends_at": "2024-02-05T12:40:28.600Z", "max_redemptions": 819891, "redemptions_count": 779464, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2025-05-21T20:43:29.354Z", "modified_at": "2023-04-05T19:10:22.088Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-04-14T01:49:23.359Z", "modified_at": "2023-02-27T03:18:26.391Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "minimum_amount": null, "maximum_amount": 75257, "preset_amount": 135909}, {"created_at": "2025-09-15T17:22:16.784Z", "modified_at": "2024-11-04T09:40:35.837Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 803091, "meter_id": "", "meter": {"id": "", "name": ""}}], "meters": [{"created_at": "2023-06-22T22:55:35.524Z", "modified_at": "2023-05-11T08:44:43.261Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": false, "key1": 561011}, "created_at": "2024-02-17T07:16:15.047Z", "modified_at": null, "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2023-06-22T22:55:35.524Z", "modified_at": "2023-05-11T08:44:43.261Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": false, "key1": 561011}, "created_at": "2024-02-17T07:16:15.047Z", "modified_at": null, "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2023-06-22T22:55:35.524Z", "modified_at": "2023-05-11T08:44:43.261Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": false, "key1": 561011}, "created_at": "2024-02-17T07:16:15.047Z", "modified_at": null, "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}]} + application/json: {"created_at": "2023-04-13T16:53:14.377Z", "modified_at": "2023-10-09T16:03:24.107Z", "id": "", "amount": 301434, "currency": "Ethiopian Birr", "recurring_interval": "month", "status": "past_due", "current_period_start": "2024-09-21T11:35:55.569Z", "current_period_end": "2025-03-29T10:01:06.463Z", "cancel_at_period_end": true, "canceled_at": "2025-09-12T16:35:27.128Z", "started_at": "2025-07-19T10:57:44.516Z", "ends_at": "2023-01-14T16:02:07.001Z", "ended_at": "2024-04-09T01:58:52.778Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": "", "metadata": {"key": "", "key1": false}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-02-06T08:24:11.064Z", "modified_at": null, "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-08-01T19:22:16.612Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "product": {"created_at": "2023-04-14T01:49:23.359Z", "modified_at": "2023-02-27T03:18:26.391Z", "id": "", "name": "", "description": "yowza meh ethyl where once exotic", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "metadata": {"key": 3063.89, "key1": true}, "prices": [{"created_at": "2023-10-09T16:03:24.107Z", "modified_at": "2023-10-18T20:01:51.483Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 574346, "legacy": true}, {"created_at": "2023-03-31T11:27:51.165Z", "modified_at": "2025-09-12T16:35:27.128Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2025-09-25T04:14:25.732Z", "modified_at": "2025-11-14T15:31:42.442Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 606069, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-10-30T15:15:07.973Z", "modified_at": "2025-02-25T11:02:14.286Z", "type": "meter_credit", "description": "circa cassava because", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 3478.81, "key1": "", "key2": true}, "properties": {"units": 921282, "rollover": false, "meter_id": ""}}, {"id": "", "created_at": "2023-10-30T15:15:07.973Z", "modified_at": "2025-02-25T11:02:14.286Z", "type": "meter_credit", "description": "circa cassava because", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": 3478.81, "key1": "", "key2": true}, "properties": {"units": 921282, "rollover": false, "meter_id": ""}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 105567, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-10-02T19:01:45.651Z", "size_readable": "", "public_url": "https://inconsequential-slide.com"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 105567, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-10-02T19:01:45.651Z", "size_readable": "", "public_url": "https://inconsequential-slide.com"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 105567, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-10-02T19:01:45.651Z", "size_readable": "", "public_url": "https://inconsequential-slide.com"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-04-12T03:15:38.858Z", "modified_at": "2025-07-13T21:55:11.751Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 712744, "required": false}]}, "discount": {"duration": "repeating", "duration_in_months": 153470, "type": "fixed", "basis_points": 284416, "created_at": "2024-03-23T02:00:57.683Z", "modified_at": "2025-01-27T19:18:40.809Z", "id": "", "metadata": {"key": 4126.15, "key1": 3937.48}, "name": "", "code": null, "starts_at": "2025-06-08T16:09:35.643Z", "ends_at": "2024-02-05T12:40:28.600Z", "max_redemptions": 819891, "redemptions_count": 779464, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "prices": [{"created_at": "2025-05-21T20:43:29.354Z", "modified_at": "2023-04-05T19:10:22.088Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-04-14T01:49:23.359Z", "modified_at": "2023-02-27T03:18:26.391Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": null, "maximum_amount": 75257, "preset_amount": 135909, "legacy": true}, {"created_at": "2025-09-15T17:22:16.784Z", "modified_at": "2024-11-04T09:40:35.837Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 803091, "meter_id": "", "meter": {"id": "", "name": ""}}], "meters": [{"created_at": "2023-06-22T22:55:35.524Z", "modified_at": "2023-05-11T08:44:43.261Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": false, "key1": 561011}, "created_at": "2024-02-17T07:16:15.047Z", "modified_at": null, "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2023-06-22T22:55:35.524Z", "modified_at": "2023-05-11T08:44:43.261Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": false, "key1": 561011}, "created_at": "2024-02-17T07:16:15.047Z", "modified_at": null, "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}, {"created_at": "2023-06-22T22:55:35.524Z", "modified_at": "2023-05-11T08:44:43.261Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"metadata": {"key": false, "key1": 561011}, "created_at": "2024-02-17T07:16:15.047Z", "modified_at": null, "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}]}, "aggregation": {"func": "max", "property": ""}, "organization_id": ""}}]} "403": application/json: {"error": "AlreadyCanceledSubscription", "detail": ""} "404": @@ -2066,7 +2047,7 @@ examples: application/json: {"name": "", "recurring_interval": "year", "prices": [], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"} responses: "201": - application/json: {"created_at": "2025-01-12T01:51:18.973Z", "modified_at": "2025-11-10T04:18:09.355Z", "id": "", "name": "", "description": "well-worn against cash unless offensively chromakey exempt dense cruelly peony", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": ""}, "prices": [{"created_at": "2023-04-20T14:04:54.240Z", "modified_at": "2024-11-07T17:01:01.790Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year"}, {"created_at": "2024-03-29T16:30:59.890Z", "modified_at": "2025-08-23T16:40:00.782Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year"}, {"created_at": "2023-11-12T20:54:36.929Z", "modified_at": null, "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 845799, "maximum_amount": 402294, "preset_amount": 275452, "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 791819, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-03-25T22:23:54.102Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2025-01-18T23:38:34.369Z", "size_readable": "", "public_url": "https://rewarding-defendant.org"}, {"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 791819, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-03-25T22:23:54.102Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2025-01-18T23:38:34.369Z", "size_readable": "", "public_url": "https://rewarding-defendant.org"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-12T11:07:33.436Z", "modified_at": "2024-10-25T01:29:33.276Z", "id": "", "metadata": {}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 29798, "required": false}]} + application/json: {"created_at": "2025-01-12T01:51:18.973Z", "modified_at": "2025-11-10T04:18:09.355Z", "id": "", "name": "", "description": "well-worn against cash unless offensively chromakey exempt dense cruelly peony", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": ""}, "prices": [{"created_at": "2023-04-20T14:04:54.240Z", "modified_at": "2024-11-07T17:01:01.790Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2024-03-29T16:30:59.890Z", "modified_at": "2025-08-23T16:40:00.782Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2023-11-12T20:54:36.929Z", "modified_at": null, "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 845799, "maximum_amount": 402294, "preset_amount": 275452, "legacy": true}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 791819, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-03-25T22:23:54.102Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2025-01-18T23:38:34.369Z", "size_readable": "", "public_url": "https://rewarding-defendant.org"}, {"id": "", "organization_id": "", "name": "", "path": "/srv", "mime_type": "", "size": 791819, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-03-25T22:23:54.102Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2025-01-18T23:38:34.369Z", "size_readable": "", "public_url": "https://rewarding-defendant.org"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-12T11:07:33.436Z", "modified_at": "2024-10-25T01:29:33.276Z", "id": "", "metadata": {}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 29798, "required": false}]} "422": application/json: {} products:get: @@ -2106,7 +2087,7 @@ examples: application/json: {"benefits": ["", "", ""]} responses: "200": - application/json: {"created_at": "2023-09-28T22:38:03.685Z", "modified_at": "2024-01-11T22:10:13.497Z", "id": "", "name": "", "description": "blah bouncy until below spear dash border", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": "", "key1": 244043}, "prices": [{"created_at": "2025-09-11T11:40:02.608Z", "modified_at": "2024-11-03T09:56:56.385Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 223202, "maximum_amount": 66059, "preset_amount": 500347}], "benefits": [{"id": "", "created_at": "2024-09-18T09:49:18.801Z", "modified_at": "2023-06-23T04:47:46.915Z", "type": "github_repository", "description": "vastly meanwhile stage tennis coop", "selectable": false, "deletable": false, "organization_id": "", "metadata": {"key": ""}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "pull"}}, {"id": "", "created_at": "2025-10-26T03:43:57.806Z", "modified_at": "2024-04-17T17:44:58.962Z", "type": "meter_credit", "description": "daughter nor below ack till clone like against", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": true}, "properties": {"units": 113791, "rollover": true, "meter_id": ""}}, {"id": "", "created_at": "2023-06-30T04:50:32.342Z", "modified_at": "2023-01-27T19:24:13.189Z", "type": "license_keys", "description": "redraw whoa palate worldly hm impact lest dependable", "selectable": false, "deletable": true, "organization_id": "", "metadata": {}, "properties": {"prefix": "", "expires": {"ttl": 989033, "timeframe": "year"}, "activations": null, "limit_usage": 839068}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 770976, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T01:46:26.319Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2025-09-22T06:25:51.641Z", "size_readable": "", "public_url": "https://well-groomed-creature.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 770976, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T01:46:26.319Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2025-09-22T06:25:51.641Z", "size_readable": "", "public_url": "https://well-groomed-creature.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 770976, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T01:46:26.319Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2025-09-22T06:25:51.641Z", "size_readable": "", "public_url": "https://well-groomed-creature.biz"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-17T06:02:23.238Z", "modified_at": "2025-03-20T20:03:53.850Z", "id": "", "metadata": {"key": 8435.67, "key1": 1752.52, "key2": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 516294, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-08-17T06:02:23.238Z", "modified_at": "2025-03-20T20:03:53.850Z", "id": "", "metadata": {"key": 8435.67, "key1": 1752.52, "key2": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 516294, "required": false}]} + application/json: {"created_at": "2023-09-28T22:38:03.685Z", "modified_at": "2024-01-11T22:10:13.497Z", "id": "", "name": "", "description": "blah bouncy until below spear dash border", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "metadata": {"key": "", "key1": 244043}, "prices": [{"created_at": "2025-09-11T11:40:02.608Z", "modified_at": "2024-11-03T09:56:56.385Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 223202, "maximum_amount": 66059, "preset_amount": 500347, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-09-18T09:49:18.801Z", "modified_at": "2023-06-23T04:47:46.915Z", "type": "github_repository", "description": "vastly meanwhile stage tennis coop", "selectable": false, "deletable": false, "organization_id": "", "metadata": {"key": ""}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo", "permission": "pull"}}, {"id": "", "created_at": "2025-10-26T03:43:57.806Z", "modified_at": "2024-04-17T17:44:58.962Z", "type": "meter_credit", "description": "daughter nor below ack till clone like against", "selectable": true, "deletable": false, "organization_id": "", "metadata": {"key": true}, "properties": {"units": 113791, "rollover": true, "meter_id": ""}}, {"id": "", "created_at": "2023-06-30T04:50:32.342Z", "modified_at": "2023-01-27T19:24:13.189Z", "type": "license_keys", "description": "redraw whoa palate worldly hm impact lest dependable", "selectable": false, "deletable": true, "organization_id": "", "metadata": {}, "properties": {"prefix": "", "expires": {"ttl": 989033, "timeframe": "year"}, "activations": null, "limit_usage": 839068}}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 770976, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T01:46:26.319Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2025-09-22T06:25:51.641Z", "size_readable": "", "public_url": "https://well-groomed-creature.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 770976, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T01:46:26.319Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2025-09-22T06:25:51.641Z", "size_readable": "", "public_url": "https://well-groomed-creature.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 770976, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2023-11-20T01:46:26.319Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2025-09-22T06:25:51.641Z", "size_readable": "", "public_url": "https://well-groomed-creature.biz"}], "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-08-17T06:02:23.238Z", "modified_at": "2025-03-20T20:03:53.850Z", "id": "", "metadata": {"key": 8435.67, "key1": 1752.52, "key2": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 516294, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-08-17T06:02:23.238Z", "modified_at": "2025-03-20T20:03:53.850Z", "id": "", "metadata": {"key": 8435.67, "key1": 1752.52, "key2": false}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 516294, "required": false}]} "403": application/json: {"error": "NotPermitted", "detail": ""} "404": @@ -2132,7 +2113,7 @@ examples: id: "" responses: "200": - application/json: {"id": "", "created_at": "2023-12-28T18:05:05.494Z", "modified_at": "2025-08-19T01:46:15.037Z", "status": "paid", "paid": true, "subtotal_amount": 194509, "discount_amount": 199674, "net_amount": 462739, "amount": 815495, "tax_amount": 174590, "total_amount": 271911, "refunded_amount": 378922, "refunded_tax_amount": 960251, "currency": "Naira", "billing_reason": "subscription_update", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": ""}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-07-30T11:43:08.034Z", "modified_at": "2025-11-17T01:23:41.514Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-03-07T16:00:18.030Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "user_id": "", "product": {"metadata": {"key": 709557, "key1": true, "key2": 1589.86}, "created_at": "2024-06-13T05:22:39.981Z", "modified_at": "2025-08-06T17:05:37.045Z", "id": "", "name": "", "description": "tarry subexpression brr huzzah officially", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": ""}, "discount": {"duration": "once", "type": "percentage", "basis_points": 815092, "created_at": "2025-09-19T21:21:56.106Z", "modified_at": "2024-05-14T12:13:50.338Z", "id": "", "metadata": {"key": false}, "name": "", "code": null, "starts_at": "2025-01-27T04:15:28.556Z", "ends_at": "2023-02-03T06:50:58.764Z", "max_redemptions": 31256, "redemptions_count": 737846, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": null, "items": []} + application/json: {"id": "", "created_at": "2023-12-28T18:05:05.494Z", "modified_at": "2025-08-19T01:46:15.037Z", "status": "paid", "paid": true, "subtotal_amount": 194509, "discount_amount": 199674, "net_amount": 462739, "amount": 815495, "tax_amount": 174590, "total_amount": 271911, "refunded_amount": 378922, "refunded_tax_amount": 960251, "currency": "Naira", "billing_reason": "subscription_update", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {"key": ""}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-07-30T11:43:08.034Z", "modified_at": "2025-11-17T01:23:41.514Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-03-07T16:00:18.030Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "user_id": "", "product": {"metadata": {"key": 709557, "key1": true, "key2": 1589.86}, "created_at": "2024-06-13T05:22:39.981Z", "modified_at": "2025-08-06T17:05:37.045Z", "id": "", "name": "", "description": "tarry subexpression brr huzzah officially", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": ""}, "discount": {"duration": "once", "type": "percentage", "basis_points": 815092, "created_at": "2025-09-19T21:21:56.106Z", "modified_at": "2024-05-14T12:13:50.338Z", "id": "", "metadata": {"key": false}, "name": "", "code": null, "starts_at": "2025-01-27T04:15:28.556Z", "ends_at": "2023-02-03T06:50:58.764Z", "max_redemptions": 31256, "redemptions_count": 737846, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": null, "items": []} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2183,7 +2164,7 @@ examples: limit: 10 responses: "200": - application/json: {"items": [{"created_at": "2023-07-14T12:00:22.546Z", "modified_at": "2025-12-02T21:32:42.156Z", "id": "", "payment_processor": "stripe", "status": "succeeded", "client_secret": "", "url": "https://punctual-guacamole.org", "expires_at": "2023-08-19T15:22:33.462Z", "success_url": "https://biodegradable-coal.com", "embed_origin": "", "amount": 780504, "discount_amount": 766358, "net_amount": 630886, "tax_amount": 936353, "total_amount": 994328, "currency": "Algerian Dinar", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": false, "is_discount_applicable": true, "is_free_product_price": false, "is_payment_required": true, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": ""}, "customer_billing_address_fields": {"country": true, "state": false, "city": false, "postal_code": true, "line1": false, "line2": false}, "metadata": {"key": 507672, "key1": 563944}, "external_customer_id": "", "customer_external_id": "", "products": [{"created_at": "2023-11-04T01:52:59.639Z", "modified_at": null, "id": "", "name": "", "description": "dally bungalow congregate howl", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}]}, {"created_at": "2023-11-04T01:52:59.639Z", "modified_at": null, "id": "", "name": "", "description": "dally bungalow congregate howl", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}]}], "product": {"created_at": "2025-10-08T08:06:47.691Z", "modified_at": "2023-01-13T21:51:28.028Z", "id": "", "name": "", "description": "wildly edge except so calculus square", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-07-14T12:00:22.546Z", "modified_at": "2025-12-02T21:32:42.156Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 645390, "legacy": true}, {"created_at": "2023-08-19T15:22:33.462Z", "modified_at": "2023-03-15T09:19:49.081Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2025-04-19T22:15:44.328Z", "modified_at": "2024-07-26T10:32:13.861Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "unit_amount": "", "cap_amount": 762494, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [{"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}]}, "product_price": {"created_at": "2023-04-08T17:49:25.686Z", "modified_at": "2023-10-28T07:54:05.646Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, "discount": null, "subscription_id": "", "attached_custom_fields": [], "customer_metadata": {"key": 163571, "key1": 954376}}], "pagination": {"total_count": 608889, "max_page": 572838}} + application/json: {"items": [{"created_at": "2023-07-14T12:00:22.546Z", "modified_at": "2025-12-02T21:32:42.156Z", "id": "", "payment_processor": "stripe", "status": "succeeded", "client_secret": "", "url": "https://punctual-guacamole.org", "expires_at": "2023-08-19T15:22:33.462Z", "success_url": "https://biodegradable-coal.com", "embed_origin": "", "amount": 780504, "discount_amount": 766358, "net_amount": 630886, "tax_amount": 936353, "total_amount": 994328, "currency": "Algerian Dinar", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": false, "is_discount_applicable": true, "is_free_product_price": false, "is_payment_required": true, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": ""}, "billing_address_fields": {"country": "required", "state": "optional", "city": "required", "postal_code": "required", "line1": "disabled", "line2": "optional"}, "metadata": {"key": 507672, "key1": 563944}, "external_customer_id": "", "customer_external_id": "", "products": [{"created_at": "2023-11-04T01:52:59.639Z", "modified_at": null, "id": "", "name": "", "description": "dally bungalow congregate howl", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}]}, {"created_at": "2023-11-04T01:52:59.639Z", "modified_at": null, "id": "", "name": "", "description": "dally bungalow congregate howl", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}, {"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}]}], "product": {"created_at": "2025-10-08T08:06:47.691Z", "modified_at": "2023-01-13T21:51:28.028Z", "id": "", "name": "", "description": "wildly edge except so calculus square", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-07-14T12:00:22.546Z", "modified_at": "2025-12-02T21:32:42.156Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 645390, "legacy": true}, {"created_at": "2023-08-19T15:22:33.462Z", "modified_at": "2023-03-15T09:19:49.081Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2025-04-19T22:15:44.328Z", "modified_at": "2024-07-26T10:32:13.861Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "unit_amount": "", "cap_amount": 762494, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [{"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-12-18T03:04:16.879Z", "modified_at": "2025-12-13T18:59:55.618Z", "type": "custom", "description": "tennis badly hoick", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/etc/periodic", "mime_type": "", "size": 790983, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-01-28T15:09:33.411Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2023-03-27T20:48:20.123Z", "size_readable": "", "public_url": "https://skeletal-solvency.com"}]}, "product_price": {"created_at": "2023-04-08T17:49:25.686Z", "modified_at": "2023-10-28T07:54:05.646Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, "discount": null, "subscription_id": "", "attached_custom_fields": [], "customer_metadata": {"key": 163571, "key1": 954376}}], "pagination": {"total_count": 608889, "max_page": 572838}} "422": application/json: {} checkouts:create: @@ -2192,7 +2173,7 @@ examples: application/json: {"allow_discount_codes": true, "require_billing_address": false, "is_business_customer": false, "customer_billing_address": {"country": "US"}, "products": ["", "", ""]} responses: "201": - application/json: {"created_at": "2024-01-03T23:26:44.843Z", "modified_at": "2023-01-06T02:40:29.447Z", "id": "", "payment_processor": "stripe", "status": "failed", "client_secret": "", "url": "https://willing-outset.info/", "expires_at": "2025-05-04T00:57:38.223Z", "success_url": "https://wonderful-adrenalin.info", "embed_origin": "", "amount": 267381, "discount_amount": 51493, "net_amount": 549002, "tax_amount": 457933, "total_amount": 901758, "currency": "Singapore Dollar", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": true, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": false, "is_payment_setup_required": false, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": "", "key2": ""}, "customer_billing_address_fields": {"country": false, "state": true, "city": true, "postal_code": false, "line1": false, "line2": false}, "metadata": {"key": true, "key1": 633599}, "external_customer_id": "", "customer_external_id": "", "products": [{"created_at": "2024-02-11T14:47:29.817Z", "modified_at": "2023-12-03T20:20:32.728Z", "id": "", "name": "", "description": "mousse psst pulp because connect deer coordination drum behind yieldingly", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-01-03T23:26:44.843Z", "modified_at": "2023-01-06T02:40:29.447Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 779234, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/tmp", "mime_type": "", "size": 957931, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-05-06T15:29:56.878Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2024-04-02T19:44:45.852Z", "size_readable": "", "public_url": "https://nervous-jet.com/"}]}], "product": {"created_at": "2025-06-14T10:40:20.746Z", "modified_at": "2025-01-27T16:41:51.128Z", "id": "", "name": "", "description": "over competent powerfully", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2023-01-14T08:53:43.010Z", "modified_at": "2024-05-10T16:28:30.439Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 901758, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [], "medias": []}, "product_price": {"created_at": "2025-09-22T20:28:56.011Z", "modified_at": "2024-03-21T04:09:10.889Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 821398}, "discount": {"duration": "forever", "duration_in_months": 602692, "type": "percentage", "amount": 989340, "currency": "Norwegian Krone", "id": "", "name": "", "code": null}, "subscription_id": "", "attached_custom_fields": [], "customer_metadata": {"key": true, "key1": 753950, "key2": ""}} + application/json: {"created_at": "2024-01-03T23:26:44.843Z", "modified_at": "2023-01-06T02:40:29.447Z", "id": "", "payment_processor": "stripe", "status": "failed", "client_secret": "", "url": "https://willing-outset.info/", "expires_at": "2025-05-04T00:57:38.223Z", "success_url": "https://wonderful-adrenalin.info", "embed_origin": "", "amount": 267381, "discount_amount": 51493, "net_amount": 549002, "tax_amount": 457933, "total_amount": 901758, "currency": "Singapore Dollar", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": true, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": false, "is_payment_setup_required": false, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": "", "key2": ""}, "billing_address_fields": {"country": "disabled", "state": "disabled", "city": "optional", "postal_code": "required", "line1": "required", "line2": "disabled"}, "metadata": {"key": true, "key1": 633599}, "external_customer_id": "", "customer_external_id": "", "products": [{"created_at": "2024-02-11T14:47:29.817Z", "modified_at": "2023-12-03T20:20:32.728Z", "id": "", "name": "", "description": "mousse psst pulp because connect deer coordination drum behind yieldingly", "recurring_interval": "month", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-01-03T23:26:44.843Z", "modified_at": "2023-01-06T02:40:29.447Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 779234, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/tmp", "mime_type": "", "size": 957931, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-05-06T15:29:56.878Z", "version": null, "service": "product_media", "is_uploaded": true, "created_at": "2024-04-02T19:44:45.852Z", "size_readable": "", "public_url": "https://nervous-jet.com/"}]}], "product": {"created_at": "2025-06-14T10:40:20.746Z", "modified_at": "2025-01-27T16:41:51.128Z", "id": "", "name": "", "description": "over competent powerfully", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2023-01-14T08:53:43.010Z", "modified_at": "2024-05-10T16:28:30.439Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 901758, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [], "medias": []}, "product_price": {"created_at": "2025-09-22T20:28:56.011Z", "modified_at": "2024-03-21T04:09:10.889Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 821398, "legacy": true}, "discount": {"duration": "forever", "duration_in_months": 602692, "type": "percentage", "amount": 989340, "currency": "Norwegian Krone", "id": "", "name": "", "code": null}, "subscription_id": "", "attached_custom_fields": [], "customer_metadata": {"key": true, "key1": 753950, "key2": ""}} "422": application/json: {} checkouts:get: @@ -2202,7 +2183,7 @@ examples: id: "" responses: "200": - application/json: {"created_at": "2024-08-11T03:11:01.239Z", "modified_at": "2025-11-29T01:58:06.554Z", "id": "", "payment_processor": "stripe", "status": "succeeded", "client_secret": "", "url": "https://dirty-maestro.info", "expires_at": "2023-10-11T06:44:37.699Z", "success_url": "https://low-hope.name", "embed_origin": "", "amount": 604568, "discount_amount": 435126, "net_amount": 202456, "tax_amount": 729244, "total_amount": 885841, "currency": "Tugrik", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": true, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": false, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": ""}, "customer_billing_address_fields": {"country": false, "state": true, "city": false, "postal_code": true, "line1": true, "line2": false}, "metadata": {"key": "", "key1": 1174.35}, "external_customer_id": "", "customer_external_id": "", "products": [{"created_at": "2023-08-31T20:57:39.863Z", "modified_at": "2023-04-27T14:53:08.193Z", "id": "", "name": "", "description": "inveigle fooey frankly", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}, {"created_at": "2023-08-31T20:57:39.863Z", "modified_at": "2023-04-27T14:53:08.193Z", "id": "", "name": "", "description": "inveigle fooey frankly", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}, {"created_at": "2023-08-31T20:57:39.863Z", "modified_at": "2023-04-27T14:53:08.193Z", "id": "", "name": "", "description": "inveigle fooey frankly", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}], "product": {"created_at": "2024-04-29T21:31:34.931Z", "modified_at": null, "id": "", "name": "", "description": "silk plus an cavernous vamoose", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-29T01:58:06.554Z", "modified_at": "2025-02-24T18:28:07.898Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 486695, "maximum_amount": 601699, "preset_amount": 604568}, {"created_at": "2023-07-15T23:44:52.247Z", "modified_at": "2025-08-28T21:08:23.306Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 472045, "maximum_amount": 16708, "preset_amount": 342156, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}, "product_price": {"created_at": "2024-10-12T23:10:10.275Z", "modified_at": "2023-10-18T15:18:04.262Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, "discount": {"duration": "repeating", "duration_in_months": 245057, "type": "percentage", "amount": 879202, "currency": "Sudanese Pound", "id": "", "name": "", "code": ""}, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-09-07T23:03:34.581Z", "modified_at": "2025-12-24T16:06:04.760Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 200397, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-09-07T23:03:34.581Z", "modified_at": "2025-12-24T16:06:04.760Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 200397, "required": true}], "customer_metadata": {"key": 154385}} + application/json: {"created_at": "2024-08-11T03:11:01.239Z", "modified_at": "2025-11-29T01:58:06.554Z", "id": "", "payment_processor": "stripe", "status": "succeeded", "client_secret": "", "url": "https://dirty-maestro.info", "expires_at": "2023-10-11T06:44:37.699Z", "success_url": "https://low-hope.name", "embed_origin": "", "amount": 604568, "discount_amount": 435126, "net_amount": 202456, "tax_amount": 729244, "total_amount": 885841, "currency": "Tugrik", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": true, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": false, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": ""}, "billing_address_fields": {"country": "optional", "state": "required", "city": "disabled", "postal_code": "disabled", "line1": "disabled", "line2": "required"}, "metadata": {"key": "", "key1": 1174.35}, "external_customer_id": "", "customer_external_id": "", "products": [{"created_at": "2023-08-31T20:57:39.863Z", "modified_at": "2023-04-27T14:53:08.193Z", "id": "", "name": "", "description": "inveigle fooey frankly", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}, {"created_at": "2023-08-31T20:57:39.863Z", "modified_at": "2023-04-27T14:53:08.193Z", "id": "", "name": "", "description": "inveigle fooey frankly", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}, {"created_at": "2023-08-31T20:57:39.863Z", "modified_at": "2023-04-27T14:53:08.193Z", "id": "", "name": "", "description": "inveigle fooey frankly", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}], "product": {"created_at": "2024-04-29T21:31:34.931Z", "modified_at": null, "id": "", "name": "", "description": "silk plus an cavernous vamoose", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-29T01:58:06.554Z", "modified_at": "2025-02-24T18:28:07.898Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 486695, "maximum_amount": 601699, "preset_amount": 604568, "legacy": true}, {"created_at": "2023-07-15T23:44:52.247Z", "modified_at": "2025-08-28T21:08:23.306Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 472045, "maximum_amount": 16708, "preset_amount": 342156, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-11-01T21:53:06.694Z", "modified_at": "2023-01-04T18:26:29.729Z", "type": "meter_credit", "description": "gosh ashamed viciously swat", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 8837, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-11-12T05:04:28.264Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-01-31T09:04:35.400Z", "size_readable": "", "public_url": "https://woeful-alb.com"}]}, "product_price": {"created_at": "2024-10-12T23:10:10.275Z", "modified_at": "2023-10-18T15:18:04.262Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, "discount": {"duration": "repeating", "duration_in_months": 245057, "type": "percentage", "amount": 879202, "currency": "Sudanese Pound", "id": "", "name": "", "code": ""}, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-09-07T23:03:34.581Z", "modified_at": "2025-12-24T16:06:04.760Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 200397, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-09-07T23:03:34.581Z", "modified_at": "2025-12-24T16:06:04.760Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 200397, "required": true}], "customer_metadata": {"key": 154385}} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2216,7 +2197,7 @@ examples: application/json: {"customer_billing_address": {"country": "US"}} responses: "200": - application/json: {"created_at": "2025-08-11T13:37:19.351Z", "modified_at": "2025-01-17T16:36:47.350Z", "id": "", "payment_processor": "stripe", "status": "expired", "client_secret": "", "url": "https://quiet-longboat.name/", "expires_at": "2024-06-26T17:48:32.882Z", "success_url": "https://flawless-conversation.com/", "embed_origin": "", "amount": 854455, "discount_amount": 294901, "net_amount": 889166, "tax_amount": 922052, "total_amount": 719988, "currency": "Rufiyaa", "product_id": "", "product_price_id": "", "discount_id": null, "allow_discount_codes": false, "require_billing_address": true, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": false, "is_payment_form_required": false, "customer_id": "", "is_business_customer": true, "customer_name": null, "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": "", "key2": ""}, "customer_billing_address_fields": {"country": false, "state": false, "city": false, "postal_code": true, "line1": false, "line2": true}, "metadata": {"key": 175107, "key1": "", "key2": 598875}, "external_customer_id": "", "customer_external_id": null, "products": [{"created_at": "2024-10-08T05:33:56.764Z", "modified_at": "2023-07-14T21:58:46.090Z", "id": "", "name": "", "description": "where underneath ignorant smoke pearl interesting meh amid", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-30T19:59:27.996Z", "modified_at": "2023-09-30T23:37:22.091Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2024-06-26T17:48:32.882Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "month"}], "benefits": [{"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}]}, {"created_at": "2024-10-08T05:33:56.764Z", "modified_at": "2023-07-14T21:58:46.090Z", "id": "", "name": "", "description": "where underneath ignorant smoke pearl interesting meh amid", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-09-01T12:37:02.777Z", "modified_at": "2025-10-07T13:38:06.522Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": null, "price_currency": "", "price_amount": 615287}, {"created_at": "2024-02-21T06:51:40.935Z", "modified_at": null, "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 391538, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}]}], "product": {"created_at": "2023-09-02T08:09:15.374Z", "modified_at": "2023-01-08T13:18:17.680Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}]}, "product_price": {"created_at": "2023-01-14T05:49:25.708Z", "modified_at": "2025-02-16T09:13:19.316Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": null, "maximum_amount": 161721, "preset_amount": 796115, "legacy": true}, "discount": null, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-09-18T08:05:49.385Z", "modified_at": "2023-01-31T14:16:46.453Z", "id": "", "metadata": {"key": 376311, "key1": "", "key2": 112991}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 115053, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-09-18T08:05:49.385Z", "modified_at": "2023-01-31T14:16:46.453Z", "id": "", "metadata": {"key": 376311, "key1": "", "key2": 112991}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 115053, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-09-18T08:05:49.385Z", "modified_at": "2023-01-31T14:16:46.453Z", "id": "", "metadata": {"key": 376311, "key1": "", "key2": 112991}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 115053, "required": true}], "customer_metadata": {}} + application/json: {"created_at": "2025-08-11T13:37:19.351Z", "modified_at": "2025-01-17T16:36:47.350Z", "id": "", "payment_processor": "stripe", "status": "expired", "client_secret": "", "url": "https://quiet-longboat.name/", "expires_at": "2024-06-26T17:48:32.882Z", "success_url": "https://flawless-conversation.com/", "embed_origin": "", "amount": 854455, "discount_amount": 294901, "net_amount": 889166, "tax_amount": 922052, "total_amount": 719988, "currency": "Rufiyaa", "product_id": "", "product_price_id": "", "discount_id": null, "allow_discount_codes": false, "require_billing_address": true, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": false, "is_payment_form_required": false, "customer_id": "", "is_business_customer": true, "customer_name": null, "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": "", "key2": ""}, "billing_address_fields": {"country": "required", "state": "disabled", "city": "disabled", "postal_code": "disabled", "line1": "required", "line2": "required"}, "metadata": {"key": 175107, "key1": "", "key2": 598875}, "external_customer_id": "", "customer_external_id": null, "products": [{"created_at": "2024-10-08T05:33:56.764Z", "modified_at": "2023-07-14T21:58:46.090Z", "id": "", "name": "", "description": "where underneath ignorant smoke pearl interesting meh amid", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-30T19:59:27.996Z", "modified_at": "2023-09-30T23:37:22.091Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2024-06-26T17:48:32.882Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [{"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}]}, {"created_at": "2024-10-08T05:33:56.764Z", "modified_at": "2023-07-14T21:58:46.090Z", "id": "", "name": "", "description": "where underneath ignorant smoke pearl interesting meh amid", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-09-01T12:37:02.777Z", "modified_at": "2025-10-07T13:38:06.522Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 615287, "legacy": true}, {"created_at": "2024-02-21T06:51:40.935Z", "modified_at": null, "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 391538, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}]}], "product": {"created_at": "2023-09-02T08:09:15.374Z", "modified_at": "2023-01-08T13:18:17.680Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2024-08-22T08:39:31.775Z", "modified_at": "2024-02-01T17:03:37.242Z", "type": "discord", "description": "overconfidently overplay down unless dilate before optimistically while curly by", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}, {"id": "", "organization_id": "", "name": "", "path": "/Applications", "mime_type": "", "size": 72601, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-08-08T03:26:06.485Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-12T01:25:31.801Z", "size_readable": "", "public_url": "https://inexperienced-valuable.name/"}]}, "product_price": {"created_at": "2023-01-14T05:49:25.708Z", "modified_at": "2025-02-16T09:13:19.316Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": null, "maximum_amount": 161721, "preset_amount": 796115, "legacy": true}, "discount": null, "subscription_id": "", "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-09-18T08:05:49.385Z", "modified_at": "2023-01-31T14:16:46.453Z", "id": "", "metadata": {"key": 376311, "key1": "", "key2": 112991}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 115053, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-09-18T08:05:49.385Z", "modified_at": "2023-01-31T14:16:46.453Z", "id": "", "metadata": {"key": 376311, "key1": "", "key2": 112991}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 115053, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-09-18T08:05:49.385Z", "modified_at": "2023-01-31T14:16:46.453Z", "id": "", "metadata": {"key": 376311, "key1": "", "key2": 112991}, "type": "text", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 115053, "required": true}], "customer_metadata": {}} "403": application/json: {"error": "AlreadyActiveSubscriptionError", "detail": ""} "404": @@ -2230,7 +2211,7 @@ examples: client_secret: "" responses: "200": - application/json: {"created_at": "2025-06-24T05:51:11.116Z", "modified_at": "2025-07-21T02:35:25.261Z", "id": "", "payment_processor": "stripe", "status": "confirmed", "client_secret": "", "url": "https://simplistic-nudge.net", "expires_at": "2024-08-27T15:59:15.813Z", "success_url": "https://damp-ostrich.net", "embed_origin": "", "amount": 129651, "discount_amount": 979690, "net_amount": 68566, "tax_amount": 755934, "total_amount": 778145, "currency": "CFA Franc BCEAO", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": false, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": false, "is_payment_setup_required": false, "is_payment_form_required": false, "customer_id": "", "is_business_customer": false, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": ""}, "customer_billing_address_fields": {"country": true, "state": true, "city": true, "postal_code": false, "line1": false, "line2": true}, "products": [{"created_at": "2025-11-10T10:55:29.910Z", "modified_at": "2025-02-27T16:08:01.240Z", "id": "", "name": "", "description": "gut yahoo mechanic advancement pace", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-03-27T23:50:15.369Z", "modified_at": "2025-11-11T17:18:47.743Z", "type": "github_repository", "description": "whenever valiantly potentially till", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}]}, {"created_at": "2025-11-10T10:55:29.910Z", "modified_at": "2025-02-27T16:08:01.240Z", "id": "", "name": "", "description": "gut yahoo mechanic advancement pace", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-03-27T23:50:15.369Z", "modified_at": "2025-11-11T17:18:47.743Z", "type": "github_repository", "description": "whenever valiantly potentially till", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}]}], "product": {"created_at": "2025-06-13T01:03:58.697Z", "modified_at": "2023-05-03T05:36:23.041Z", "id": "", "name": "", "description": "blah toward against unhappy hot however", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-07-21T02:35:25.261Z", "modified_at": "2025-05-19T02:18:24.778Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 162606, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2023-07-10T15:56:39.492Z", "modified_at": "2025-12-09T17:45:18.853Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year"}, {"created_at": "2025-03-12T04:59:11.184Z", "modified_at": "2025-06-11T08:05:03.606Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 433632}], "benefits": [{"id": "", "created_at": "2023-03-27T23:50:15.369Z", "modified_at": "2025-11-11T17:18:47.743Z", "type": "github_repository", "description": "whenever valiantly potentially till", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}]}, "product_price": {"created_at": "2025-07-18T07:26:11.815Z", "modified_at": "2025-01-30T09:33:04.611Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 248263, "maximum_amount": null, "preset_amount": 56307}, "discount": {"duration": "once", "type": "percentage", "basis_points": 207850, "id": "", "name": "", "code": ""}, "organization": {"created_at": "2023-11-25T05:44:46.275Z", "modified_at": "2023-04-04T00:17:57.339Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://colorful-packaging.biz", "email": null, "website": "", "socials": [{"platform": "linkedin", "url": "https://enchanted-tomatillo.name"}, {"platform": "linkedin", "url": "https://enchanted-tomatillo.name"}, {"platform": "linkedin", "url": "https://enchanted-tomatillo.name"}], "details_submitted_at": "2025-06-30T05:17:18.282Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}}, "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-07-25T14:36:16.639Z", "modified_at": "2025-08-30T21:44:31.855Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 817087, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-07-25T14:36:16.639Z", "modified_at": "2025-08-30T21:44:31.855Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 817087, "required": true}]} + application/json: {"created_at": "2025-06-24T05:51:11.116Z", "modified_at": "2025-07-21T02:35:25.261Z", "id": "", "payment_processor": "stripe", "status": "confirmed", "client_secret": "", "url": "https://simplistic-nudge.net", "expires_at": "2024-08-27T15:59:15.813Z", "success_url": "https://damp-ostrich.net", "embed_origin": "", "amount": 129651, "discount_amount": 979690, "net_amount": 68566, "tax_amount": 755934, "total_amount": 778145, "currency": "CFA Franc BCEAO", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": false, "require_billing_address": false, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": false, "is_payment_setup_required": false, "is_payment_form_required": false, "customer_id": "", "is_business_customer": false, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": "", "key1": ""}, "billing_address_fields": {"country": "disabled", "state": "disabled", "city": "disabled", "postal_code": "optional", "line1": "disabled", "line2": "disabled"}, "products": [{"created_at": "2025-11-10T10:55:29.910Z", "modified_at": "2025-02-27T16:08:01.240Z", "id": "", "name": "", "description": "gut yahoo mechanic advancement pace", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-03-27T23:50:15.369Z", "modified_at": "2025-11-11T17:18:47.743Z", "type": "github_repository", "description": "whenever valiantly potentially till", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}]}, {"created_at": "2025-11-10T10:55:29.910Z", "modified_at": "2025-02-27T16:08:01.240Z", "id": "", "name": "", "description": "gut yahoo mechanic advancement pace", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-03-27T23:50:15.369Z", "modified_at": "2025-11-11T17:18:47.743Z", "type": "github_repository", "description": "whenever valiantly potentially till", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}]}], "product": {"created_at": "2025-06-13T01:03:58.697Z", "modified_at": "2023-05-03T05:36:23.041Z", "id": "", "name": "", "description": "blah toward against unhappy hot however", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-07-21T02:35:25.261Z", "modified_at": "2025-05-19T02:18:24.778Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 162606, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2023-07-10T15:56:39.492Z", "modified_at": "2025-12-09T17:45:18.853Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-03-12T04:59:11.184Z", "modified_at": "2025-06-11T08:05:03.606Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 433632, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-03-27T23:50:15.369Z", "modified_at": "2025-11-11T17:18:47.743Z", "type": "github_repository", "description": "whenever valiantly potentially till", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/share", "mime_type": "", "size": 53813, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-04-09T23:56:37.016Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-12-28T20:57:02.041Z", "size_readable": "", "public_url": "https://timely-ice-cream.info"}]}, "product_price": {"created_at": "2025-07-18T07:26:11.815Z", "modified_at": "2025-01-30T09:33:04.611Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 248263, "maximum_amount": null, "preset_amount": 56307, "legacy": true}, "discount": {"duration": "once", "type": "percentage", "basis_points": 207850, "id": "", "name": "", "code": ""}, "organization": {"created_at": "2023-11-25T05:44:46.275Z", "modified_at": "2023-04-04T00:17:57.339Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://colorful-packaging.biz", "email": null, "website": "", "socials": [{"platform": "linkedin", "url": "https://enchanted-tomatillo.name"}, {"platform": "linkedin", "url": "https://enchanted-tomatillo.name"}, {"platform": "linkedin", "url": "https://enchanted-tomatillo.name"}], "details_submitted_at": "2025-06-30T05:17:18.282Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}, "notification_settings": {"new_order": false, "new_subscription": false}}, "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-07-25T14:36:16.639Z", "modified_at": "2025-08-30T21:44:31.855Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 817087, "required": true}, {"custom_field_id": "", "custom_field": {"created_at": "2023-07-25T14:36:16.639Z", "modified_at": "2025-08-30T21:44:31.855Z", "id": "", "metadata": {}, "type": "checkbox", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 817087, "required": true}]} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "410": @@ -2246,7 +2227,7 @@ examples: application/json: {"customer_billing_address": null} responses: "200": - application/json: {"created_at": "2024-07-23T03:29:25.334Z", "modified_at": "2023-09-18T08:32:05.837Z", "id": "", "payment_processor": "stripe", "status": "expired", "client_secret": "", "url": "https://oddball-final.com", "expires_at": "2024-03-02T01:02:20.912Z", "success_url": "https://illiterate-ownership.com/", "embed_origin": "", "amount": 566134, "discount_amount": 108102, "net_amount": 304494, "tax_amount": 824826, "total_amount": 528924, "currency": "Comoro Franc", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": true, "require_billing_address": true, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": false, "is_payment_form_required": false, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": ""}, "customer_billing_address_fields": {"country": false, "state": true, "city": true, "postal_code": false, "line1": true, "line2": true}, "products": [{"created_at": "2025-08-18T21:55:12.162Z", "modified_at": "2024-12-17T22:23:13.690Z", "id": "", "name": "", "description": "instead divert indeed oh phrase fisherman bowling but upon airmail", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2023-07-30T20:21:38.608Z", "modified_at": "2023-10-31T15:08:35.342Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 330194, "legacy": true}, {"created_at": "2023-08-03T11:06:01.091Z", "modified_at": "2024-11-28T20:27:45.245Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 566134, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-04-25T20:23:37.760Z", "modified_at": "2023-11-02T06:39:34.543Z", "type": "custom", "description": "rebuke sun intensely", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 291762, "storage_version": null, "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-23T19:57:40.076Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-20T03:17:22.448Z", "size_readable": "", "public_url": "https://valuable-declaration.info"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 291762, "storage_version": null, "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-23T19:57:40.076Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-20T03:17:22.448Z", "size_readable": "", "public_url": "https://valuable-declaration.info"}]}], "product": {"created_at": "2024-01-05T10:50:28.777Z", "modified_at": "2024-04-21T11:49:06.390Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-16T12:17:31.920Z", "modified_at": "2024-08-02T16:48:24.620Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 67913, "maximum_amount": 437805, "preset_amount": 546487, "legacy": true}, {"created_at": "2024-02-08T00:22:42.494Z", "modified_at": "2025-10-13T00:42:35.938Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 317412, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [{"id": "", "created_at": "2023-04-25T20:23:37.760Z", "modified_at": "2023-11-02T06:39:34.543Z", "type": "custom", "description": "rebuke sun intensely", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2023-04-25T20:23:37.760Z", "modified_at": "2023-11-02T06:39:34.543Z", "type": "custom", "description": "rebuke sun intensely", "selectable": false, "deletable": false, "organization_id": ""}], "medias": []}, "product_price": {"created_at": "2025-09-16T02:10:33.833Z", "modified_at": "2024-11-12T15:58:56.119Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 400701}, "discount": {"duration": "repeating", "type": "percentage", "basis_points": 639439, "id": "", "name": "", "code": null}, "organization": {"created_at": "2023-09-07T11:25:07.070Z", "modified_at": "2023-05-12T10:01:16.059Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://mixed-netsuke.com/", "email": "Noble29@gmail.com", "website": "", "socials": [{"platform": "github", "url": "https://blue-baritone.biz/"}], "details_submitted_at": null, "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}}, "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-03-31T08:25:33.432Z", "modified_at": "2025-12-17T08:24:12.865Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 439492, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2023-03-31T08:25:33.432Z", "modified_at": "2025-12-17T08:24:12.865Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 439492, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2023-03-31T08:25:33.432Z", "modified_at": "2025-12-17T08:24:12.865Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 439492, "required": false}]} + application/json: {"created_at": "2024-07-23T03:29:25.334Z", "modified_at": "2023-09-18T08:32:05.837Z", "id": "", "payment_processor": "stripe", "status": "expired", "client_secret": "", "url": "https://oddball-final.com", "expires_at": "2024-03-02T01:02:20.912Z", "success_url": "https://illiterate-ownership.com/", "embed_origin": "", "amount": 566134, "discount_amount": 108102, "net_amount": 304494, "tax_amount": 824826, "total_amount": 528924, "currency": "Comoro Franc", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": true, "require_billing_address": true, "is_discount_applicable": false, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": false, "is_payment_form_required": false, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": ""}, "billing_address_fields": {"country": "required", "state": "optional", "city": "required", "postal_code": "required", "line1": "required", "line2": "disabled"}, "products": [{"created_at": "2025-08-18T21:55:12.162Z", "modified_at": "2024-12-17T22:23:13.690Z", "id": "", "name": "", "description": "instead divert indeed oh phrase fisherman bowling but upon airmail", "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2023-07-30T20:21:38.608Z", "modified_at": "2023-10-31T15:08:35.342Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 330194, "legacy": true}, {"created_at": "2023-08-03T11:06:01.091Z", "modified_at": "2024-11-28T20:27:45.245Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 566134, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-04-25T20:23:37.760Z", "modified_at": "2023-11-02T06:39:34.543Z", "type": "custom", "description": "rebuke sun intensely", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 291762, "storage_version": null, "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-23T19:57:40.076Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-20T03:17:22.448Z", "size_readable": "", "public_url": "https://valuable-declaration.info"}, {"id": "", "organization_id": "", "name": "", "path": "/sbin", "mime_type": "", "size": 291762, "storage_version": null, "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2024-09-23T19:57:40.076Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-10-20T03:17:22.448Z", "size_readable": "", "public_url": "https://valuable-declaration.info"}]}], "product": {"created_at": "2024-01-05T10:50:28.777Z", "modified_at": "2024-04-21T11:49:06.390Z", "id": "", "name": "", "description": null, "recurring_interval": "year", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-11-16T12:17:31.920Z", "modified_at": "2024-08-02T16:48:24.620Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 67913, "maximum_amount": 437805, "preset_amount": 546487, "legacy": true}, {"created_at": "2024-02-08T00:22:42.494Z", "modified_at": "2025-10-13T00:42:35.938Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 317412, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [{"id": "", "created_at": "2023-04-25T20:23:37.760Z", "modified_at": "2023-11-02T06:39:34.543Z", "type": "custom", "description": "rebuke sun intensely", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2023-04-25T20:23:37.760Z", "modified_at": "2023-11-02T06:39:34.543Z", "type": "custom", "description": "rebuke sun intensely", "selectable": false, "deletable": false, "organization_id": ""}], "medias": []}, "product_price": {"created_at": "2025-09-16T02:10:33.833Z", "modified_at": "2024-11-12T15:58:56.119Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 400701, "legacy": true}, "discount": {"duration": "repeating", "type": "percentage", "basis_points": 639439, "id": "", "name": "", "code": null}, "organization": {"created_at": "2023-09-07T11:25:07.070Z", "modified_at": "2023-05-12T10:01:16.059Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://mixed-netsuke.com/", "email": "Noble29@gmail.com", "website": "", "socials": [{"platform": "github", "url": "https://blue-baritone.biz/"}], "details_submitted_at": null, "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}, "notification_settings": {"new_order": false, "new_subscription": true}}, "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2023-03-31T08:25:33.432Z", "modified_at": "2025-12-17T08:24:12.865Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 439492, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2023-03-31T08:25:33.432Z", "modified_at": "2025-12-17T08:24:12.865Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 439492, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2023-03-31T08:25:33.432Z", "modified_at": "2025-12-17T08:24:12.865Z", "id": "", "metadata": {}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 439492, "required": false}]} "403": application/json: {"error": "AlreadyActiveSubscriptionError", "detail": ""} "404": @@ -2264,7 +2245,7 @@ examples: application/json: {"customer_billing_address": {"country": "US"}} responses: "200": - application/json: {"created_at": "2023-03-02T01:35:00.551Z", "modified_at": "2024-02-06T20:08:33.394Z", "id": "", "payment_processor": "stripe", "status": "confirmed", "client_secret": "", "url": "https://earnest-mountain.biz/", "expires_at": "2023-05-03T06:41:51.564Z", "success_url": "https://amazing-airmail.biz", "embed_origin": "", "amount": 340812, "discount_amount": 983591, "net_amount": 119432, "tax_amount": 315526, "total_amount": 280139, "currency": "Lek", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": true, "require_billing_address": false, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": ""}, "customer_billing_address_fields": {"country": true, "state": false, "city": true, "postal_code": true, "line1": true, "line2": true}, "products": [], "product": {"created_at": "2023-12-22T07:23:53.362Z", "modified_at": null, "id": "", "name": "", "description": null, "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-07-29T04:50:02.330Z", "modified_at": "2023-01-09T13:54:39.340Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 111568, "maximum_amount": 27642, "preset_amount": null, "legacy": true}, {"created_at": "2024-01-09T12:43:40.308Z", "modified_at": "2023-05-11T21:32:37.055Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 280139, "legacy": true}, {"created_at": "2024-03-30T19:58:01.924Z", "modified_at": "2023-04-26T10:07:32.939Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 304892, "maximum_amount": 308257, "preset_amount": 774216, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-02-20T06:26:56.148Z", "modified_at": "2024-03-08T22:44:58.041Z", "type": "downloadables", "description": "jovially condense sleepy as porter interior forage which", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sys", "mime_type": "", "size": 923962, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-15T18:38:57.765Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-04-15T23:25:20.301Z", "size_readable": "", "public_url": "https://measly-transparency.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/sys", "mime_type": "", "size": 923962, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-15T18:38:57.765Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-04-15T23:25:20.301Z", "size_readable": "", "public_url": "https://measly-transparency.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/sys", "mime_type": "", "size": 923962, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-15T18:38:57.765Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-04-15T23:25:20.301Z", "size_readable": "", "public_url": "https://measly-transparency.biz"}]}, "product_price": {"created_at": "2023-12-07T12:50:51.025Z", "modified_at": "2025-06-09T19:20:24.149Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month"}, "discount": {"duration": "repeating", "type": "fixed", "amount": 794922, "currency": "Lilangeni", "id": "", "name": "", "code": ""}, "organization": {"created_at": "2023-03-10T13:26:15.309Z", "modified_at": "2025-01-22T15:08:25.650Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": null, "email": "Jimmie_Bayer@yahoo.com", "website": null, "socials": [{"platform": "linkedin", "url": "https://slight-amnesty.name"}], "details_submitted_at": "2024-07-09T06:52:44.672Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": true, "proration_behavior": "invoice"}}, "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-06-01T04:51:14.846Z", "modified_at": "2023-04-07T11:22:11.779Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 256145, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-06-01T04:51:14.846Z", "modified_at": "2023-04-07T11:22:11.779Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 256145, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-06-01T04:51:14.846Z", "modified_at": "2023-04-07T11:22:11.779Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 256145, "required": false}], "customer_session_token": ""} + application/json: {"created_at": "2023-03-02T01:35:00.551Z", "modified_at": "2024-02-06T20:08:33.394Z", "id": "", "payment_processor": "stripe", "status": "confirmed", "client_secret": "", "url": "https://earnest-mountain.biz/", "expires_at": "2023-05-03T06:41:51.564Z", "success_url": "https://amazing-airmail.biz", "embed_origin": "", "amount": 340812, "discount_amount": 983591, "net_amount": 119432, "tax_amount": 315526, "total_amount": 280139, "currency": "Lek", "product_id": "", "product_price_id": "", "discount_id": "", "allow_discount_codes": true, "require_billing_address": false, "is_discount_applicable": true, "is_free_product_price": true, "is_payment_required": true, "is_payment_setup_required": true, "is_payment_form_required": true, "customer_id": "", "is_business_customer": true, "customer_name": "", "customer_email": "", "customer_ip_address": "", "customer_billing_name": "", "customer_billing_address": {"country": "US"}, "customer_tax_id": "", "payment_processor_metadata": {"key": ""}, "billing_address_fields": {"country": "required", "state": "required", "city": "disabled", "postal_code": "optional", "line1": "required", "line2": "required"}, "products": [], "product": {"created_at": "2023-12-22T07:23:53.362Z", "modified_at": null, "id": "", "name": "", "description": null, "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-07-29T04:50:02.330Z", "modified_at": "2023-01-09T13:54:39.340Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 111568, "maximum_amount": 27642, "preset_amount": null, "legacy": true}, {"created_at": "2024-01-09T12:43:40.308Z", "modified_at": "2023-05-11T21:32:37.055Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 280139, "legacy": true}, {"created_at": "2024-03-30T19:58:01.924Z", "modified_at": "2023-04-26T10:07:32.939Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 304892, "maximum_amount": 308257, "preset_amount": 774216, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-02-20T06:26:56.148Z", "modified_at": "2024-03-08T22:44:58.041Z", "type": "downloadables", "description": "jovially condense sleepy as porter interior forage which", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/sys", "mime_type": "", "size": 923962, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-15T18:38:57.765Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-04-15T23:25:20.301Z", "size_readable": "", "public_url": "https://measly-transparency.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/sys", "mime_type": "", "size": 923962, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-15T18:38:57.765Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-04-15T23:25:20.301Z", "size_readable": "", "public_url": "https://measly-transparency.biz"}, {"id": "", "organization_id": "", "name": "", "path": "/sys", "mime_type": "", "size": 923962, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2023-11-15T18:38:57.765Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-04-15T23:25:20.301Z", "size_readable": "", "public_url": "https://measly-transparency.biz"}]}, "product_price": {"created_at": "2023-12-07T12:50:51.025Z", "modified_at": "2025-06-09T19:20:24.149Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, "discount": {"duration": "repeating", "type": "fixed", "amount": 794922, "currency": "Lilangeni", "id": "", "name": "", "code": ""}, "organization": {"created_at": "2023-03-10T13:26:15.309Z", "modified_at": "2025-01-22T15:08:25.650Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": null, "email": "Jimmie_Bayer@yahoo.com", "website": null, "socials": [{"platform": "linkedin", "url": "https://slight-amnesty.name"}], "details_submitted_at": "2024-07-09T06:52:44.672Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": true, "proration_behavior": "invoice"}, "notification_settings": {"new_order": false, "new_subscription": true}}, "attached_custom_fields": [{"custom_field_id": "", "custom_field": {"created_at": "2024-06-01T04:51:14.846Z", "modified_at": "2023-04-07T11:22:11.779Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 256145, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-06-01T04:51:14.846Z", "modified_at": "2023-04-07T11:22:11.779Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 256145, "required": false}, {"custom_field_id": "", "custom_field": {"created_at": "2024-06-01T04:51:14.846Z", "modified_at": "2023-04-07T11:22:11.779Z", "id": "", "metadata": {"key": ""}, "type": "number", "slug": "", "name": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "properties": {}}, "order": 256145, "required": false}], "customer_session_token": ""} "400": application/json: {"error": "PaymentError", "detail": ""} "403": @@ -2348,6 +2329,7 @@ examples: end_date: "2025-03-18" interval: "hour" organization_id: null + timezone: "UTC" responses: "200": application/json: {"periods": [{"timestamp": "2024-11-05T16:37:46.152Z", "orders": 2313.41, "revenue": 3697.18, "cumulative_revenue": 160547, "average_order_value": 8348.91, "one_time_products": 6315.62, "one_time_products_revenue": 271957, "new_subscriptions": 225346, "new_subscriptions_revenue": 5903.37, "renewed_subscriptions": 146.2, "renewed_subscriptions_revenue": 3772.41, "active_subscriptions": 1692.89, "monthly_recurring_revenue": 5809.97, "checkouts": 6229.46, "succeeded_checkouts": 464.75, "checkouts_conversion": 536209}], "totals": {"orders": 300394, "revenue": 980988, "cumulative_revenue": 5367.66, "average_order_value": 7320.73, "one_time_products": 772559, "one_time_products_revenue": 875093, "new_subscriptions": 903196, "new_subscriptions_revenue": 18.97, "renewed_subscriptions": 723.93, "renewed_subscriptions_revenue": 846052, "active_subscriptions": 5698.58, "monthly_recurring_revenue": 180851, "checkouts": 5307.17, "succeeded_checkouts": 9995.79, "checkouts_conversion": 5883.46}, "metrics": {"orders": {"slug": "", "display_name": "Mortimer35", "type": "percentage"}, "revenue": {"slug": "", "display_name": "Cruz.Yundt29", "type": "scalar"}, "cumulative_revenue": {"slug": "", "display_name": "Keshaun_Mraz87", "type": "scalar"}, "average_order_value": {"slug": "", "display_name": "Therese_Marks93", "type": "percentage"}, "one_time_products": {"slug": "", "display_name": "Roslyn.White86", "type": "scalar"}, "one_time_products_revenue": {"slug": "", "display_name": "Henderson.Herman17", "type": "percentage"}, "new_subscriptions": {"slug": "", "display_name": "Jamaal_Mueller91", "type": "percentage"}, "new_subscriptions_revenue": {"slug": "", "display_name": "Kaylee25", "type": "currency"}, "renewed_subscriptions": {"slug": "", "display_name": "Leland_Yundt", "type": "scalar"}, "renewed_subscriptions_revenue": {"slug": "", "display_name": "Dalton_Waters92", "type": "scalar"}, "active_subscriptions": {"slug": "", "display_name": "Alfonzo_Daugherty", "type": "percentage"}, "monthly_recurring_revenue": {"slug": "", "display_name": "Diana97", "type": "currency"}, "checkouts": {"slug": "", "display_name": "Magdalen_Goodwin-Schoen", "type": "scalar"}, "succeeded_checkouts": {"slug": "", "display_name": "Ida37", "type": "scalar"}, "checkouts_conversion": {"slug": "", "display_name": "Savion.Gerlach", "type": "percentage"}}} @@ -2381,7 +2363,7 @@ examples: id: "" responses: "200": - application/json: {"id": "", "created_at": "2024-04-17T15:51:04.274Z", "modified_at": "2024-09-28T01:45:16.528Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-04-30T23:16:47.192Z", "modified_at": null, "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-04-24T17:19:50.151Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "benefit_id": "", "key": "", "display_key": "", "status": "granted", "limit_activations": null, "usage": 210790, "limit_usage": 636896, "validations": 933684, "last_validated_at": "2025-12-07T23:00:45.828Z", "expires_at": "2023-03-29T22:22:03.314Z", "activations": [{"id": "", "license_key_id": "", "label": "", "meta": {"key": "", "key1": false}, "created_at": "2024-03-16T03:18:55.950Z", "modified_at": "2025-10-01T18:22:52.342Z"}, {"id": "", "license_key_id": "", "label": "", "meta": {"key": "", "key1": false}, "created_at": "2024-03-16T03:18:55.950Z", "modified_at": "2025-10-01T18:22:52.342Z"}, {"id": "", "license_key_id": "", "label": "", "meta": {"key": "", "key1": false}, "created_at": "2024-03-16T03:18:55.950Z", "modified_at": "2025-10-01T18:22:52.342Z"}]} + application/json: {"id": "", "created_at": "2024-04-17T15:51:04.274Z", "modified_at": "2024-09-28T01:45:16.528Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-04-30T23:16:47.192Z", "modified_at": null, "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-04-24T17:19:50.151Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "benefit_id": "", "key": "", "display_key": "", "status": "granted", "limit_activations": null, "usage": 210790, "limit_usage": 636896, "validations": 933684, "last_validated_at": "2025-12-07T23:00:45.828Z", "expires_at": "2023-03-29T22:22:03.314Z", "activations": [{"id": "", "license_key_id": "", "label": "", "meta": {"key": "", "key1": false}, "created_at": "2024-03-16T03:18:55.950Z", "modified_at": "2025-10-01T18:22:52.342Z"}, {"id": "", "license_key_id": "", "label": "", "meta": {"key": "", "key1": false}, "created_at": "2024-03-16T03:18:55.950Z", "modified_at": "2025-10-01T18:22:52.342Z"}, {"id": "", "license_key_id": "", "label": "", "meta": {"key": "", "key1": false}, "created_at": "2024-03-16T03:18:55.950Z", "modified_at": "2025-10-01T18:22:52.342Z"}]} "401": application/json: {"error": "Unauthorized", "detail": ""} "404": @@ -2397,7 +2379,7 @@ examples: application/json: {"usage": 0} responses: "200": - application/json: {"id": "", "created_at": "2025-01-01T16:52:41.426Z", "modified_at": "2023-06-07T17:13:25.184Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-04-02T14:00:56.356Z", "modified_at": null, "metadata": {"key": 9483.31, "key1": 4354.49, "key2": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-11-29T19:00:29.326Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "benefit_id": "", "key": "", "display_key": "", "status": "granted", "limit_activations": 322291, "usage": 729842, "limit_usage": 199159, "validations": 335813, "last_validated_at": "2025-10-23T05:11:52.478Z", "expires_at": "2023-04-19T21:27:30.358Z"} + application/json: {"id": "", "created_at": "2025-01-01T16:52:41.426Z", "modified_at": "2023-06-07T17:13:25.184Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-04-02T14:00:56.356Z", "modified_at": null, "metadata": {"key": 9483.31, "key1": 4354.49, "key2": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-11-29T19:00:29.326Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "benefit_id": "", "key": "", "display_key": "", "status": "granted", "limit_activations": 322291, "usage": 729842, "limit_usage": 199159, "validations": 335813, "last_validated_at": "2025-10-23T05:11:52.478Z", "expires_at": "2023-04-19T21:27:30.358Z"} "401": application/json: {"error": "Unauthorized", "detail": ""} "404": @@ -2412,7 +2394,7 @@ examples: activation_id: "" responses: "200": - application/json: {"id": "", "license_key_id": "", "label": "", "meta": {}, "created_at": "2025-12-13T19:45:59.208Z", "modified_at": "2023-12-24T22:24:52.018Z", "license_key": {"id": "", "created_at": "2024-07-21T12:42:21.959Z", "modified_at": null, "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-03-03T00:26:30.887Z", "modified_at": "2025-05-17T00:47:21.414Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "benefit_id": "", "key": "", "display_key": "", "status": "revoked", "limit_activations": null, "usage": 451187, "limit_usage": 638360, "validations": 27878, "last_validated_at": "2025-10-03T20:44:53.594Z", "expires_at": null}} + application/json: {"id": "", "license_key_id": "", "label": "", "meta": {}, "created_at": "2025-12-13T19:45:59.208Z", "modified_at": "2023-12-24T22:24:52.018Z", "license_key": {"id": "", "created_at": "2024-07-21T12:42:21.959Z", "modified_at": null, "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-03-03T00:26:30.887Z", "modified_at": "2025-05-17T00:47:21.414Z", "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "benefit_id": "", "key": "", "display_key": "", "status": "revoked", "limit_activations": null, "usage": 451187, "limit_usage": 638360, "validations": 27878, "last_validated_at": "2025-10-03T20:44:53.594Z", "expires_at": null}} "401": application/json: {"error": "Unauthorized", "detail": ""} "404": @@ -2428,7 +2410,7 @@ examples: limit: 10 responses: "200": - application/json: {"items": [{"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "metadata": {"key": 269522}, "payment_processor": "stripe", "client_secret": "", "success_url": "https://wretched-peony.com/", "label": "", "allow_discount_codes": false, "require_billing_address": false, "discount_id": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "products": [{"metadata": {"key": false}, "created_at": "2025-06-23T06:29:06.861Z", "modified_at": "2024-05-30T08:30:33.019Z", "id": "", "name": "", "description": "partially yellow gadzooks gleefully reassuringly qua around", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 987277, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2025-02-11T18:32:20.472Z", "modified_at": "2025-03-25T11:30:39.715Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "minimum_amount": 825064, "maximum_amount": 470214, "preset_amount": 586539}], "benefits": [{"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}, {"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}]}], "discount": {"duration": "once", "duration_in_months": 354366, "type": "fixed", "basis_points": 140653, "created_at": "2024-08-19T15:49:46.374Z", "modified_at": "2024-11-08T09:13:07.988Z", "id": "", "metadata": {"key": 6965.21, "key1": 727000}, "name": "", "code": "", "starts_at": "2023-08-16T05:03:04.814Z", "ends_at": "2023-11-17T21:19:16.987Z", "max_redemptions": 65553, "redemptions_count": 331792, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "url": "https://forsaken-hamburger.info/"}, {"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "metadata": {"key": 269522}, "payment_processor": "stripe", "client_secret": "", "success_url": "https://wretched-peony.com/", "label": "", "allow_discount_codes": false, "require_billing_address": false, "discount_id": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "products": [{"metadata": {"key": false}, "created_at": "2025-06-23T06:29:06.861Z", "modified_at": "2024-05-30T08:30:33.019Z", "id": "", "name": "", "description": "partially yellow gadzooks gleefully reassuringly qua around", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-05-11T01:12:44.937Z", "modified_at": "2025-06-06T13:16:03.281Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year"}, {"created_at": "2025-01-30T11:54:59.602Z", "modified_at": "2025-12-23T14:11:20.089Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "price_amount": 267903}], "benefits": [{"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}, {"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}]}], "discount": {"duration": "once", "duration_in_months": 354366, "type": "fixed", "basis_points": 140653, "created_at": "2024-08-19T15:49:46.374Z", "modified_at": "2024-11-08T09:13:07.988Z", "id": "", "metadata": {"key": 6965.21, "key1": 727000}, "name": "", "code": "", "starts_at": "2023-08-16T05:03:04.814Z", "ends_at": "2023-11-17T21:19:16.987Z", "max_redemptions": 65553, "redemptions_count": 331792, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "url": "https://forsaken-hamburger.info/"}, {"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "metadata": {"key": 269522}, "payment_processor": "stripe", "client_secret": "", "success_url": "https://wretched-peony.com/", "label": "", "allow_discount_codes": false, "require_billing_address": false, "discount_id": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "products": [{"metadata": {"key": false}, "created_at": "2025-06-23T06:29:06.861Z", "modified_at": "2024-05-30T08:30:33.019Z", "id": "", "name": "", "description": "partially yellow gadzooks gleefully reassuringly qua around", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-07-07T18:45:01.201Z", "modified_at": "2023-05-16T12:45:34.730Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month"}, {"created_at": "2023-04-05T16:33:44.616Z", "modified_at": "2023-12-19T09:15:06.533Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 363007, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}, {"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}]}], "discount": {"duration": "once", "duration_in_months": 354366, "type": "fixed", "basis_points": 140653, "created_at": "2024-08-19T15:49:46.374Z", "modified_at": "2024-11-08T09:13:07.988Z", "id": "", "metadata": {"key": 6965.21, "key1": 727000}, "name": "", "code": "", "starts_at": "2023-08-16T05:03:04.814Z", "ends_at": "2023-11-17T21:19:16.987Z", "max_redemptions": 65553, "redemptions_count": 331792, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "url": "https://forsaken-hamburger.info/"}], "pagination": {"total_count": 226341, "max_page": 804607}} + application/json: {"items": [{"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "metadata": {"key": 269522}, "payment_processor": "stripe", "client_secret": "", "success_url": "https://wretched-peony.com/", "label": "", "allow_discount_codes": false, "require_billing_address": false, "discount_id": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "products": [{"metadata": {"key": false}, "created_at": "2025-06-23T06:29:06.861Z", "modified_at": "2024-05-30T08:30:33.019Z", "id": "", "name": "", "description": "partially yellow gadzooks gleefully reassuringly qua around", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 987277, "meter_id": "", "meter": {"id": "", "name": ""}}, {"created_at": "2025-02-11T18:32:20.472Z", "modified_at": "2025-03-25T11:30:39.715Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 825064, "maximum_amount": 470214, "preset_amount": 586539, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}, {"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}]}], "discount": {"duration": "once", "duration_in_months": 354366, "type": "fixed", "basis_points": 140653, "created_at": "2024-08-19T15:49:46.374Z", "modified_at": "2024-11-08T09:13:07.988Z", "id": "", "metadata": {"key": 6965.21, "key1": 727000}, "name": "", "code": "", "starts_at": "2023-08-16T05:03:04.814Z", "ends_at": "2023-11-17T21:19:16.987Z", "max_redemptions": 65553, "redemptions_count": 331792, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "url": "https://forsaken-hamburger.info/"}, {"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "metadata": {"key": 269522}, "payment_processor": "stripe", "client_secret": "", "success_url": "https://wretched-peony.com/", "label": "", "allow_discount_codes": false, "require_billing_address": false, "discount_id": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "products": [{"metadata": {"key": false}, "created_at": "2025-06-23T06:29:06.861Z", "modified_at": "2024-05-30T08:30:33.019Z", "id": "", "name": "", "description": "partially yellow gadzooks gleefully reassuringly qua around", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-05-11T01:12:44.937Z", "modified_at": "2025-06-06T13:16:03.281Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-01-30T11:54:59.602Z", "modified_at": "2025-12-23T14:11:20.089Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 267903, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}, {"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}]}], "discount": {"duration": "once", "duration_in_months": 354366, "type": "fixed", "basis_points": 140653, "created_at": "2024-08-19T15:49:46.374Z", "modified_at": "2024-11-08T09:13:07.988Z", "id": "", "metadata": {"key": 6965.21, "key1": 727000}, "name": "", "code": "", "starts_at": "2023-08-16T05:03:04.814Z", "ends_at": "2023-11-17T21:19:16.987Z", "max_redemptions": 65553, "redemptions_count": 331792, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "url": "https://forsaken-hamburger.info/"}, {"created_at": "2024-12-08T18:31:28.967Z", "modified_at": "2025-08-25T12:12:46.370Z", "id": "", "metadata": {"key": 269522}, "payment_processor": "stripe", "client_secret": "", "success_url": "https://wretched-peony.com/", "label": "", "allow_discount_codes": false, "require_billing_address": false, "discount_id": "", "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "products": [{"metadata": {"key": false}, "created_at": "2025-06-23T06:29:06.861Z", "modified_at": "2024-05-30T08:30:33.019Z", "id": "", "name": "", "description": "partially yellow gadzooks gleefully reassuringly qua around", "recurring_interval": "year", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-07-07T18:45:01.201Z", "modified_at": "2023-05-16T12:45:34.730Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2023-04-05T16:33:44.616Z", "modified_at": "2023-12-19T09:15:06.533Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 363007, "legacy": true}], "benefits": [{"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2025-01-11T23:38:31.265Z", "modified_at": "2023-05-01T01:24:54.811Z", "type": "downloadables", "description": "gosh french or slow bin competent tuba follower oof", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}, {"id": "", "organization_id": "", "name": "", "path": "/Library", "mime_type": "", "size": 397996, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-12-04T19:29:48.554Z", "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2023-11-06T19:24:06.160Z", "size_readable": "", "public_url": "https://pitiful-flint.org"}]}], "discount": {"duration": "once", "duration_in_months": 354366, "type": "fixed", "basis_points": 140653, "created_at": "2024-08-19T15:49:46.374Z", "modified_at": "2024-11-08T09:13:07.988Z", "id": "", "metadata": {"key": 6965.21, "key1": 727000}, "name": "", "code": "", "starts_at": "2023-08-16T05:03:04.814Z", "ends_at": "2023-11-17T21:19:16.987Z", "max_redemptions": 65553, "redemptions_count": 331792, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "url": "https://forsaken-hamburger.info/"}], "pagination": {"total_count": 226341, "max_page": 804607}} "422": application/json: {} checkout-links:create: @@ -2608,7 +2590,7 @@ examples: application/json: {"external_id": "usr_1337", "email": "customer@example.com", "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"} responses: "201": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-12-18T06:01:42.001Z", "modified_at": null, "metadata": {"key": 404263}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-12-23T07:32:24.258Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-12-18T06:01:42.001Z", "modified_at": null, "metadata": {"key": 404263}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-12-23T07:32:24.258Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "422": application/json: {} customers:get: @@ -2618,7 +2600,7 @@ examples: id: "" responses: "200": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-02-07T11:56:28.687Z", "modified_at": "2024-03-20T09:58:07.343Z", "metadata": {"key": "", "key1": 645013}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-01-26T06:04:35.456Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-02-07T11:56:28.687Z", "modified_at": "2024-03-20T09:58:07.343Z", "metadata": {"key": "", "key1": 645013}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-01-26T06:04:35.456Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2632,7 +2614,7 @@ examples: application/json: {"email": "customer@example.com", "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "external_id": "usr_1337"} responses: "200": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-03-16T17:26:39.570Z", "modified_at": null, "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-04-14T07:55:04.911Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-03-16T17:26:39.570Z", "modified_at": null, "metadata": {}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-04-14T07:55:04.911Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2654,7 +2636,7 @@ examples: external_id: "" responses: "200": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-16T18:20:25.397Z", "modified_at": "2024-10-25T08:30:34.593Z", "metadata": {"key": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-16T18:20:25.397Z", "modified_at": "2024-10-25T08:30:34.593Z", "metadata": {"key": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": null, "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2668,7 +2650,7 @@ examples: application/json: {"email": "customer@example.com", "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"]} responses: "200": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-14T15:50:49.511Z", "modified_at": "2024-12-21T02:28:59.698Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-03-03T18:02:55.477Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-07-14T15:50:49.511Z", "modified_at": "2024-12-21T02:28:59.698Z", "metadata": {"key": true}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-03-03T18:02:55.477Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2690,7 +2672,7 @@ examples: id: "" responses: "200": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-05-23T10:33:06.148Z", "modified_at": "2023-02-27T08:27:16.536Z", "metadata": {"key": "", "key1": 633662}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-06-17T08:42:23.682Z", "active_subscriptions": [], "granted_benefits": [{"id": "d322132c-a9d0-4e0d-b8d3-d81ad021a3a9", "created_at": "2024-04-30T21:47:35.026Z", "modified_at": "2025-07-24T18:39:25.292Z", "granted_at": "2025-01-03T13:37:00Z", "benefit_id": "397a17aa-15cf-4cb4-9333-18040203cf98", "benefit_type": "meter_credit", "benefit_metadata": {"key": "value"}, "properties": {}}], "active_meters": [{"id": "", "created_at": "2023-09-20T07:57:07.722Z", "modified_at": "2025-03-26T21:37:11.251Z", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75}], "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-05-23T10:33:06.148Z", "modified_at": "2023-02-27T08:27:16.536Z", "metadata": {"key": "", "key1": 633662}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2024-06-17T08:42:23.682Z", "active_subscriptions": [], "granted_benefits": [{"id": "d322132c-a9d0-4e0d-b8d3-d81ad021a3a9", "created_at": "2024-04-30T21:47:35.026Z", "modified_at": "2025-07-24T18:39:25.292Z", "granted_at": "2025-01-03T13:37:00Z", "benefit_id": "397a17aa-15cf-4cb4-9333-18040203cf98", "benefit_type": "meter_credit", "benefit_metadata": {"key": "value"}, "properties": {}}], "active_meters": [{"id": "", "created_at": "2023-09-20T07:57:07.722Z", "modified_at": "2025-03-26T21:37:11.251Z", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75}], "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2702,7 +2684,7 @@ examples: external_id: "" responses: "200": - application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-08-30T17:22:51.531Z", "modified_at": "2023-11-29T18:51:49.385Z", "metadata": {"key": 7243, "key1": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-06-22T13:58:19.637Z", "active_subscriptions": [{"id": "e5149aae-e521-42b9-b24c-abb3d71eea2e", "created_at": "2023-08-11T03:25:00.199Z", "modified_at": "2023-09-26T12:48:54.200Z", "metadata": {}, "status": "active", "amount": 1000, "currency": "usd", "recurring_interval": "month", "current_period_start": "2025-02-03T13:37:00Z", "current_period_end": "2025-03-03T13:37:00Z", "cancel_at_period_end": false, "canceled_at": null, "started_at": "2025-01-03T13:37:00Z", "ends_at": null, "product_id": "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23", "discount_id": null, "meters": [{"created_at": "2024-10-14T09:52:27.345Z", "modified_at": "2025-03-01T08:36:48.449Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22"}]}], "granted_benefits": [{"id": "d322132c-a9d0-4e0d-b8d3-d81ad021a3a9", "created_at": "2024-05-11T12:04:47.637Z", "modified_at": "2024-06-03T16:51:15.542Z", "granted_at": "2025-01-03T13:37:00Z", "benefit_id": "397a17aa-15cf-4cb4-9333-18040203cf98", "benefit_type": "github_repository", "benefit_metadata": {"key": "value"}, "properties": {}}], "active_meters": [], "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"} + application/json: {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-08-30T17:22:51.531Z", "modified_at": "2023-11-29T18:51:49.385Z", "metadata": {"key": 7243, "key1": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-06-22T13:58:19.637Z", "active_subscriptions": [{"id": "e5149aae-e521-42b9-b24c-abb3d71eea2e", "created_at": "2023-08-11T03:25:00.199Z", "modified_at": "2023-09-26T12:48:54.200Z", "metadata": {}, "status": "active", "amount": 1000, "currency": "usd", "recurring_interval": "month", "current_period_start": "2025-02-03T13:37:00Z", "current_period_end": "2025-03-03T13:37:00Z", "cancel_at_period_end": false, "canceled_at": null, "started_at": "2025-01-03T13:37:00Z", "ends_at": null, "product_id": "d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23", "discount_id": null, "meters": [{"created_at": "2024-10-14T09:52:27.345Z", "modified_at": "2025-03-01T08:36:48.449Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22"}]}], "granted_benefits": [{"id": "d322132c-a9d0-4e0d-b8d3-d81ad021a3a9", "created_at": "2024-05-11T12:04:47.637Z", "modified_at": "2024-06-03T16:51:15.542Z", "granted_at": "2025-01-03T13:37:00Z", "benefit_id": "397a17aa-15cf-4cb4-9333-18040203cf98", "benefit_type": "github_repository", "benefit_metadata": {"key": "value"}, "properties": {}}], "active_meters": [], "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2716,7 +2698,7 @@ examples: limit: 10 responses: "200": - application/json: {"items": [{"created_at": "2023-01-16T21:16:44.906Z", "modified_at": "2025-09-12T06:08:19.548Z", "id": "", "granted_at": "2024-07-27T16:14:40.792Z", "revoked_at": "2025-06-07T03:03:31.507Z", "customer_id": "", "benefit_id": "", "subscription_id": "", "order_id": "", "is_granted": true, "is_revoked": true, "customer": {"created_at": "2024-10-14T21:25:11.296Z", "modified_at": "2025-11-18T01:34:50.166Z", "id": "", "email": "Isidro8@gmail.com", "email_verified": true, "name": "", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "oauth_accounts": {"key": {"account_id": "", "account_username": ""}, "key1": {"account_id": "", "account_username": ""}}}, "benefit": {"id": "", "created_at": "2023-04-24T09:44:44.986Z", "modified_at": null, "type": "custom", "description": "blindly forage boo consequently apostrophize because gee like", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": 25686, "key1": "", "key2": 629702}, "organization": {"created_at": "2025-12-12T09:43:34.801Z", "modified_at": "2025-12-30T08:25:24.872Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://deficient-formula.com", "email": "Coby11@yahoo.com", "website": "", "socials": [{"platform": "instagram", "url": "https://big-exhaust.net"}, {"platform": "instagram", "url": "https://big-exhaust.net"}], "details_submitted_at": "2023-01-25T04:58:38.231Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}}, "properties": {"note": ""}}, "properties": {}}], "pagination": {"total_count": 256243, "max_page": 771110}} + application/json: {"items": [{"created_at": "2023-10-06T18:19:15.209Z", "modified_at": "2023-01-16T21:16:44.906Z", "id": "", "granted_at": "2025-09-12T06:08:19.548Z", "revoked_at": "2024-07-27T16:14:40.792Z", "customer_id": "", "benefit_id": "", "subscription_id": "", "order_id": "", "is_granted": false, "is_revoked": false, "customer": {"created_at": "2024-01-30T06:11:54.152Z", "modified_at": "2024-10-14T21:25:11.296Z", "id": "", "email": "Vicente.Kirlin@hotmail.com", "email_verified": true, "name": "", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "oauth_accounts": {"key": {"account_id": "", "account_username": ""}}}, "benefit": {"id": "", "created_at": "2025-03-06T05:26:12.693Z", "modified_at": "2023-04-24T09:44:44.986Z", "type": "discord", "description": "astride as abandoned", "selectable": true, "deletable": true, "organization_id": "", "metadata": {}, "organization": {"created_at": "2025-09-05T04:02:14.476Z", "modified_at": "2024-12-07T20:14:23.079Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://another-festival.name/", "email": "Shanon.OConner79@yahoo.com", "website": null, "socials": [{"platform": "x", "url": "https://fat-chops.biz/"}], "details_submitted_at": "2023-05-23T11:29:48.327Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}, "notification_settings": {"new_order": true, "new_subscription": true}}, "properties": {"guild_id": ""}}, "properties": {}}], "pagination": {"total_count": 256243, "max_page": 771110}} "422": application/json: {} customer_portal:benefit-grants:get: @@ -2726,7 +2708,7 @@ examples: id: "" responses: "200": - application/json: {"created_at": "2023-03-15T12:31:38.233Z", "modified_at": "2024-01-09T12:49:39.354Z", "id": "", "granted_at": "2024-02-26T03:57:11.754Z", "revoked_at": "2025-03-28T16:05:13.207Z", "customer_id": "", "benefit_id": "", "subscription_id": "", "order_id": "", "is_granted": false, "is_revoked": true, "customer": {"created_at": "2024-06-22T16:37:44.271Z", "modified_at": "2023-12-13T16:16:10.075Z", "id": "", "email": "Morris19@yahoo.com", "email_verified": true, "name": null, "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "oauth_accounts": {}}, "benefit": {"id": "", "created_at": "2024-09-16T01:46:20.580Z", "modified_at": "2024-09-12T15:38:38.180Z", "type": "downloadables", "description": "coaxingly likewise comestible crumble whoa yuck gah lavish hexagon", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": true, "key1": 727273, "key2": true}, "organization": {"created_at": "2024-09-18T06:24:04.094Z", "modified_at": "2024-07-11T04:38:42.436Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://rich-freckle.net", "email": "Adelbert5@hotmail.com", "website": "", "socials": [{"platform": "linkedin", "url": "https://impartial-ravioli.net/"}, {"platform": "linkedin", "url": "https://impartial-ravioli.net/"}], "details_submitted_at": "2023-03-25T07:22:51.142Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "prorate"}}, "properties": {"active_files": ["", "", ""]}}, "properties": {}} + application/json: {"created_at": "2023-03-15T12:31:38.233Z", "modified_at": "2024-01-09T12:49:39.354Z", "id": "", "granted_at": "2024-02-26T03:57:11.754Z", "revoked_at": "2025-03-28T16:05:13.207Z", "customer_id": "", "benefit_id": "", "subscription_id": "", "order_id": "", "is_granted": false, "is_revoked": true, "customer": {"created_at": "2024-06-22T16:37:44.271Z", "modified_at": "2023-12-13T16:16:10.075Z", "id": "", "email": "Morris19@yahoo.com", "email_verified": true, "name": null, "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "oauth_accounts": {}}, "benefit": {"id": "", "created_at": "2024-09-16T01:46:20.580Z", "modified_at": "2024-09-12T15:38:38.180Z", "type": "downloadables", "description": "coaxingly likewise comestible crumble whoa yuck gah lavish hexagon", "selectable": true, "deletable": true, "organization_id": "", "metadata": {"key": true, "key1": 727273, "key2": true}, "organization": {"created_at": "2024-09-18T06:24:04.094Z", "modified_at": "2024-07-11T04:38:42.436Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://rich-freckle.net", "email": "Adelbert5@hotmail.com", "website": "", "socials": [{"platform": "linkedin", "url": "https://impartial-ravioli.net/"}, {"platform": "linkedin", "url": "https://impartial-ravioli.net/"}], "details_submitted_at": "2023-03-25T07:22:51.142Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "prorate"}, "notification_settings": {"new_order": true, "new_subscription": true}}, "properties": {"active_files": ["", "", ""]}}, "properties": {}} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2740,7 +2722,7 @@ examples: application/json: {"benefit_type": "license_keys"} responses: "200": - application/json: {"created_at": "2025-07-10T10:56:59.187Z", "modified_at": "2024-11-21T02:12:57.379Z", "id": "", "granted_at": "2023-06-28T14:53:41.005Z", "revoked_at": "2025-06-22T09:01:10.015Z", "customer_id": "", "benefit_id": "", "subscription_id": "", "order_id": "", "is_granted": false, "is_revoked": true, "customer": {"created_at": "2025-04-08T03:47:04.594Z", "modified_at": "2023-08-23T10:39:08.850Z", "id": "", "email": "Paige_Hessel30@yahoo.com", "email_verified": true, "name": "", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "oauth_accounts": {"key": {"account_id": "", "account_username": ""}}}, "benefit": {"id": "", "created_at": "2024-11-26T13:15:38.559Z", "modified_at": "2024-05-18T06:07:57.166Z", "type": "github_repository", "description": "hm despite ferociously evenly hypothesize frenetically finally with concerning", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": 631028, "key1": ""}, "organization": {"created_at": "2024-12-09T23:44:32.710Z", "modified_at": "2025-05-27T23:23:51.447Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://actual-accountability.net/", "email": "Alexane.Koch42@gmail.com", "website": "", "socials": [{"platform": "instagram", "url": "https://amazing-joy.name/"}], "details_submitted_at": "2025-01-08T05:57:31.407Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "prorate"}}, "properties": {"repository_owner": "polarsource", "repository_name": "private_repo"}}, "properties": {}} + application/json: {"created_at": "2025-07-10T10:56:59.187Z", "modified_at": "2024-11-21T02:12:57.379Z", "id": "", "granted_at": "2023-06-28T14:53:41.005Z", "revoked_at": "2025-06-22T09:01:10.015Z", "customer_id": "", "benefit_id": "", "subscription_id": "", "order_id": "", "is_granted": false, "is_revoked": true, "customer": {"created_at": "2025-04-08T03:47:04.594Z", "modified_at": "2023-08-23T10:39:08.850Z", "id": "", "email": "Paige_Hessel30@yahoo.com", "email_verified": true, "name": "", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "oauth_accounts": {"key": {"account_id": "", "account_username": ""}}}, "benefit": {"id": "", "created_at": "2024-11-26T13:15:38.559Z", "modified_at": "2024-05-18T06:07:57.166Z", "type": "custom", "description": "hm despite ferociously evenly hypothesize frenetically finally with concerning", "selectable": false, "deletable": true, "organization_id": "", "metadata": {"key": 631028, "key1": ""}, "organization": {"created_at": "2024-12-09T23:44:32.710Z", "modified_at": "2025-05-27T23:23:51.447Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://actual-accountability.net/", "email": "Alexane.Koch42@gmail.com", "website": "", "socials": [{"platform": "instagram", "url": "https://amazing-joy.name/"}], "details_submitted_at": "2025-01-08T05:57:31.407Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "prorate"}, "notification_settings": {"new_order": true, "new_subscription": false}}, "properties": {"note": ""}}, "properties": {}} "403": application/json: {"error": "NotPermitted", "detail": ""} "404": @@ -2778,7 +2760,7 @@ examples: application/json: {"confirmation_token_id": "", "set_default": false, "return_url": "https://yearly-custom.net/"} responses: "201": - application/json: {"id": "", "type": "", "created_at": "2025-09-15T22:53:36.011Z", "default": true} + application/json: {"id": "", "created_at": "2025-09-15T22:53:36.011Z", "modified_at": "2025-12-23T00:32:19.874Z", "processor": "stripe", "customer_id": "", "type": ""} "422": application/json: {} customer_portal:customers:delete_payment_method: @@ -2859,7 +2841,7 @@ examples: id: "" responses: "200": - application/json: {"id": "", "created_at": "2024-07-24T22:16:16.914Z", "modified_at": "2025-08-11T21:48:56.009Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-09-12T08:24:58.713Z", "modified_at": "2025-02-07T11:37:02.780Z", "metadata": {"key": "", "key1": 858698}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-05-14T07:47:00.415Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "benefit_id": "", "key": "", "display_key": "", "status": "revoked", "limit_activations": 114269, "usage": 180465, "limit_usage": 511235, "validations": 955735, "last_validated_at": "2024-03-18T20:25:39.758Z", "expires_at": "2023-01-16T12:09:51.512Z", "activations": [{"id": "", "license_key_id": "", "label": "", "meta": {"key": true, "key1": "", "key2": ""}, "created_at": "2024-08-17T12:54:58.672Z", "modified_at": "2024-02-20T10:12:43.162Z"}]} + application/json: {"id": "", "created_at": "2024-07-24T22:16:16.914Z", "modified_at": "2025-08-11T21:48:56.009Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-09-12T08:24:58.713Z", "modified_at": "2025-02-07T11:37:02.780Z", "metadata": {"key": "", "key1": 858698}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-05-14T07:47:00.415Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "benefit_id": "", "key": "", "display_key": "", "status": "revoked", "limit_activations": 114269, "usage": 180465, "limit_usage": 511235, "validations": 955735, "last_validated_at": "2024-03-18T20:25:39.758Z", "expires_at": "2023-01-16T12:09:51.512Z", "activations": [{"id": "", "license_key_id": "", "label": "", "meta": {"key": true, "key1": "", "key2": ""}, "created_at": "2024-08-17T12:54:58.672Z", "modified_at": "2024-02-20T10:12:43.162Z"}]} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2870,7 +2852,7 @@ examples: application/json: {"key": "", "organization_id": ""} responses: "200": - application/json: {"id": "", "created_at": "2023-04-11T23:03:09.029Z", "modified_at": "2025-01-16T01:19:41.953Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-06-20T05:32:41.329Z", "modified_at": "2025-10-10T19:10:08.865Z", "metadata": {"key": 6109.76, "key1": "", "key2": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-10-25T09:19:10.801Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "benefit_id": "", "key": "", "display_key": "", "status": "disabled", "limit_activations": 858831, "usage": 260081, "limit_usage": 881343, "validations": 466870, "last_validated_at": "2024-09-17T00:22:10.670Z", "expires_at": "2024-03-03T03:07:36.449Z"} + application/json: {"id": "", "created_at": "2023-04-11T23:03:09.029Z", "modified_at": "2025-01-16T01:19:41.953Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-06-20T05:32:41.329Z", "modified_at": "2025-10-10T19:10:08.865Z", "metadata": {"key": 6109.76, "key1": "", "key2": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": null, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-10-25T09:19:10.801Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "benefit_id": "", "key": "", "display_key": "", "status": "disabled", "limit_activations": 858831, "usage": 260081, "limit_usage": 881343, "validations": 466870, "last_validated_at": "2024-09-17T00:22:10.670Z", "expires_at": "2024-03-03T03:07:36.449Z"} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2881,7 +2863,7 @@ examples: application/json: {"key": "", "organization_id": "", "label": ""} responses: "200": - application/json: {"id": "", "license_key_id": "", "label": "", "meta": {"key": true}, "created_at": "2024-09-24T18:51:56.190Z", "modified_at": "2024-11-09T05:51:44.593Z", "license_key": {"id": "", "created_at": "2023-09-01T21:14:56.853Z", "modified_at": "2023-12-12T12:14:57.239Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-15T07:09:48.285Z", "modified_at": "2024-05-28T04:18:22.471Z", "metadata": {"key": "", "key1": 680556, "key2": 6297.25}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-04-04T09:00:46.250Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "benefit_id": "", "key": "", "display_key": "", "status": "granted", "limit_activations": 401169, "usage": 971008, "limit_usage": 352972, "validations": 241945, "last_validated_at": "2024-10-21T07:39:42.110Z", "expires_at": "2023-03-30T21:36:19.993Z"}} + application/json: {"id": "", "license_key_id": "", "label": "", "meta": {"key": true}, "created_at": "2024-09-24T18:51:56.190Z", "modified_at": "2024-11-09T05:51:44.593Z", "license_key": {"id": "", "created_at": "2023-09-01T21:14:56.853Z", "modified_at": "2023-12-12T12:14:57.239Z", "organization_id": "", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-08-15T07:09:48.285Z", "modified_at": "2024-05-28T04:18:22.471Z", "metadata": {"key": "", "key1": 680556, "key2": 6297.25}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-04-04T09:00:46.250Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "benefit_id": "", "key": "", "display_key": "", "status": "granted", "limit_activations": 401169, "usage": 971008, "limit_usage": 352972, "validations": 241945, "last_validated_at": "2024-10-21T07:39:42.110Z", "expires_at": "2023-03-30T21:36:19.993Z"}} "403": application/json: {"error": "NotPermitted", "detail": ""} "404": @@ -2906,7 +2888,7 @@ examples: limit: 10 responses: "200": - application/json: {"items": [{"id": "", "created_at": "2025-11-20T11:42:23.721Z", "modified_at": "2025-01-24T20:31:05.561Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 845676, "discount_amount": 924720, "net_amount": 71681, "amount": 63217, "tax_amount": 598982, "total_amount": 539673, "refunded_amount": 14405, "refunded_tax_amount": 988959, "currency": "Malagasy Ariary", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2025-05-15T00:41:31.862Z", "modified_at": "2023-04-25T06:37:58.723Z", "id": "", "name": "", "description": "planula breakable gee stranger", "recurring_interval": null, "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}], "organization": {"created_at": "2023-11-27T01:22:01.788Z", "modified_at": "2023-09-26T20:05:53.182Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://gaseous-quinoa.net/", "email": "Julia7@yahoo.com", "website": null, "socials": [{"platform": "youtube", "url": "https://classic-completion.org/"}], "details_submitted_at": "2025-06-17T11:44:40.024Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "prorate"}}}, "subscription": {"created_at": "2025-09-29T10:04:34.395Z", "modified_at": "2024-01-20T16:39:03.992Z", "id": "", "amount": 988367, "currency": "Norwegian Krone", "recurring_interval": "month", "status": "incomplete", "current_period_start": "2025-07-15T00:27:45.241Z", "current_period_end": "2025-04-09T12:43:21.768Z", "cancel_at_period_end": true, "canceled_at": "2025-05-30T20:27:13.803Z", "started_at": "2025-12-27T13:19:34.629Z", "ends_at": "2023-04-24T07:47:19.900Z", "ended_at": "2025-12-29T09:10:52.742Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}, {"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}]}, {"id": "", "created_at": "2025-11-20T11:42:23.721Z", "modified_at": "2025-01-24T20:31:05.561Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 845676, "discount_amount": 924720, "net_amount": 71681, "amount": 63217, "tax_amount": 598982, "total_amount": 539673, "refunded_amount": 14405, "refunded_tax_amount": 988959, "currency": "Malagasy Ariary", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2025-05-15T00:41:31.862Z", "modified_at": "2023-04-25T06:37:58.723Z", "id": "", "name": "", "description": "planula breakable gee stranger", "recurring_interval": null, "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}], "organization": {"created_at": "2023-11-27T01:22:01.788Z", "modified_at": "2023-09-26T20:05:53.182Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://gaseous-quinoa.net/", "email": "Julia7@yahoo.com", "website": null, "socials": [{"platform": "youtube", "url": "https://classic-completion.org/"}], "details_submitted_at": "2025-06-17T11:44:40.024Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "prorate"}}}, "subscription": {"created_at": "2025-09-29T10:04:34.395Z", "modified_at": "2024-01-20T16:39:03.992Z", "id": "", "amount": 988367, "currency": "Norwegian Krone", "recurring_interval": "month", "status": "incomplete", "current_period_start": "2025-07-15T00:27:45.241Z", "current_period_end": "2025-04-09T12:43:21.768Z", "cancel_at_period_end": true, "canceled_at": "2025-05-30T20:27:13.803Z", "started_at": "2025-12-27T13:19:34.629Z", "ends_at": "2023-04-24T07:47:19.900Z", "ended_at": "2025-12-29T09:10:52.742Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}, {"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}]}], "pagination": {"total_count": 449940, "max_page": 933681}} + application/json: {"items": [{"id": "", "created_at": "2025-11-20T11:42:23.721Z", "modified_at": "2025-01-24T20:31:05.561Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 845676, "discount_amount": 924720, "net_amount": 71681, "amount": 63217, "tax_amount": 598982, "total_amount": 539673, "refunded_amount": 14405, "refunded_tax_amount": 988959, "currency": "Malagasy Ariary", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": false, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2025-05-15T00:41:31.862Z", "modified_at": "2023-04-25T06:37:58.723Z", "id": "", "name": "", "description": "planula breakable gee stranger", "recurring_interval": null, "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}], "organization": {"created_at": "2023-11-27T01:22:01.788Z", "modified_at": "2023-09-26T20:05:53.182Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://gaseous-quinoa.net/", "email": "Julia7@yahoo.com", "website": null, "socials": [{"platform": "youtube", "url": "https://classic-completion.org/"}], "details_submitted_at": "2025-06-17T11:44:40.024Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "prorate"}, "notification_settings": {"new_order": true, "new_subscription": false}}}, "subscription": {"created_at": "2025-09-29T10:04:34.395Z", "modified_at": "2024-01-20T16:39:03.992Z", "id": "", "amount": 988367, "currency": "Norwegian Krone", "recurring_interval": "month", "status": "incomplete", "current_period_start": "2025-07-15T00:27:45.241Z", "current_period_end": "2025-04-09T12:43:21.768Z", "cancel_at_period_end": true, "canceled_at": "2025-05-30T20:27:13.803Z", "started_at": "2025-12-27T13:19:34.629Z", "ends_at": "2023-04-24T07:47:19.900Z", "ended_at": "2025-12-29T09:10:52.742Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}, {"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}]}, {"id": "", "created_at": "2025-11-20T11:42:23.721Z", "modified_at": "2025-01-24T20:31:05.561Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 845676, "discount_amount": 924720, "net_amount": 71681, "amount": 63217, "tax_amount": 598982, "total_amount": 539673, "refunded_amount": 14405, "refunded_tax_amount": 988959, "currency": "Malagasy Ariary", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2025-05-15T00:41:31.862Z", "modified_at": "2023-04-25T06:37:58.723Z", "id": "", "name": "", "description": "planula breakable gee stranger", "recurring_interval": null, "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}, {"id": "", "created_at": "2023-07-13T14:06:15.505Z", "modified_at": "2023-04-04T23:25:06.964Z", "type": "meter_credit", "description": "preside because since alongside", "selectable": true, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/Users", "mime_type": "", "size": 438908, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-08-19T15:18:48.324Z", "size_readable": "", "public_url": "https://perfumed-permafrost.info/"}], "organization": {"created_at": "2023-11-27T01:22:01.788Z", "modified_at": "2023-09-26T20:05:53.182Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://gaseous-quinoa.net/", "email": "Julia7@yahoo.com", "website": null, "socials": [{"platform": "youtube", "url": "https://classic-completion.org/"}], "details_submitted_at": "2025-06-17T11:44:40.024Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "prorate"}, "notification_settings": {"new_order": true, "new_subscription": false}}}, "subscription": {"created_at": "2025-09-29T10:04:34.395Z", "modified_at": "2024-01-20T16:39:03.992Z", "id": "", "amount": 988367, "currency": "Norwegian Krone", "recurring_interval": "month", "status": "incomplete", "current_period_start": "2025-07-15T00:27:45.241Z", "current_period_end": "2025-04-09T12:43:21.768Z", "cancel_at_period_end": true, "canceled_at": "2025-05-30T20:27:13.803Z", "started_at": "2025-12-27T13:19:34.629Z", "ends_at": "2023-04-24T07:47:19.900Z", "ended_at": "2025-12-29T09:10:52.742Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}, {"created_at": "2025-09-04T16:52:16.935Z", "modified_at": "2025-01-30T05:26:00.826Z", "id": "", "label": "", "amount": 807701, "tax_amount": 697997, "proration": true, "product_price_id": ""}]}], "pagination": {"total_count": 449940, "max_page": 933681}} "422": application/json: {} customer_portal:orders:get: @@ -2916,7 +2898,7 @@ examples: id: "" responses: "200": - application/json: {"id": "", "created_at": "2025-11-07T01:29:33.239Z", "modified_at": "2025-10-01T14:10:31.444Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 955067, "discount_amount": 688152, "net_amount": 70935, "amount": 506660, "tax_amount": 1252, "total_amount": 953506, "refunded_amount": 31567, "refunded_tax_amount": 929652, "currency": "CFP Franc", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2023-11-19T04:53:34.522Z", "modified_at": "2025-11-25T20:27:43.607Z", "id": "", "name": "", "description": "too jubilantly empty meh", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-10-01T14:10:31.444Z", "modified_at": "2025-11-12T18:03:36.492Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "one_time", "recurring_interval": "month", "price_currency": "", "price_amount": 953506}, {"created_at": "2025-11-13T23:04:52.208Z", "modified_at": "2023-07-18T15:45:42.662Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-23T03:55:01.103Z", "modified_at": "2025-05-14T03:22:06.100Z", "type": "meter_credit", "description": "ah coagulate not thankfully buzzing boohoo mask vulgarise far-off drat", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2025-07-23T03:55:01.103Z", "modified_at": "2025-05-14T03:22:06.100Z", "type": "meter_credit", "description": "ah coagulate not thankfully buzzing boohoo mask vulgarise far-off drat", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2025-07-23T03:55:01.103Z", "modified_at": "2025-05-14T03:22:06.100Z", "type": "meter_credit", "description": "ah coagulate not thankfully buzzing boohoo mask vulgarise far-off drat", "selectable": true, "deletable": true, "organization_id": ""}], "medias": [], "organization": {"created_at": "2023-07-27T19:30:57.624Z", "modified_at": "2025-02-13T12:23:44.948Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://hot-amendment.biz/", "email": "Damaris4@hotmail.com", "website": "", "socials": [{"platform": "youtube", "url": "https://stupendous-advancement.name"}], "details_submitted_at": "2024-10-04T10:38:48.094Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "prorate"}}}, "subscription": {"created_at": "2025-03-12T22:14:21.224Z", "modified_at": "2024-03-29T21:03:44.806Z", "id": "", "amount": 726603, "currency": "Som", "recurring_interval": "year", "status": "canceled", "current_period_start": "2023-10-08T20:14:11.453Z", "current_period_end": "2023-01-11T05:31:47.928Z", "cancel_at_period_end": true, "canceled_at": "2024-11-02T16:16:11.516Z", "started_at": "2024-04-10T15:06:14.767Z", "ends_at": "2023-08-09T06:47:34.634Z", "ended_at": "2023-05-14T07:05:36.107Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "too_expensive", "customer_cancellation_comment": ""}, "items": [{"created_at": "2023-03-15T16:46:25.288Z", "modified_at": "2023-06-13T07:31:24.272Z", "id": "", "label": "", "amount": 846674, "tax_amount": 465593, "proration": true, "product_price_id": ""}, {"created_at": "2023-03-15T16:46:25.288Z", "modified_at": "2023-06-13T07:31:24.272Z", "id": "", "label": "", "amount": 846674, "tax_amount": 465593, "proration": true, "product_price_id": ""}]} + application/json: {"id": "", "created_at": "2025-11-07T01:29:33.239Z", "modified_at": "2025-10-01T14:10:31.444Z", "status": "partially_refunded", "paid": true, "subtotal_amount": 955067, "discount_amount": 688152, "net_amount": 70935, "amount": 506660, "tax_amount": 1252, "total_amount": 953506, "refunded_amount": 31567, "refunded_tax_amount": 929652, "currency": "CFP Franc", "billing_reason": "subscription_cycle", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2023-11-19T04:53:34.522Z", "modified_at": "2025-11-25T20:27:43.607Z", "id": "", "name": "", "description": "too jubilantly empty meh", "recurring_interval": "month", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-10-01T14:10:31.444Z", "modified_at": "2025-11-12T18:03:36.492Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 953506, "legacy": true}, {"created_at": "2025-11-13T23:04:52.208Z", "modified_at": "2023-07-18T15:45:42.662Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "benefits": [{"id": "", "created_at": "2025-07-23T03:55:01.103Z", "modified_at": "2025-05-14T03:22:06.100Z", "type": "meter_credit", "description": "ah coagulate not thankfully buzzing boohoo mask vulgarise far-off drat", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2025-07-23T03:55:01.103Z", "modified_at": "2025-05-14T03:22:06.100Z", "type": "meter_credit", "description": "ah coagulate not thankfully buzzing boohoo mask vulgarise far-off drat", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2025-07-23T03:55:01.103Z", "modified_at": "2025-05-14T03:22:06.100Z", "type": "meter_credit", "description": "ah coagulate not thankfully buzzing boohoo mask vulgarise far-off drat", "selectable": true, "deletable": true, "organization_id": ""}], "medias": [], "organization": {"created_at": "2023-07-27T19:30:57.624Z", "modified_at": "2025-02-13T12:23:44.948Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://hot-amendment.biz/", "email": "Damaris4@hotmail.com", "website": "", "socials": [{"platform": "youtube", "url": "https://stupendous-advancement.name"}], "details_submitted_at": "2024-10-04T10:38:48.094Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "prorate"}, "notification_settings": {"new_order": false, "new_subscription": true}}}, "subscription": {"created_at": "2025-03-12T22:14:21.224Z", "modified_at": "2024-03-29T21:03:44.806Z", "id": "", "amount": 726603, "currency": "Som", "recurring_interval": "year", "status": "canceled", "current_period_start": "2023-10-08T20:14:11.453Z", "current_period_end": "2023-01-11T05:31:47.928Z", "cancel_at_period_end": true, "canceled_at": "2024-11-02T16:16:11.516Z", "started_at": "2024-04-10T15:06:14.767Z", "ends_at": "2023-08-09T06:47:34.634Z", "ended_at": "2023-05-14T07:05:36.107Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "too_expensive", "customer_cancellation_comment": ""}, "items": [{"created_at": "2023-03-15T16:46:25.288Z", "modified_at": "2023-06-13T07:31:24.272Z", "id": "", "label": "", "amount": 846674, "tax_amount": 465593, "proration": true, "product_price_id": ""}, {"created_at": "2023-03-15T16:46:25.288Z", "modified_at": "2023-06-13T07:31:24.272Z", "id": "", "label": "", "amount": 846674, "tax_amount": 465593, "proration": true, "product_price_id": ""}]} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2940,7 +2922,7 @@ examples: slug: "" responses: "200": - application/json: {"organization": {"created_at": "2025-06-05T07:04:36.562Z", "modified_at": "2024-07-19T19:10:17.295Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://doting-lifestyle.name/", "email": "Darion96@gmail.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://negligible-poetry.biz"}, {"platform": "tiktok", "url": "https://negligible-poetry.biz"}], "details_submitted_at": "2024-07-30T22:43:06.764Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "prorate"}}, "products": [{"created_at": "2025-01-07T03:20:40.621Z", "modified_at": "2024-05-04T02:49:36.301Z", "id": "", "name": "", "description": "behold whereas once gleefully", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2024-07-19T19:10:17.295Z", "modified_at": "2023-10-04T14:51:08.320Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month"}, {"created_at": "2023-05-14T06:28:28.766Z", "modified_at": "2024-09-04T10:55:17.085Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 668979, "maximum_amount": 629088, "preset_amount": 687565, "legacy": true}, {"created_at": "2024-07-30T22:43:06.764Z", "modified_at": "2024-06-03T04:21:14.567Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 672573, "maximum_amount": 446275, "preset_amount": 235699, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-06-10T21:02:03.324Z", "modified_at": "2023-10-23T22:10:37.289Z", "type": "meter_credit", "description": "oh dirty dirty ribbon rear yippee", "selectable": true, "deletable": true, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/bin", "mime_type": "", "size": 187628, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2025-02-06T06:31:05.333Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-09-02T03:48:53.348Z", "size_readable": "", "public_url": "https://ragged-icebreaker.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/bin", "mime_type": "", "size": 187628, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2025-02-06T06:31:05.333Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-09-02T03:48:53.348Z", "size_readable": "", "public_url": "https://ragged-icebreaker.info/"}]}]} + application/json: {"organization": {"created_at": "2025-06-05T07:04:36.562Z", "modified_at": "2024-07-19T19:10:17.295Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://doting-lifestyle.name/", "email": "Darion96@gmail.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://negligible-poetry.biz"}, {"platform": "tiktok", "url": "https://negligible-poetry.biz"}], "details_submitted_at": "2024-07-30T22:43:06.764Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "prorate"}, "notification_settings": {"new_order": false, "new_subscription": false}}, "products": [{"created_at": "2025-01-07T03:20:40.621Z", "modified_at": "2024-05-04T02:49:36.301Z", "id": "", "name": "", "description": "behold whereas once gleefully", "recurring_interval": null, "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2024-07-19T19:10:17.295Z", "modified_at": "2023-10-04T14:51:08.320Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}, {"created_at": "2023-05-14T06:28:28.766Z", "modified_at": "2024-09-04T10:55:17.085Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 668979, "maximum_amount": 629088, "preset_amount": 687565, "legacy": true}, {"created_at": "2024-07-30T22:43:06.764Z", "modified_at": "2024-06-03T04:21:14.567Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 672573, "maximum_amount": 446275, "preset_amount": 235699, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-06-10T21:02:03.324Z", "modified_at": "2023-10-23T22:10:37.289Z", "type": "meter_credit", "description": "oh dirty dirty ribbon rear yippee", "selectable": true, "deletable": true, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr/bin", "mime_type": "", "size": 187628, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2025-02-06T06:31:05.333Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-09-02T03:48:53.348Z", "size_readable": "", "public_url": "https://ragged-icebreaker.info/"}, {"id": "", "organization_id": "", "name": "", "path": "/usr/bin", "mime_type": "", "size": 187628, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": "2025-02-06T06:31:05.333Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-09-02T03:48:53.348Z", "size_readable": "", "public_url": "https://ragged-icebreaker.info/"}]}]} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2954,7 +2936,7 @@ examples: limit: 10 responses: "200": - application/json: {"items": [{"created_at": "2023-01-03T00:35:12.592Z", "modified_at": "2023-02-04T21:40:45.220Z", "id": "", "amount": 678476, "currency": "Bahraini Dinar", "recurring_interval": "year", "status": "incomplete_expired", "current_period_start": "2025-01-25T11:12:42.694Z", "current_period_end": "2023-11-12T13:08:09.571Z", "cancel_at_period_end": true, "canceled_at": "2025-10-28T08:23:28.446Z", "started_at": "2024-01-04T03:39:38.578Z", "ends_at": "2024-09-23T17:15:31.139Z", "ended_at": "2024-04-21T13:12:27.764Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "other", "customer_cancellation_comment": "", "product": {"created_at": "2024-06-21T23:07:53.931Z", "modified_at": "2024-07-17T01:06:55.024Z", "id": "", "name": "", "description": "an when upwardly", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-01-03T00:35:12.592Z", "modified_at": "2023-02-04T21:40:45.220Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 944637, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-12-28T06:49:52.968Z", "modified_at": "2025-12-13T05:34:39.641Z", "type": "discord", "description": "square back cuddly stack coop descent ick oil concrete give", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [], "organization": {"created_at": "2025-09-28T20:26:17.846Z", "modified_at": "2025-08-10T14:48:44.687Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://front-equal.com", "email": "Guido30@yahoo.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://clueless-midwife.net/"}, {"platform": "tiktok", "url": "https://clueless-midwife.net/"}], "details_submitted_at": "2025-12-03T13:10:55.375Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}}}, "prices": [{"created_at": "2024-04-28T23:59:29.324Z", "modified_at": "2023-08-04T11:59:00.224Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-05-06T00:46:00.044Z", "modified_at": "2023-10-31T12:02:35.613Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 746007, "legacy": true}], "meters": [{"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}, {"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}]}, {"created_at": "2023-01-03T00:35:12.592Z", "modified_at": "2023-02-04T21:40:45.220Z", "id": "", "amount": 678476, "currency": "Bahraini Dinar", "recurring_interval": "year", "status": "incomplete_expired", "current_period_start": "2025-01-25T11:12:42.694Z", "current_period_end": "2023-11-12T13:08:09.571Z", "cancel_at_period_end": true, "canceled_at": "2025-10-28T08:23:28.446Z", "started_at": "2024-01-04T03:39:38.578Z", "ends_at": "2024-09-23T17:15:31.139Z", "ended_at": "2024-04-21T13:12:27.764Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "other", "customer_cancellation_comment": "", "product": {"created_at": "2024-06-21T23:07:53.931Z", "modified_at": "2024-07-17T01:06:55.024Z", "id": "", "name": "", "description": "an when upwardly", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-01-12T09:39:36.733Z", "modified_at": "2023-09-02T17:20:24.135Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": null, "price_currency": "", "unit_amount": "", "cap_amount": 655254, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [{"id": "", "created_at": "2024-12-28T06:49:52.968Z", "modified_at": "2025-12-13T05:34:39.641Z", "type": "discord", "description": "square back cuddly stack coop descent ick oil concrete give", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [], "organization": {"created_at": "2025-09-28T20:26:17.846Z", "modified_at": "2025-08-10T14:48:44.687Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://front-equal.com", "email": "Guido30@yahoo.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://clueless-midwife.net/"}, {"platform": "tiktok", "url": "https://clueless-midwife.net/"}], "details_submitted_at": "2025-12-03T13:10:55.375Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}}}, "prices": [{"created_at": "2023-08-23T16:58:58.285Z", "modified_at": "2023-06-20T17:27:13.322Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 850254, "legacy": true}, {"created_at": "2024-10-04T17:29:24.326Z", "modified_at": "2024-12-24T08:26:33.925Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 886852, "maximum_amount": 660944, "preset_amount": null}], "meters": [{"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}, {"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}]}], "pagination": {"total_count": 843077, "max_page": 721699}} + application/json: {"items": [{"created_at": "2023-01-03T00:35:12.592Z", "modified_at": "2023-02-04T21:40:45.220Z", "id": "", "amount": 678476, "currency": "Bahraini Dinar", "recurring_interval": "year", "status": "incomplete_expired", "current_period_start": "2025-01-25T11:12:42.694Z", "current_period_end": "2023-11-12T13:08:09.571Z", "cancel_at_period_end": true, "canceled_at": "2025-10-28T08:23:28.446Z", "started_at": "2024-01-04T03:39:38.578Z", "ends_at": "2024-09-23T17:15:31.139Z", "ended_at": "2024-04-21T13:12:27.764Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "other", "customer_cancellation_comment": "", "product": {"created_at": "2024-06-21T23:07:53.931Z", "modified_at": "2024-07-17T01:06:55.024Z", "id": "", "name": "", "description": "an when upwardly", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2023-01-03T00:35:12.592Z", "modified_at": "2023-02-04T21:40:45.220Z", "id": "", "amount_type": "fixed", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 944637, "legacy": true}], "benefits": [{"id": "", "created_at": "2024-12-28T06:49:52.968Z", "modified_at": "2025-12-13T05:34:39.641Z", "type": "discord", "description": "square back cuddly stack coop descent ick oil concrete give", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [], "organization": {"created_at": "2025-09-28T20:26:17.846Z", "modified_at": "2025-08-10T14:48:44.687Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://front-equal.com", "email": "Guido30@yahoo.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://clueless-midwife.net/"}, {"platform": "tiktok", "url": "https://clueless-midwife.net/"}], "details_submitted_at": "2025-12-03T13:10:55.375Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}, "notification_settings": {"new_order": true, "new_subscription": false}}}, "prices": [{"created_at": "2024-04-28T23:59:29.324Z", "modified_at": "2023-08-04T11:59:00.224Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-05-06T00:46:00.044Z", "modified_at": "2023-10-31T12:02:35.613Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 746007, "legacy": true}], "meters": [{"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}, {"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}]}, {"created_at": "2023-01-03T00:35:12.592Z", "modified_at": "2023-02-04T21:40:45.220Z", "id": "", "amount": 678476, "currency": "Bahraini Dinar", "recurring_interval": "year", "status": "incomplete_expired", "current_period_start": "2025-01-25T11:12:42.694Z", "current_period_end": "2023-11-12T13:08:09.571Z", "cancel_at_period_end": true, "canceled_at": "2025-10-28T08:23:28.446Z", "started_at": "2024-01-04T03:39:38.578Z", "ends_at": "2024-09-23T17:15:31.139Z", "ended_at": "2024-04-21T13:12:27.764Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "other", "customer_cancellation_comment": "", "product": {"created_at": "2024-06-21T23:07:53.931Z", "modified_at": "2024-07-17T01:06:55.024Z", "id": "", "name": "", "description": "an when upwardly", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2024-01-12T09:39:36.733Z", "modified_at": "2023-09-02T17:20:24.135Z", "id": "", "amount_type": "metered_unit", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": null, "price_currency": "", "unit_amount": "", "cap_amount": 655254, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [{"id": "", "created_at": "2024-12-28T06:49:52.968Z", "modified_at": "2025-12-13T05:34:39.641Z", "type": "discord", "description": "square back cuddly stack coop descent ick oil concrete give", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [], "organization": {"created_at": "2025-09-28T20:26:17.846Z", "modified_at": "2025-08-10T14:48:44.687Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://front-equal.com", "email": "Guido30@yahoo.com", "website": "", "socials": [{"platform": "tiktok", "url": "https://clueless-midwife.net/"}, {"platform": "tiktok", "url": "https://clueless-midwife.net/"}], "details_submitted_at": "2025-12-03T13:10:55.375Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}, "notification_settings": {"new_order": true, "new_subscription": false}}}, "prices": [{"created_at": "2023-08-23T16:58:58.285Z", "modified_at": "2023-06-20T17:27:13.322Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "price_amount": 850254, "legacy": true}, {"created_at": "2024-10-04T17:29:24.326Z", "modified_at": "2024-12-24T08:26:33.925Z", "id": "", "amount_type": "custom", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 886852, "maximum_amount": 660944, "preset_amount": null, "legacy": true}], "meters": [{"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}, {"created_at": "2025-05-02T07:49:21.214Z", "modified_at": "2023-02-10T02:24:08.500Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2025-02-01T06:30:45.854Z", "modified_at": "2025-08-13T09:16:38.863Z", "id": "", "name": ""}}]}], "pagination": {"total_count": 843077, "max_page": 721699}} "422": application/json: {} customer_portal:subscriptions:get: @@ -2964,7 +2946,7 @@ examples: id: "" responses: "200": - application/json: {"created_at": "2023-07-12T17:28:38.797Z", "modified_at": "2023-06-27T14:55:14.822Z", "id": "", "amount": 622988, "currency": "Cayman Islands Dollar", "recurring_interval": "month", "status": "past_due", "current_period_start": "2024-12-11T03:15:34.736Z", "current_period_end": "2025-04-27T11:18:42.852Z", "cancel_at_period_end": true, "canceled_at": "2024-01-29T06:39:34.276Z", "started_at": "2024-12-08T10:29:34.380Z", "ends_at": null, "ended_at": "2025-05-26T12:14:55.999Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "product": {"created_at": "2025-01-14T05:59:18.343Z", "modified_at": null, "id": "", "name": "", "description": "ew far-off whoever minus perfectly scared sunbathe uh-huh", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-11-30T13:12:22.913Z", "modified_at": "2023-04-11T08:58:03.008Z", "type": "custom", "description": "as below frozen oily beyond pomelo exactly ugh violin whoa", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2023-11-30T13:12:22.913Z", "modified_at": "2023-04-11T08:58:03.008Z", "type": "custom", "description": "as below frozen oily beyond pomelo exactly ugh violin whoa", "selectable": true, "deletable": true, "organization_id": ""}], "medias": [], "organization": {"created_at": "2023-01-09T04:27:19.997Z", "modified_at": "2025-06-19T15:44:52.777Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://alienated-ribbon.org", "email": null, "website": "", "socials": [], "details_submitted_at": "2024-07-08T20:03:06.421Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "prorate"}}}, "prices": [{"created_at": "2023-06-27T14:55:14.822Z", "modified_at": "2024-06-06T10:00:39.244Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-04-27T11:18:42.852Z", "modified_at": "2025-08-05T11:04:05.877Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 125071}, {"created_at": "2024-08-10T11:08:56.200Z", "modified_at": "2023-09-21T23:53:38.929Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": null, "price_currency": "", "minimum_amount": 684767, "maximum_amount": 130976, "preset_amount": null}], "meters": []} + application/json: {"created_at": "2023-07-12T17:28:38.797Z", "modified_at": "2023-06-27T14:55:14.822Z", "id": "", "amount": 622988, "currency": "Cayman Islands Dollar", "recurring_interval": "month", "status": "past_due", "current_period_start": "2024-12-11T03:15:34.736Z", "current_period_end": "2025-04-27T11:18:42.852Z", "cancel_at_period_end": true, "canceled_at": "2024-01-29T06:39:34.276Z", "started_at": "2024-12-08T10:29:34.380Z", "ends_at": null, "ended_at": "2025-05-26T12:14:55.999Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "low_quality", "customer_cancellation_comment": "", "product": {"created_at": "2025-01-14T05:59:18.343Z", "modified_at": null, "id": "", "name": "", "description": "ew far-off whoever minus perfectly scared sunbathe uh-huh", "recurring_interval": "year", "is_recurring": true, "is_archived": false, "organization_id": "", "prices": [], "benefits": [{"id": "", "created_at": "2023-11-30T13:12:22.913Z", "modified_at": "2023-04-11T08:58:03.008Z", "type": "custom", "description": "as below frozen oily beyond pomelo exactly ugh violin whoa", "selectable": true, "deletable": true, "organization_id": ""}, {"id": "", "created_at": "2023-11-30T13:12:22.913Z", "modified_at": "2023-04-11T08:58:03.008Z", "type": "custom", "description": "as below frozen oily beyond pomelo exactly ugh violin whoa", "selectable": true, "deletable": true, "organization_id": ""}], "medias": [], "organization": {"created_at": "2023-01-09T04:27:19.997Z", "modified_at": "2025-06-19T15:44:52.777Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://alienated-ribbon.org", "email": null, "website": "", "socials": [], "details_submitted_at": "2024-07-08T20:03:06.421Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "prorate"}, "notification_settings": {"new_order": true, "new_subscription": false}}}, "prices": [{"created_at": "2023-06-27T14:55:14.822Z", "modified_at": "2024-06-06T10:00:39.244Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-04-27T11:18:42.852Z", "modified_at": "2025-08-05T11:04:05.877Z", "id": "", "amount_type": "fixed", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "price_amount": 125071, "legacy": true}, {"created_at": "2024-08-10T11:08:56.200Z", "modified_at": "2023-09-21T23:53:38.929Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 684767, "maximum_amount": 130976, "preset_amount": null, "legacy": true}], "meters": []} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -2978,7 +2960,7 @@ examples: application/json: {} responses: "200": - application/json: {"created_at": "2025-02-02T12:28:03.145Z", "modified_at": "2025-08-15T14:46:08.118Z", "id": "", "amount": 189463, "currency": "Congolese Franc", "recurring_interval": "month", "status": "active", "current_period_start": "2025-04-10T15:02:11.907Z", "current_period_end": null, "cancel_at_period_end": false, "canceled_at": "2024-03-16T11:27:11.204Z", "started_at": "2025-10-09T15:39:35.938Z", "ends_at": "2023-05-18T04:03:20.458Z", "ended_at": "2023-06-12T13:50:06.969Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": "", "product": {"created_at": "2023-01-10T05:56:40.811Z", "modified_at": "2023-11-19T12:28:15.778Z", "id": "", "name": "", "description": "lest after until mantua colon dual tremendously well fairly", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/home", "mime_type": "", "size": 323960, "storage_version": null, "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-01-15T07:43:32.319Z", "size_readable": "", "public_url": "https://pitiful-cauliflower.com"}], "organization": {"created_at": "2024-01-05T08:15:54.903Z", "modified_at": "2023-05-06T23:49:18.498Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://taut-necklace.net/", "email": "Harry36@gmail.com", "website": "", "socials": [{"platform": "x", "url": "https://juicy-battle.name"}, {"platform": "x", "url": "https://juicy-battle.name"}], "details_submitted_at": "2025-04-03T22:03:23.380Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}}}, "prices": [{"created_at": "2024-05-05T11:52:58.589Z", "modified_at": "2023-07-27T15:38:08.165Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year"}, {"created_at": "2025-02-06T13:35:55.076Z", "modified_at": "2025-11-12T16:20:13.096Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "meters": []} + application/json: {"created_at": "2025-02-02T12:28:03.145Z", "modified_at": "2025-08-15T14:46:08.118Z", "id": "", "amount": 189463, "currency": "Congolese Franc", "recurring_interval": "month", "status": "active", "current_period_start": "2025-04-10T15:02:11.907Z", "current_period_end": null, "cancel_at_period_end": false, "canceled_at": "2024-03-16T11:27:11.204Z", "started_at": "2025-10-09T15:39:35.938Z", "ends_at": "2023-05-18T04:03:20.458Z", "ended_at": "2023-06-12T13:50:06.969Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "customer_service", "customer_cancellation_comment": "", "product": {"created_at": "2023-01-10T05:56:40.811Z", "modified_at": "2023-11-19T12:28:15.778Z", "id": "", "name": "", "description": "lest after until mantua colon dual tremendously well fairly", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": "", "prices": [], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/home", "mime_type": "", "size": 323960, "storage_version": null, "checksum_etag": "", "checksum_sha256_base64": null, "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": true, "created_at": "2024-01-15T07:43:32.319Z", "size_readable": "", "public_url": "https://pitiful-cauliflower.com"}], "organization": {"created_at": "2024-01-05T08:15:54.903Z", "modified_at": "2023-05-06T23:49:18.498Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://taut-necklace.net/", "email": "Harry36@gmail.com", "website": "", "socials": [{"platform": "x", "url": "https://juicy-battle.name"}, {"platform": "x", "url": "https://juicy-battle.name"}], "details_submitted_at": "2025-04-03T22:03:23.380Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": true, "proration_behavior": "invoice"}, "notification_settings": {"new_order": false, "new_subscription": false}}}, "prices": [{"created_at": "2024-05-05T11:52:58.589Z", "modified_at": "2023-07-27T15:38:08.165Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2025-02-06T13:35:55.076Z", "modified_at": "2025-11-12T16:20:13.096Z", "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}], "meters": []} "403": application/json: {"error": "AlreadyCanceledSubscription", "detail": ""} "404": @@ -2992,7 +2974,7 @@ examples: id: "" responses: "200": - application/json: {"created_at": "2023-03-14T00:34:28.136Z", "modified_at": "2025-03-22T12:28:05.757Z", "id": "", "amount": 725030, "currency": "Singapore Dollar", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-04-07T12:57:17.210Z", "current_period_end": "2025-10-10T15:35:40.020Z", "cancel_at_period_end": true, "canceled_at": null, "started_at": "2023-04-12T10:07:43.423Z", "ends_at": "2025-04-12T20:30:15.370Z", "ended_at": "2023-12-08T22:19:01.857Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "too_complex", "customer_cancellation_comment": "", "product": {"created_at": "2025-10-08T08:23:23.829Z", "modified_at": "2025-05-19T19:23:05.590Z", "id": "", "name": "", "description": "once yuck how inasmuch pish but more webbed", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-03-22T12:28:05.757Z", "modified_at": "2025-04-16T15:43:34.874Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 948870, "maximum_amount": 383437, "preset_amount": null, "legacy": true}, {"created_at": "2025-09-28T07:43:04.431Z", "modified_at": "2023-06-14T21:44:38.981Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "month", "price_currency": "", "minimum_amount": 920948, "maximum_amount": 928517, "preset_amount": 351570}], "benefits": [{"id": "", "created_at": "2023-04-07T10:08:15.900Z", "modified_at": "2024-08-29T05:11:58.842Z", "type": "license_keys", "description": "when regarding woot mockingly um greatly sturdy incidentally accept save", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr", "mime_type": "", "size": 188787, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-05-25T08:19:44.256Z", "size_readable": "", "public_url": "https://direct-recovery.info"}, {"id": "", "organization_id": "", "name": "", "path": "/usr", "mime_type": "", "size": 188787, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-05-25T08:19:44.256Z", "size_readable": "", "public_url": "https://direct-recovery.info"}, {"id": "", "organization_id": "", "name": "", "path": "/usr", "mime_type": "", "size": 188787, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-05-25T08:19:44.256Z", "size_readable": "", "public_url": "https://direct-recovery.info"}], "organization": {"created_at": "2023-03-23T07:37:57.258Z", "modified_at": "2024-09-08T02:10:05.056Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://urban-account.info/", "email": "Christian48@yahoo.com", "website": null, "socials": [{"platform": "youtube", "url": "https://educated-newsprint.org"}], "details_submitted_at": "2025-02-20T06:16:29.529Z", "feature_settings": null, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}}}, "prices": [{"created_at": "2025-11-16T11:22:00.864Z", "modified_at": "2025-05-23T05:24:01.371Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "one_time", "recurring_interval": "year"}, {"created_at": "2024-08-30T20:56:44.463Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "meters": [{"created_at": "2025-08-20T07:04:02.136Z", "modified_at": "2025-09-17T00:16:23.454Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2023-04-12T05:19:54.807Z", "modified_at": "2024-07-24T15:24:05.776Z", "id": "", "name": ""}}, {"created_at": "2025-08-20T07:04:02.136Z", "modified_at": "2025-09-17T00:16:23.454Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2023-04-12T05:19:54.807Z", "modified_at": "2024-07-24T15:24:05.776Z", "id": "", "name": ""}}]} + application/json: {"created_at": "2023-03-14T00:34:28.136Z", "modified_at": "2025-03-22T12:28:05.757Z", "id": "", "amount": 725030, "currency": "Singapore Dollar", "recurring_interval": "month", "status": "canceled", "current_period_start": "2024-04-07T12:57:17.210Z", "current_period_end": "2025-10-10T15:35:40.020Z", "cancel_at_period_end": true, "canceled_at": null, "started_at": "2023-04-12T10:07:43.423Z", "ends_at": "2025-04-12T20:30:15.370Z", "ended_at": "2023-12-08T22:19:01.857Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "too_complex", "customer_cancellation_comment": "", "product": {"created_at": "2025-10-08T08:23:23.829Z", "modified_at": "2025-05-19T19:23:05.590Z", "id": "", "name": "", "description": "once yuck how inasmuch pish but more webbed", "recurring_interval": "month", "is_recurring": false, "is_archived": false, "organization_id": "", "prices": [{"created_at": "2025-03-22T12:28:05.757Z", "modified_at": "2025-04-16T15:43:34.874Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "minimum_amount": 948870, "maximum_amount": 383437, "preset_amount": null, "legacy": true}, {"created_at": "2025-09-28T07:43:04.431Z", "modified_at": "2023-06-14T21:44:38.981Z", "id": "", "amount_type": "custom", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "month", "price_currency": "", "minimum_amount": 920948, "maximum_amount": 928517, "preset_amount": 351570, "legacy": true}], "benefits": [{"id": "", "created_at": "2023-04-07T10:08:15.900Z", "modified_at": "2024-08-29T05:11:58.842Z", "type": "license_keys", "description": "when regarding woot mockingly um greatly sturdy incidentally accept save", "selectable": false, "deletable": false, "organization_id": ""}], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/usr", "mime_type": "", "size": 188787, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-05-25T08:19:44.256Z", "size_readable": "", "public_url": "https://direct-recovery.info"}, {"id": "", "organization_id": "", "name": "", "path": "/usr", "mime_type": "", "size": 188787, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-05-25T08:19:44.256Z", "size_readable": "", "public_url": "https://direct-recovery.info"}, {"id": "", "organization_id": "", "name": "", "path": "/usr", "mime_type": "", "size": 188787, "storage_version": "", "checksum_etag": "", "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": null, "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2025-05-25T08:19:44.256Z", "size_readable": "", "public_url": "https://direct-recovery.info"}], "organization": {"created_at": "2023-03-23T07:37:57.258Z", "modified_at": "2024-09-08T02:10:05.056Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://urban-account.info/", "email": "Christian48@yahoo.com", "website": null, "socials": [{"platform": "youtube", "url": "https://educated-newsprint.org"}], "details_submitted_at": "2025-02-20T06:16:29.529Z", "feature_settings": null, "subscription_settings": {"allow_multiple_subscriptions": false, "allow_customer_updates": false, "proration_behavior": "invoice"}, "notification_settings": {"new_order": true, "new_subscription": true}}}, "prices": [{"created_at": "2025-11-16T11:22:00.864Z", "modified_at": "2025-05-23T05:24:01.371Z", "id": "", "amount_type": "free", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "legacy": true}, {"created_at": "2024-08-30T20:56:44.463Z", "modified_at": null, "id": "", "amount_type": "free", "is_archived": false, "product_id": "", "type": "recurring", "recurring_interval": "month", "legacy": true}], "meters": [{"created_at": "2025-08-20T07:04:02.136Z", "modified_at": "2025-09-17T00:16:23.454Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2023-04-12T05:19:54.807Z", "modified_at": "2024-07-24T15:24:05.776Z", "id": "", "name": ""}}, {"created_at": "2025-08-20T07:04:02.136Z", "modified_at": "2025-09-17T00:16:23.454Z", "id": "", "consumed_units": 25, "credited_units": 100, "amount": 0, "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "meter": {"created_at": "2023-04-12T05:19:54.807Z", "modified_at": "2024-07-24T15:24:05.776Z", "id": "", "name": ""}}]} "403": application/json: {"error": "AlreadyCanceledSubscription", "detail": ""} "404": @@ -3005,7 +2987,7 @@ examples: application/json: {"external_customer_id": ""} responses: "201": - application/json: {"created_at": "2023-02-22T22:32:12.329Z", "modified_at": null, "id": "", "token": "", "expires_at": "2024-09-04T03:25:26.472Z", "customer_portal_url": "https://neglected-bran.biz/", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-03-20T12:56:34.812Z", "modified_at": "2023-06-08T03:20:06.999Z", "metadata": {"key": "", "key1": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-05-17T10:27:59.444Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}} + application/json: {"created_at": "2023-02-22T22:32:12.329Z", "modified_at": null, "id": "", "token": "", "expires_at": "2024-09-04T03:25:26.472Z", "customer_portal_url": "https://neglected-bran.biz/", "customer_id": "", "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2023-03-20T12:56:34.812Z", "modified_at": "2023-06-08T03:20:06.999Z", "metadata": {"key": "", "key1": ""}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-05-17T10:27:59.444Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}} "422": application/json: {} events:list: @@ -3135,7 +3117,7 @@ examples: id: "" responses: "200": - application/json: {"id": "", "created_at": "2024-09-06T08:13:35.629Z", "modified_at": "2025-01-26T12:35:40.613Z", "customer_id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-11-21T12:36:06.043Z", "modified_at": "2023-01-08T00:36:33.258Z", "metadata": {"key": 849823, "key1": 1949.8}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-03-31T00:02:44.998Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "meter": {"metadata": {}, "created_at": "2024-09-14T02:49:06.821Z", "modified_at": "2023-05-03T01:11:41.641Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}, {"conjunction": "or", "clauses": []}, {"property": "", "operator": "ne", "value": ""}]}, "aggregation": {"func": "sum", "property": ""}, "organization_id": ""}} + application/json: {"id": "", "created_at": "2024-09-06T08:13:35.629Z", "modified_at": "2025-01-26T12:35:40.613Z", "customer_id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "meter_id": "d498a884-e2cd-4d3e-8002-f536468a8b22", "consumed_units": 25, "credited_units": 100, "balance": 75, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2024-11-21T12:36:06.043Z", "modified_at": "2023-01-08T00:36:33.258Z", "metadata": {"key": 849823, "key1": 1949.8}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2025-03-31T00:02:44.998Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "meter": {"metadata": {}, "created_at": "2024-09-14T02:49:06.821Z", "modified_at": "2023-05-03T01:11:41.641Z", "id": "", "name": "", "filter": {"conjunction": "or", "clauses": [{"conjunction": "or", "clauses": []}, {"conjunction": "or", "clauses": []}, {"property": "", "operator": "ne", "value": ""}]}, "aggregation": {"func": "sum", "property": ""}, "organization_id": ""}} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -3173,7 +3155,7 @@ examples: application/json: {"billing_name": "", "billing_address": {"country": "US"}} responses: "200": - application/json: {"id": "", "created_at": "2023-07-07T02:27:33.933Z", "modified_at": "2025-12-06T08:14:38.290Z", "status": "pending", "paid": true, "subtotal_amount": 666528, "discount_amount": 690049, "net_amount": 679795, "amount": 384624, "tax_amount": 307125, "total_amount": 717730, "refunded_amount": 731967, "refunded_tax_amount": 29529, "currency": "Sri Lanka Rupee", "billing_reason": "subscription_update", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-05-10T23:50:32.891Z", "modified_at": "2023-02-18T10:28:10.963Z", "metadata": {"key": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-09-27T12:39:54.419Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=blank"}, "user_id": "", "product": {"metadata": {"key": 364993, "key1": true, "key2": true}, "created_at": "2023-04-12T21:30:23.720Z", "modified_at": "2025-07-30T06:39:42.272Z", "id": "", "name": "", "description": "yippee amid wire knowingly an er reproachfully mechanically who gym", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "repeating", "duration_in_months": 919384, "type": "fixed", "basis_points": 485397, "created_at": "2023-04-20T01:15:36.927Z", "modified_at": "2025-08-12T14:50:46.554Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2023-06-20T13:39:02.935Z", "ends_at": "2024-06-17T01:44:44.306Z", "max_redemptions": 991144, "redemptions_count": 882356, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {"key": true, "key1": false}, "created_at": "2025-05-14T12:37:49.790Z", "modified_at": "2023-07-19T20:08:36.520Z", "id": "", "amount": 328171, "currency": "Rand", "recurring_interval": "month", "status": "incomplete", "current_period_start": "2025-06-29T04:23:47.957Z", "current_period_end": "2024-06-02T02:08:37.593Z", "cancel_at_period_end": true, "canceled_at": "2024-06-26T07:14:15.241Z", "started_at": "2025-06-03T07:15:00.193Z", "ends_at": "2023-09-17T15:31:40.614Z", "ended_at": "2024-06-15T15:33:26.067Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "unused", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-11-07T03:04:15.446Z", "modified_at": "2024-02-25T04:48:42.731Z", "id": "", "label": "", "amount": 527788, "tax_amount": 941221, "proration": true, "product_price_id": ""}, {"created_at": "2025-11-07T03:04:15.446Z", "modified_at": "2024-02-25T04:48:42.731Z", "id": "", "label": "", "amount": 527788, "tax_amount": 941221, "proration": true, "product_price_id": ""}, {"created_at": "2025-11-07T03:04:15.446Z", "modified_at": "2024-02-25T04:48:42.731Z", "id": "", "label": "", "amount": 527788, "tax_amount": 941221, "proration": true, "product_price_id": ""}]} + application/json: {"id": "", "created_at": "2023-07-07T02:27:33.933Z", "modified_at": "2025-12-06T08:14:38.290Z", "status": "pending", "paid": true, "subtotal_amount": 666528, "discount_amount": 690049, "net_amount": 679795, "amount": 384624, "tax_amount": 307125, "total_amount": 717730, "refunded_amount": 731967, "refunded_tax_amount": 29529, "currency": "Sri Lanka Rupee", "billing_reason": "subscription_update", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "metadata": {}, "customer": {"id": "992fae2a-2a17-4b7a-8d9e-e287cf90131b", "created_at": "2025-05-10T23:50:32.891Z", "modified_at": "2023-02-18T10:28:10.963Z", "metadata": {"key": false}, "external_id": "usr_1337", "email": "customer@example.com", "email_verified": true, "name": "John Doe", "billing_address": {"country": "US"}, "tax_id": ["911144442", "us_ein"], "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "deleted_at": "2023-09-27T12:39:54.419Z", "avatar_url": "https://www.gravatar.com/avatar/xxx?d=404"}, "user_id": "", "product": {"metadata": {"key": 364993, "key1": true, "key2": true}, "created_at": "2023-04-12T21:30:23.720Z", "modified_at": "2025-07-30T06:39:42.272Z", "id": "", "name": "", "description": "yippee amid wire knowingly an er reproachfully mechanically who gym", "recurring_interval": "month", "is_recurring": true, "is_archived": true, "organization_id": ""}, "discount": {"duration": "repeating", "duration_in_months": 919384, "type": "fixed", "basis_points": 485397, "created_at": "2023-04-20T01:15:36.927Z", "modified_at": "2025-08-12T14:50:46.554Z", "id": "", "metadata": {}, "name": "", "code": "", "starts_at": "2023-06-20T13:39:02.935Z", "ends_at": "2024-06-17T01:44:44.306Z", "max_redemptions": 991144, "redemptions_count": 882356, "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"}, "subscription": {"metadata": {"key": true, "key1": false}, "created_at": "2025-05-14T12:37:49.790Z", "modified_at": "2023-07-19T20:08:36.520Z", "id": "", "amount": 328171, "currency": "Rand", "recurring_interval": "month", "status": "incomplete", "current_period_start": "2025-06-29T04:23:47.957Z", "current_period_end": "2024-06-02T02:08:37.593Z", "cancel_at_period_end": true, "canceled_at": "2024-06-26T07:14:15.241Z", "started_at": "2025-06-03T07:15:00.193Z", "ends_at": "2023-09-17T15:31:40.614Z", "ended_at": "2024-06-15T15:33:26.067Z", "customer_id": "", "product_id": "", "discount_id": "", "checkout_id": "", "customer_cancellation_reason": "unused", "customer_cancellation_comment": ""}, "items": [{"created_at": "2025-11-07T03:04:15.446Z", "modified_at": "2024-02-25T04:48:42.731Z", "id": "", "label": "", "amount": 527788, "tax_amount": 941221, "proration": true, "product_price_id": ""}, {"created_at": "2025-11-07T03:04:15.446Z", "modified_at": "2024-02-25T04:48:42.731Z", "id": "", "label": "", "amount": 527788, "tax_amount": 941221, "proration": true, "product_price_id": ""}, {"created_at": "2025-11-07T03:04:15.446Z", "modified_at": "2024-02-25T04:48:42.731Z", "id": "", "label": "", "amount": 527788, "tax_amount": 941221, "proration": true, "product_price_id": ""}]} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -3199,7 +3181,7 @@ examples: application/json: {"billing_name": "", "billing_address": {"country": "US"}} responses: "200": - application/json: {"id": "", "created_at": "2025-06-18T23:40:50.214Z", "modified_at": "2023-01-14T22:55:27.186Z", "status": "paid", "paid": true, "subtotal_amount": 779370, "discount_amount": 293701, "net_amount": 728297, "amount": 736066, "tax_amount": 459195, "total_amount": 683124, "refunded_amount": 579814, "refunded_tax_amount": 755690, "currency": "Cape Verde Escudo", "billing_reason": "purchase", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2024-02-03T21:16:03.609Z", "modified_at": null, "id": "", "name": "", "description": "gee present next brief till or", "recurring_interval": "year", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-06-18T23:40:50.214Z", "modified_at": "2023-01-14T22:55:27.186Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 459195, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/yp", "mime_type": "", "size": 245978, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-02T01:31:39.639Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2024-04-27T06:51:48.796Z", "size_readable": "", "public_url": "https://monthly-concentration.com"}], "organization": {"created_at": "2024-05-09T04:05:31.223Z", "modified_at": "2025-07-23T21:23:51.247Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://finished-language.org/", "email": "Junior80@hotmail.com", "website": "", "socials": [], "details_submitted_at": "2023-09-01T22:21:18.571Z", "feature_settings": {"issue_funding_enabled": false, "usage_based_billing_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "invoice"}}}, "subscription": {"created_at": "2025-08-10T03:04:21.532Z", "modified_at": "2024-08-23T05:41:16.519Z", "id": "", "amount": 210189, "currency": "Algerian Dinar", "recurring_interval": "month", "status": "incomplete_expired", "current_period_start": "2024-07-27T23:16:23.597Z", "current_period_end": "2025-01-04T16:08:44.590Z", "cancel_at_period_end": true, "canceled_at": "2025-03-10T21:35:49.211Z", "started_at": "2023-10-24T00:47:38.683Z", "ends_at": "2024-08-10T21:46:10.059Z", "ended_at": "2023-10-02T07:02:51.789Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "too_complex", "customer_cancellation_comment": ""}, "items": [{"created_at": "2024-10-06T01:05:33.969Z", "modified_at": "2024-09-29T23:53:44.892Z", "id": "", "label": "", "amount": 924277, "tax_amount": 651911, "proration": false, "product_price_id": ""}, {"created_at": "2024-10-06T01:05:33.969Z", "modified_at": "2024-09-29T23:53:44.892Z", "id": "", "label": "", "amount": 924277, "tax_amount": 651911, "proration": false, "product_price_id": ""}, {"created_at": "2024-10-06T01:05:33.969Z", "modified_at": "2024-09-29T23:53:44.892Z", "id": "", "label": "", "amount": 924277, "tax_amount": 651911, "proration": false, "product_price_id": ""}]} + application/json: {"id": "", "created_at": "2025-06-18T23:40:50.214Z", "modified_at": "2023-01-14T22:55:27.186Z", "status": "paid", "paid": true, "subtotal_amount": 779370, "discount_amount": 293701, "net_amount": 728297, "amount": 736066, "tax_amount": 459195, "total_amount": 683124, "refunded_amount": 579814, "refunded_tax_amount": 755690, "currency": "Cape Verde Escudo", "billing_reason": "purchase", "billing_name": "", "billing_address": {"country": "US"}, "is_invoice_generated": true, "customer_id": "", "product_id": "", "discount_id": "", "subscription_id": "", "checkout_id": "", "user_id": "", "product": {"created_at": "2024-02-03T21:16:03.609Z", "modified_at": null, "id": "", "name": "", "description": "gee present next brief till or", "recurring_interval": "year", "is_recurring": false, "is_archived": true, "organization_id": "", "prices": [{"created_at": "2025-06-18T23:40:50.214Z", "modified_at": "2023-01-14T22:55:27.186Z", "id": "", "amount_type": "metered_unit", "is_archived": true, "product_id": "", "type": "recurring", "recurring_interval": "year", "price_currency": "", "unit_amount": "", "cap_amount": 459195, "meter_id": "", "meter": {"id": "", "name": ""}}], "benefits": [], "medias": [{"id": "", "organization_id": "", "name": "", "path": "/var/yp", "mime_type": "", "size": 245978, "storage_version": "", "checksum_etag": null, "checksum_sha256_base64": "", "checksum_sha256_hex": "", "last_modified_at": "2025-09-02T01:31:39.639Z", "version": "", "service": "product_media", "is_uploaded": false, "created_at": "2024-04-27T06:51:48.796Z", "size_readable": "", "public_url": "https://monthly-concentration.com"}], "organization": {"created_at": "2024-05-09T04:05:31.223Z", "modified_at": "2025-07-23T21:23:51.247Z", "id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737", "name": "", "slug": "", "avatar_url": "https://finished-language.org/", "email": "Junior80@hotmail.com", "website": "", "socials": [], "details_submitted_at": "2023-09-01T22:21:18.571Z", "feature_settings": {"issue_funding_enabled": false}, "subscription_settings": {"allow_multiple_subscriptions": true, "allow_customer_updates": false, "proration_behavior": "invoice"}, "notification_settings": {"new_order": false, "new_subscription": false}}}, "subscription": {"created_at": "2025-08-10T03:04:21.532Z", "modified_at": "2024-08-23T05:41:16.519Z", "id": "", "amount": 210189, "currency": "Algerian Dinar", "recurring_interval": "month", "status": "incomplete_expired", "current_period_start": "2024-07-27T23:16:23.597Z", "current_period_end": "2025-01-04T16:08:44.590Z", "cancel_at_period_end": true, "canceled_at": "2025-03-10T21:35:49.211Z", "started_at": "2023-10-24T00:47:38.683Z", "ends_at": "2024-08-10T21:46:10.059Z", "ended_at": "2023-10-02T07:02:51.789Z", "customer_id": "", "product_id": "", "discount_id": null, "checkout_id": "", "customer_cancellation_reason": "too_complex", "customer_cancellation_comment": ""}, "items": [{"created_at": "2024-10-06T01:05:33.969Z", "modified_at": "2024-09-29T23:53:44.892Z", "id": "", "label": "", "amount": 924277, "tax_amount": 651911, "proration": false, "product_price_id": ""}, {"created_at": "2024-10-06T01:05:33.969Z", "modified_at": "2024-09-29T23:53:44.892Z", "id": "", "label": "", "amount": 924277, "tax_amount": 651911, "proration": false, "product_price_id": ""}, {"created_at": "2024-10-06T01:05:33.969Z", "modified_at": "2024-09-29T23:53:44.892Z", "id": "", "label": "", "amount": 924277, "tax_amount": 651911, "proration": false, "product_price_id": ""}]} "404": application/json: {"error": "ResourceNotFound", "detail": ""} "422": @@ -3296,5 +3278,16 @@ examples: application/json: {"error": "ResourceNotFound", "detail": ""} "422": application/json: {} + customer_portal:customers:list_payment_methods: + speakeasy-default-customer-portal:customers:list-payment-methods: + parameters: + query: + page: 1 + limit: 10 + responses: + "200": + application/json: {"items": [{"id": "", "created_at": "2024-05-30T20:57:40.238Z", "modified_at": "2024-08-27T22:17:32.042Z", "processor": "stripe", "customer_id": "", "type": ""}], "pagination": {"total_count": 429718, "max_page": 448702}} + "422": + application/json: {} examplesVersion: 1.0.2 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 8b0fe533..64b0f219 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -19,8 +19,12 @@ generation: auth: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false + tests: + generateTests: true + generateNewTests: false + skipResponseBodyAssertions: false python: - version: 0.22.1 + version: 0.22.2 additionalDependencies: dev: pydantic-ai-slim: ^0.1.0 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 7f4a7048..7385b33d 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,21 +1,21 @@ -speakeasyVersion: 1.567.1 +speakeasyVersion: 1.581.2 sources: Polar-OAS: sourceNamespace: polar-oas - sourceRevisionDigest: sha256:896b0098165ce84eb8a955202412c61eabdfad0330c0b211b5560754faa9c819 - sourceBlobDigest: sha256:d8b25963e07c3aed89cf253001044af257ac0ebeaffd44140c1b68ce369d9dd9 + sourceRevisionDigest: sha256:9e4f29b476148b87dbcbc39c978d6d860e8a025f5ceb2380aed27feab0e7d176 + sourceBlobDigest: sha256:c1808c03b5c463281affcfcd41c77346f92cd1c4faa37fe2c66d98ed30b2bc6e tags: - latest - - speakeasy-sdk-regen-1750333050 + - speakeasy-sdk-regen-1751328994 - 0.1.0 targets: polar: source: Polar-OAS sourceNamespace: polar-oas - sourceRevisionDigest: sha256:896b0098165ce84eb8a955202412c61eabdfad0330c0b211b5560754faa9c819 - sourceBlobDigest: sha256:d8b25963e07c3aed89cf253001044af257ac0ebeaffd44140c1b68ce369d9dd9 + sourceRevisionDigest: sha256:9e4f29b476148b87dbcbc39c978d6d860e8a025f5ceb2380aed27feab0e7d176 + sourceBlobDigest: sha256:c1808c03b5c463281affcfcd41c77346f92cd1c4faa37fe2c66d98ed30b2bc6e codeSamplesNamespace: polar-oas-py-code-samples - codeSamplesRevisionDigest: sha256:a414ca51ed9d849d7bb9099db0526f458f46577aadcda15d3de36b8ebd98a261 + codeSamplesRevisionDigest: sha256:0ad7ed5ff862d6d0a8582eddde5c7b0213e1b5e35d494cf0f7f4d04e4081aaf7 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -28,6 +28,7 @@ workflow: - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/type_parameter.yml - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/read_only.yml - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/event_discriminator.yml + - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/timezone_enum.yml registry: location: registry.speakeasyapi.dev/polar/polar/polar-oas targets: diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 9cf7c052..b10b81d1 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -1,27 +1,27 @@ workflowVersion: 1.0.0 speakeasyVersion: latest sources: - Polar-OAS: - inputs: - - location: https://api.polar.sh/openapi.json - overlays: - - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/security.yml - - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/type_parameter.yml - - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/read_only.yml - - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/event_discriminator.yml - - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/timezone_enum.yml - registry: - location: registry.speakeasyapi.dev/polar/polar/polar-oas + Polar-OAS: + inputs: + - location: https://api.polar.sh/openapi.json + overlays: + - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/security.yml + - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/type_parameter.yml + - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/read_only.yml + - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/event_discriminator.yml + - location: https://raw.githubusercontent.com/polarsource/polar/main/sdk/overlays/timezone_enum.yml + registry: + location: registry.speakeasyapi.dev/polar/polar/polar-oas targets: - polar: - target: python - source: Polar-OAS - publish: - pypi: - token: $pypi_token - codeSamples: - output: codeSamples.yaml - registry: - location: registry.speakeasyapi.dev/polar/polar/polar-oas-py-code-samples - labelOverride: - fixedValue: Python (SDK) + polar: + target: python + source: Polar-OAS + publish: + pypi: + token: $pypi_token + codeSamples: + output: codeSamples.yaml + registry: + location: registry.speakeasyapi.dev/polar/polar/polar-oas-py-code-samples + labelOverride: + fixedValue: Python (SDK) diff --git a/README.md b/README.md index 3258575c..161df9de 100644 --- a/README.md +++ b/README.md @@ -155,13 +155,13 @@ with Polar() as polar: "key1": "", "key2": "", }, - customer_billing_address_fields=polar_sdk.CheckoutCustomerBillingAddressFields( - country=True, - state=False, - city=False, - postal_code=True, - line1=True, - line2=False, + billing_address_fields=polar_sdk.CheckoutBillingAddressFields( + country=polar_sdk.BillingAddressFieldMode.REQUIRED, + state=polar_sdk.BillingAddressFieldMode.DISABLED, + city=polar_sdk.BillingAddressFieldMode.REQUIRED, + postal_code=polar_sdk.BillingAddressFieldMode.REQUIRED, + line1=polar_sdk.BillingAddressFieldMode.REQUIRED, + line2=polar_sdk.BillingAddressFieldMode.DISABLED, ), metadata={ "key": False, @@ -181,7 +181,14 @@ with Polar() as polar: is_archived=True, organization_id="", prices=[ - polar_sdk.LegacyRecurringProductPriceFree(), + polar_sdk.LegacyRecurringProductPriceFree( + created_at=parse_datetime("2023-09-13T08:36:46.434Z"), + modified_at=parse_datetime("2023-10-05T12:55:46.428Z"), + id="", + is_archived=False, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH, + ), ], benefits=[], medias=[ @@ -253,9 +260,36 @@ with Polar() as polar: is_archived=False, organization_id="", prices=[ - polar_sdk.LegacyRecurringProductPriceCustom(), - polar_sdk.LegacyRecurringProductPriceCustom(), - polar_sdk.ProductPriceMeteredUnit(), + polar_sdk.LegacyRecurringProductPriceFixed( + created_at=parse_datetime("2024-05-02T18:25:33.974Z"), + modified_at=parse_datetime("2025-02-06T12:55:07.640Z"), + id="", + is_archived=False, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH, + price_currency="", + price_amount=115799, + ), + polar_sdk.LegacyRecurringProductPriceCustom( + created_at=parse_datetime("2025-07-31T12:54:47.590Z"), + modified_at=parse_datetime("2023-01-11T22:31:47.320Z"), + id="", + is_archived=True, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH, + price_currency="", + minimum_amount=203013, + maximum_amount=None, + preset_amount=119260, + ), + polar_sdk.LegacyRecurringProductPriceFree( + created_at=parse_datetime("2024-04-06T18:48:21.449Z"), + modified_at=None, + id="", + is_archived=True, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR, + ), ], benefits=[ polar_sdk.BenefitPublic( @@ -281,7 +315,16 @@ with Polar() as polar: ], medias=[], ), - product_price=polar_sdk.ProductPriceMeteredUnit(), + product_price=polar_sdk.LegacyRecurringProductPriceFixed( + created_at=parse_datetime("2024-08-14T23:26:30.929Z"), + modified_at=parse_datetime("2025-01-15T11:59:21.523Z"), + id="", + is_archived=False, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR, + price_currency="", + price_amount=499786, + ), discount=polar_sdk.CheckoutDiscountPercentageRepeatDuration( duration=polar_sdk.DiscountDuration.REPEATING, duration_in_months=470604, @@ -397,13 +440,13 @@ async def main(): "key1": "", "key2": "", }, - customer_billing_address_fields=polar_sdk.CheckoutCustomerBillingAddressFields( - country=True, - state=False, - city=False, - postal_code=True, - line1=True, - line2=False, + billing_address_fields=polar_sdk.CheckoutBillingAddressFields( + country=polar_sdk.BillingAddressFieldMode.REQUIRED, + state=polar_sdk.BillingAddressFieldMode.DISABLED, + city=polar_sdk.BillingAddressFieldMode.REQUIRED, + postal_code=polar_sdk.BillingAddressFieldMode.REQUIRED, + line1=polar_sdk.BillingAddressFieldMode.REQUIRED, + line2=polar_sdk.BillingAddressFieldMode.DISABLED, ), metadata={ "key": False, @@ -423,7 +466,14 @@ async def main(): is_archived=True, organization_id="", prices=[ - polar_sdk.LegacyRecurringProductPriceFree(), + polar_sdk.LegacyRecurringProductPriceFree( + created_at=parse_datetime("2023-09-13T08:36:46.434Z"), + modified_at=parse_datetime("2023-10-05T12:55:46.428Z"), + id="", + is_archived=False, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH, + ), ], benefits=[], medias=[ @@ -495,9 +545,36 @@ async def main(): is_archived=False, organization_id="", prices=[ - polar_sdk.ProductPriceFixed(), - polar_sdk.ProductPriceMeteredUnit(), - polar_sdk.ProductPriceCustom(), + polar_sdk.LegacyRecurringProductPriceFixed( + created_at=parse_datetime("2024-05-02T18:25:33.974Z"), + modified_at=parse_datetime("2025-02-06T12:55:07.640Z"), + id="", + is_archived=False, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH, + price_currency="", + price_amount=115799, + ), + polar_sdk.LegacyRecurringProductPriceCustom( + created_at=parse_datetime("2025-07-31T12:54:47.590Z"), + modified_at=parse_datetime("2023-01-11T22:31:47.320Z"), + id="", + is_archived=True, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH, + price_currency="", + minimum_amount=203013, + maximum_amount=None, + preset_amount=119260, + ), + polar_sdk.LegacyRecurringProductPriceFree( + created_at=parse_datetime("2024-04-06T18:48:21.449Z"), + modified_at=None, + id="", + is_archived=True, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR, + ), ], benefits=[ polar_sdk.BenefitPublic( @@ -523,7 +600,16 @@ async def main(): ], medias=[], ), - product_price=polar_sdk.LegacyRecurringProductPriceFixed(), + product_price=polar_sdk.LegacyRecurringProductPriceFixed( + created_at=parse_datetime("2024-08-14T23:26:30.929Z"), + modified_at=parse_datetime("2025-01-15T11:59:21.523Z"), + id="", + is_archived=False, + product_id="", + recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR, + price_currency="", + price_amount=499786, + ), discount=polar_sdk.CheckoutDiscountPercentageRepeatDuration( duration=polar_sdk.DiscountDuration.REPEATING, duration_in_months=470604, @@ -675,14 +761,13 @@ def webhook(): * [get](docs/sdks/polarcustomers/README.md#get) - Get Customer * [update](docs/sdks/polarcustomers/README.md#update) - Update Customer -* [get_payment_methods](docs/sdks/polarcustomers/README.md#get_payment_methods) - Get Customer Payment Methods +* [list_payment_methods](docs/sdks/polarcustomers/README.md#list_payment_methods) - List Customer Payment Methods * [add_payment_method](docs/sdks/polarcustomers/README.md#add_payment_method) - Add Customer Payment Method * [delete_payment_method](docs/sdks/polarcustomers/README.md#delete_payment_method) - Delete Customer Payment Method #### [customer_portal.downloadables](docs/sdks/downloadables/README.md) * [list](docs/sdks/downloadables/README.md#list) - List Downloadables -* [get](docs/sdks/downloadables/README.md#get) - Get Downloadable #### [customer_portal.license_keys](docs/sdks/polarlicensekeys/README.md) @@ -779,14 +864,6 @@ def webhook(): * [introspect](docs/sdks/oauth2/README.md#introspect) - Introspect Token * [userinfo](docs/sdks/oauth2/README.md#userinfo) - Get User Info -#### [oauth2.clients](docs/sdks/clients/README.md) - -* [list](docs/sdks/clients/README.md#list) - List Clients -* [create](docs/sdks/clients/README.md#create) - Create Client -* [get](docs/sdks/clients/README.md#get) - Get Client -* [update](docs/sdks/clients/README.md#update) - Update Client -* [delete](docs/sdks/clients/README.md#delete) - Delete Client - ### [orders](docs/sdks/orders/README.md) * [list](docs/sdks/orders/README.md#list) - List Orders @@ -891,27 +968,20 @@ with Polar( ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. - -By default, an API error will raise a models.SDKError exception, which has the following properties: - -| Property | Type | Description | -|-----------------|------------------|-----------------------| -| `.status_code` | *int* | The HTTP status code | -| `.message` | *str* | The error message | -| `.raw_response` | *httpx.Response* | The raw HTTP response | -| `.body` | *str* | The response content | +[`PolarError`](./src/polar_sdk/models/polarerror.py) is the base class for all HTTP error responses. It has the following properties: -When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list_async` method may raise the following exceptions: - -| Error Type | Status Code | Content Type | -| -------------------------- | ----------- | ---------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | +| Property | Type | Description | +| ------------------ | ---------------- | --------------------------------------------------------------------------------------- | +| `err.message` | `str` | Error message | +| `err.status_code` | `int` | HTTP response status code eg `404` | +| `err.headers` | `httpx.Headers` | HTTP response headers | +| `err.body` | `str` | HTTP body. Can be empty string if no body is returned. | +| `err.raw_response` | `httpx.Response` | Raw HTTP response | +| `err.data` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). | ### Example - ```python +import polar_sdk from polar_sdk import Polar, models @@ -928,13 +998,54 @@ with Polar( res = res.next() - except models.HTTPValidationError as e: - # handle e.data: models.HTTPValidationErrorData - raise(e) - except models.SDKError as e: - # handle exception - raise(e) + + except models.PolarError as e: + # The base class for HTTP error responses + print(e.message) + print(e.status_code) + print(e.body) + print(e.headers) + print(e.raw_response) + + # Depending on the method different errors may be thrown + if isinstance(e, models.HTTPValidationError): + print(e.data.detail) # Optional[List[polar_sdk.ValidationError]] ``` + +### Error Classes +**Primary errors:** +* [`PolarError`](./src/polar_sdk/models/polarerror.py): The base class for HTTP error responses. + * [`HTTPValidationError`](./src/polar_sdk/models/httpvalidationerror.py): Validation Error. Status code `422`. * + +
Less common errors (18) + +
+ +**Network errors:** +* [`httpx.RequestError`](https://www.python-httpx.org/exceptions/#httpx.RequestError): Base class for request errors. + * [`httpx.ConnectError`](https://www.python-httpx.org/exceptions/#httpx.ConnectError): HTTP client was unable to make a request to a server. + * [`httpx.TimeoutException`](https://www.python-httpx.org/exceptions/#httpx.TimeoutException): HTTP request timed out. + + +**Inherit from [`PolarError`](./src/polar_sdk/models/polarerror.py)**: +* [`ResourceNotFound`](./src/polar_sdk/models/resourcenotfound.py): Status code `404`. Applicable to 70 of 122 methods.* +* [`NotPermitted`](./src/polar_sdk/models/notpermitted.py): Status code `403`. Applicable to 9 of 122 methods.* +* [`Unauthorized`](./src/polar_sdk/models/unauthorized.py): Not authorized to manage license key. Status code `401`. Applicable to 5 of 122 methods.* +* [`AlreadyCanceledSubscription`](./src/polar_sdk/models/alreadycanceledsubscription.py): Status code `403`. Applicable to 4 of 122 methods.* +* [`AlreadyActiveSubscriptionError`](./src/polar_sdk/models/alreadyactivesubscriptionerror.py): The checkout is expired or the customer already has an active subscription. Status code `403`. Applicable to 3 of 122 methods.* +* [`NotOpenCheckout`](./src/polar_sdk/models/notopencheckout.py): The checkout is expired or the customer already has an active subscription. Status code `403`. Applicable to 3 of 122 methods.* +* [`ExpiredCheckoutError`](./src/polar_sdk/models/expiredcheckouterror.py): The checkout session is expired. Status code `410`. Applicable to 3 of 122 methods.* +* [`InvoiceAlreadyExists`](./src/polar_sdk/models/invoicealreadyexists.py): Order already has an invoice. Status code `409`. Applicable to 2 of 122 methods.* +* [`MissingInvoiceBillingDetails`](./src/polar_sdk/models/missinginvoicebillingdetails.py): Order is not paid or is missing billing name or address. Status code `422`. Applicable to 2 of 122 methods.* +* [`NotPaidOrder`](./src/polar_sdk/models/notpaidorder.py): Order is not paid or is missing billing name or address. Status code `422`. Applicable to 2 of 122 methods.* +* [`RefundAmountTooHigh`](./src/polar_sdk/models/refundamounttoohigh.py): Refund amount exceeds remaining order balance. Status code `400`. Applicable to 1 of 122 methods.* +* [`PaymentError`](./src/polar_sdk/models/paymenterror.py): The payment failed. Status code `400`. Applicable to 1 of 122 methods.* +* [`RefundedAlready`](./src/polar_sdk/models/refundedalready.py): Order is already fully refunded. Status code `403`. Applicable to 1 of 122 methods.* +* [`ResponseValidationError`](./src/polar_sdk/models/responsevalidationerror.py): Type mismatch between the response data and the expected Pydantic model. Provides access to the Pydantic validation error via the `cause` attribute. + +
+ +\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable. diff --git a/RELEASES.md b/RELEASES.md index 1e93e6a2..d22fb9c3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -813,4 +813,14 @@ Based on: ### Generated - [python v0.22.1] . ### Releases -- [PyPI v0.22.1] https://pypi.org/project/polar-sdk/0.22.1 - . \ No newline at end of file +- [PyPI v0.22.1] https://pypi.org/project/polar-sdk/0.22.1 - . + +## 2025-07-15 00:14:54 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.581.2 (2.656.9) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.22.2] . +### Releases +- [PyPI v0.22.2] https://pypi.org/project/polar-sdk/0.22.2 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index 4ebe67ba..97b693bb 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -86,13 +86,13 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.checkouts.client_get(client_secret=\"\")\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.client_get(client_secret=\"\")\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/checkouts/client/{client_secret}"]["patch"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.checkouts.client_update(client_secret=\"\", checkout_update_public={\n \"customer_billing_address\": None,\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.checkouts.client_update(client_secret=\"\", checkout_update_public={\n \"customer_billing_address\": None,\n })\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/checkouts/client/{client_secret}/confirm"]["post"] update: "x-codeSamples": @@ -188,7 +188,7 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.get_payment_methods(security=polar_sdk.CustomerPortalCustomersGetPaymentMethodsSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" + "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.customers.list_payment_methods(security=polar_sdk.CustomerPortalCustomersListPaymentMethodsSecurity(\n customer_session=\"\",\n ), page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" - target: $["paths"]["/v1/customer-portal/customers/me/payment-methods"]["post"] update: "x-codeSamples": @@ -200,19 +200,13 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n polar.customer_portal.customers.delete_payment_method(security=polar_sdk.CustomerPortalCustomersDeletePaymentMethodSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Use the SDK ..." + "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n polar.customer_portal.customers.delete_payment_method(security=polar_sdk.CustomerPortalCustomersDeletePaymentMethodSecurity(\n customer_session=\"\",\n ), id=\"\")\n\n # Use the SDK ..." - target: $["paths"]["/v1/customer-portal/downloadables/"]["get"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" "source": "import polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.downloadables.list(security=polar_sdk.CustomerPortalDownloadablesListSecurity(\n customer_session=\"\",\n ), organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\", page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" - - target: $["paths"]["/v1/customer-portal/downloadables/{token}"]["get"] - update: - "x-codeSamples": - - "lang": "python" - "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.downloadables.get(token=\"\")\n\n assert res is not None\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/customer-portal/license-keys/"]["get"] update: "x-codeSamples": @@ -224,19 +218,19 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.license_keys.activate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"label\": \"\",\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_portal.license_keys.activate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"label\": \"\",\n })\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/customer-portal/license-keys/deactivate"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n polar.customer_portal.license_keys.deactivate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"activation_id\": \"\",\n })\n\n # Use the SDK ..." + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n polar.customer_portal.license_keys.deactivate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n \"activation_id\": \"\",\n })\n\n # Use the SDK ..." - target: $["paths"]["/v1/customer-portal/license-keys/validate"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.customer_portal.license_keys.validate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.customer_portal.license_keys.validate(request={\n \"key\": \"\",\n \"organization_id\": \"\",\n })\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/customer-portal/license-keys/{id}"]["get"] update: "x-codeSamples": @@ -524,19 +518,13 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from datetime import date\nimport polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.metrics.get(start_date=date.fromisoformat(\"2025-03-14\"), end_date=date.fromisoformat(\"2025-03-18\"), interval=polar_sdk.TimeInterval.HOUR, organization_id=None)\n\n # Handle response\n print(res)" + "source": "from datetime import date\nimport polar_sdk\nfrom polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.metrics.get(start_date=date.fromisoformat(\"2025-03-14\"), end_date=date.fromisoformat(\"2025-03-18\"), interval=polar_sdk.TimeInterval.HOUR, timezone=\"UTC\", organization_id=None)\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/metrics/limits"]["get"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.metrics.limits()\n\n # Handle response\n print(res)" - - target: $["paths"]["/v1/oauth2/"]["get"] - update: - "x-codeSamples": - - "lang": "python" - "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.list(page=1, limit=10)\n\n while res is not None:\n # Handle items\n\n res = res.next()" - target: $["paths"]["/v1/oauth2/authorize"]["get"] update: "x-codeSamples": @@ -548,43 +536,19 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.oauth2.introspect(request={\n \"token\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n })\n\n # Handle response\n print(res)" - - target: $["paths"]["/v1/oauth2/register"]["post"] - update: - "x-codeSamples": - - "lang": "python" - "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.create(request={\n \"redirect_uris\": [\n \"https://impolite-hippodrome.com/\",\n \"https://acidic-tomography.net/\",\n ],\n \"client_name\": \"\",\n })\n\n # Handle response\n print(res)" - - target: $["paths"]["/v1/oauth2/register/{client_id}"]["delete"] - update: - "x-codeSamples": - - "lang": "python" - "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.delete(client_id=\"\")\n\n # Handle response\n print(res)" - - target: $["paths"]["/v1/oauth2/register/{client_id}"]["get"] - update: - "x-codeSamples": - - "lang": "python" - "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.get(client_id=\"\")\n\n # Handle response\n print(res)" - - target: $["paths"]["/v1/oauth2/register/{client_id}"]["put"] - update: - "x-codeSamples": - - "lang": "python" - "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.clients.update(client_id=\"\", o_auth2_client_configuration_update={\n \"redirect_uris\": [\n \"https://classic-cantaloupe.org\",\n \"https://corrupt-status.biz/\",\n ],\n \"client_name\": \"\",\n \"client_id\": \"\",\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.introspect(request={\n \"token\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n })\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/oauth2/revoke"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.oauth2.revoke(request={\n \"token\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.revoke(request={\n \"token\": \"\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n })\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/oauth2/token"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\n\n\nwith Polar() as polar:\n\n res = polar.oauth2.token(request={\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n \"code\": \"\",\n \"redirect_uri\": \"https://memorable-season.name\",\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\n\n\nwith Polar(\n access_token=\"\",\n) as polar:\n\n res = polar.oauth2.token(request={\n \"grant_type\": \"authorization_code\",\n \"client_id\": \"\",\n \"client_secret\": \"\",\n \"code\": \"\",\n \"redirect_uri\": \"https://memorable-season.name\",\n })\n\n # Handle response\n print(res)" - target: $["paths"]["/v1/oauth2/userinfo"]["get"] update: "x-codeSamples": @@ -788,103 +752,103 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_created_post(request=polar_sdk.WebhookBenefitGrantCreatedPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2025-07-29T09:12:26.895Z\"),\n modified_at=parse_datetime(\"2025-07-26T11:51:14.320Z\"),\n id=\"\",\n is_granted=False,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-05-22T17:07:22.158Z\"),\n modified_at=parse_datetime(\"2025-05-12T01:27:02.379Z\"),\n metadata={\n \"key\": 74631,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-02-21T01:01:33.050Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitDiscord(\n id=\"\",\n created_at=parse_datetime(\"2024-02-04T07:22:26.555Z\"),\n modified_at=parse_datetime(\"2024-01-11T07:21:59.726Z\"),\n description=\"sand um plagiarise dearly\",\n selectable=False,\n deletable=True,\n organization_id=\"\",\n metadata={\n \"key\": False,\n },\n properties=polar_sdk.BenefitDiscordProperties(\n guild_id=\"\",\n role_id=\"\",\n guild_token=\"\",\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_created_post(request=polar_sdk.WebhookBenefitGrantCreatedPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2025-07-29T09:12:26.895Z\"),\n modified_at=parse_datetime(\"2025-07-26T11:51:14.320Z\"),\n id=\"\",\n is_granted=False,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-05-22T17:07:22.158Z\"),\n modified_at=parse_datetime(\"2025-05-12T01:27:02.379Z\"),\n metadata={\n \"key\": 74631,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-02-21T01:01:33.050Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitDiscord(\n id=\"\",\n created_at=parse_datetime(\"2024-02-04T07:22:26.555Z\"),\n modified_at=parse_datetime(\"2024-01-11T07:21:59.726Z\"),\n description=\"sand um plagiarise dearly\",\n selectable=False,\n deletable=True,\n organization_id=\"\",\n metadata={\n \"key\": False,\n },\n properties=polar_sdk.BenefitDiscordProperties(\n guild_id=\"\",\n role_id=\"\",\n kick_member=False,\n guild_token=\"\",\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["benefit_grant.cycled"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_cycled_post(request=polar_sdk.WebhookBenefitGrantCycledPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2023-11-21T13:26:50.948Z\"),\n modified_at=None,\n id=\"\",\n is_granted=True,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-02-09T07:31:14.605Z\"),\n modified_at=parse_datetime(\"2024-01-29T22:31:09.229Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-02-26T15:17:14.361Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitMeterCredit(\n id=\"\",\n created_at=parse_datetime(\"2025-09-22T10:01:13.690Z\"),\n modified_at=parse_datetime(\"2025-07-14T03:36:29.696Z\"),\n description=\"soulful which reapply muddy never pish plus duh up ecliptic\",\n selectable=True,\n deletable=True,\n organization_id=\"\",\n metadata={\n \"key\": \"\",\n },\n properties=polar_sdk.BenefitMeterCreditProperties(\n units=107264,\n rollover=False,\n meter_id=\"\",\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_cycled_post(request=polar_sdk.WebhookBenefitGrantCycledPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2023-11-21T13:26:50.948Z\"),\n modified_at=None,\n id=\"\",\n is_granted=True,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-02-09T07:31:14.605Z\"),\n modified_at=parse_datetime(\"2024-01-29T22:31:09.229Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-02-26T15:17:14.361Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitMeterCredit(\n id=\"\",\n created_at=parse_datetime(\"2025-09-22T10:01:13.690Z\"),\n modified_at=parse_datetime(\"2025-07-14T03:36:29.696Z\"),\n description=\"soulful which reapply muddy never pish plus duh up ecliptic\",\n selectable=True,\n deletable=True,\n organization_id=\"\",\n metadata={\n \"key\": \"\",\n },\n properties=polar_sdk.BenefitMeterCreditProperties(\n units=107264,\n rollover=False,\n meter_id=\"\",\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["benefit_grant.revoked"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_revoked_post(request=polar_sdk.WebhookBenefitGrantRevokedPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2025-10-11T18:40:00.865Z\"),\n modified_at=None,\n id=\"\",\n is_granted=True,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-02-19T18:50:01.394Z\"),\n modified_at=parse_datetime(\"2024-11-20T19:24:54.327Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-05-31T18:00:43.998Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitGitHubRepository(\n id=\"\",\n created_at=parse_datetime(\"2025-11-04T03:19:52.925Z\"),\n modified_at=parse_datetime(\"2024-12-07T07:46:15.545Z\"),\n description=\"maestro silk er hence furthermore commandeer practical\",\n selectable=True,\n deletable=False,\n organization_id=\"\",\n metadata={\n \"key\": False,\n },\n properties=polar_sdk.BenefitGitHubRepositoryProperties(\n repository_owner=\"polarsource\",\n repository_name=\"private_repo\",\n permission=polar_sdk.Permission.MAINTAIN,\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_revoked_post(request=polar_sdk.WebhookBenefitGrantRevokedPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2025-10-11T18:40:00.865Z\"),\n modified_at=None,\n id=\"\",\n is_granted=True,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-02-19T18:50:01.394Z\"),\n modified_at=parse_datetime(\"2024-11-20T19:24:54.327Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-05-31T18:00:43.998Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitGitHubRepository(\n id=\"\",\n created_at=parse_datetime(\"2025-11-04T03:19:52.925Z\"),\n modified_at=parse_datetime(\"2024-12-07T07:46:15.545Z\"),\n description=\"maestro silk er hence furthermore commandeer practical\",\n selectable=True,\n deletable=False,\n organization_id=\"\",\n metadata={\n \"key\": False,\n },\n properties=polar_sdk.BenefitGitHubRepositoryProperties(\n repository_owner=\"polarsource\",\n repository_name=\"private_repo\",\n permission=polar_sdk.Permission.MAINTAIN,\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["benefit_grant.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_updated_post(request=polar_sdk.WebhookBenefitGrantUpdatedPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2023-06-15T00:42:20.858Z\"),\n modified_at=parse_datetime(\"2023-09-09T02:35:13.085Z\"),\n id=\"\",\n is_granted=True,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2023-07-19T15:08:59.439Z\"),\n modified_at=parse_datetime(\"2024-06-22T06:57:35.281Z\"),\n metadata={\n \"key\": False,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-12-12T05:42:20.338Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitMeterCredit(\n id=\"\",\n created_at=parse_datetime(\"2025-09-22T18:19:02.554Z\"),\n modified_at=parse_datetime(\"2023-12-23T22:21:47.780Z\"),\n description=\"diligently phony super boo veg crafty\",\n selectable=False,\n deletable=True,\n organization_id=\"\",\n metadata={\n\n },\n properties=polar_sdk.BenefitMeterCreditProperties(\n units=763456,\n rollover=False,\n meter_id=\"\",\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointbenefit_grant_updated_post(request=polar_sdk.WebhookBenefitGrantUpdatedPayload(\n data=polar_sdk.BenefitGrantWebhook(\n created_at=parse_datetime(\"2023-06-15T00:42:20.858Z\"),\n modified_at=parse_datetime(\"2023-09-09T02:35:13.085Z\"),\n id=\"\",\n is_granted=True,\n is_revoked=True,\n subscription_id=\"\",\n order_id=\"\",\n customer_id=\"\",\n benefit_id=\"\",\n customer=polar_sdk.Customer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2023-07-19T15:08:59.439Z\"),\n modified_at=parse_datetime(\"2024-06-22T06:57:35.281Z\"),\n metadata={\n \"key\": False,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-12-12T05:42:20.338Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n properties=polar_sdk.BenefitGrantCustomProperties(),\n benefit=polar_sdk.BenefitMeterCredit(\n id=\"\",\n created_at=parse_datetime(\"2025-09-22T18:19:02.554Z\"),\n modified_at=parse_datetime(\"2023-12-23T22:21:47.780Z\"),\n description=\"diligently phony super boo veg crafty\",\n selectable=False,\n deletable=True,\n organization_id=\"\",\n metadata={\n\n },\n properties=polar_sdk.BenefitMeterCreditProperties(\n units=763456,\n rollover=False,\n meter_id=\"\",\n ),\n ),\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["checkout.created"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcheckout_created_post(request=polar_sdk.WebhookCheckoutCreatedPayload(\n data=polar_sdk.Checkout(\n created_at=parse_datetime(\"2023-02-15T15:44:21.478Z\"),\n modified_at=parse_datetime(\"2023-09-13T08:36:46.434Z\"),\n id=\"\",\n payment_processor=polar_sdk.PaymentProcessor.STRIPE,\n status=polar_sdk.CheckoutStatus.EXPIRED,\n client_secret=\"\",\n url=\"https://whole-aftermath.net/\",\n expires_at=parse_datetime(\"2023-12-28T10:30:56.042Z\"),\n success_url=\"https://moral-premier.name/\",\n embed_origin=\"\",\n amount=929514,\n discount_amount=323773,\n net_amount=115799,\n tax_amount=97012,\n total_amount=859980,\n currency=\"Fiji Dollar\",\n product_id=\"\",\n product_price_id=\"\",\n discount_id=None,\n allow_discount_codes=True,\n require_billing_address=True,\n is_discount_applicable=True,\n is_free_product_price=True,\n is_payment_required=True,\n is_payment_setup_required=True,\n is_payment_form_required=True,\n customer_id=\"\",\n is_business_customer=False,\n customer_name=\"\",\n customer_email=None,\n customer_ip_address=None,\n customer_billing_name=\"\",\n customer_billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n customer_tax_id=\"\",\n payment_processor_metadata={\n \"key\": \"\",\n \"key1\": \"\",\n \"key2\": \"\",\n },\n customer_billing_address_fields=polar_sdk.CheckoutCustomerBillingAddressFields(\n country=False,\n state=False,\n city=False,\n postal_code=False,\n line1=False,\n line2=False,\n ),\n metadata={\n\n },\n external_customer_id=\"\",\n customer_external_id=\"\",\n products=[],\n product=polar_sdk.CheckoutProduct(\n created_at=parse_datetime(\"2024-09-25T08:09:25.820Z\"),\n modified_at=parse_datetime(\"2025-04-15T15:50:37.647Z\"),\n id=\"\",\n name=\"\",\n description=\"gee noisily mouser tentacle\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n prices=[],\n benefits=[],\n medias=[],\n ),\n product_price=polar_sdk.LegacyRecurringProductPriceFree(),\n discount=polar_sdk.CheckoutDiscountFixedOnceForeverDuration(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.FIXED,\n amount=168537,\n currency=\"Tala\",\n id=\"\",\n name=\"\",\n code=\"\",\n ),\n subscription_id=\"\",\n attached_custom_fields=[],\n customer_metadata={\n \"key\": True,\n },\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcheckout_created_post(request=polar_sdk.WebhookCheckoutCreatedPayload(\n data=polar_sdk.Checkout(\n created_at=parse_datetime(\"2023-02-15T15:44:21.478Z\"),\n modified_at=parse_datetime(\"2023-09-13T08:36:46.434Z\"),\n id=\"\",\n payment_processor=polar_sdk.PaymentProcessor.STRIPE,\n status=polar_sdk.CheckoutStatus.EXPIRED,\n client_secret=\"\",\n url=\"https://whole-aftermath.net/\",\n expires_at=parse_datetime(\"2023-12-28T10:30:56.042Z\"),\n success_url=\"https://moral-premier.name/\",\n embed_origin=\"\",\n amount=929514,\n discount_amount=323773,\n net_amount=115799,\n tax_amount=97012,\n total_amount=859980,\n currency=\"Fiji Dollar\",\n product_id=\"\",\n product_price_id=\"\",\n discount_id=None,\n allow_discount_codes=True,\n require_billing_address=True,\n is_discount_applicable=True,\n is_free_product_price=True,\n is_payment_required=True,\n is_payment_setup_required=True,\n is_payment_form_required=True,\n customer_id=\"\",\n is_business_customer=False,\n customer_name=\"\",\n customer_email=None,\n customer_ip_address=None,\n customer_billing_name=\"\",\n customer_billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n customer_tax_id=\"\",\n payment_processor_metadata={\n \"key\": \"\",\n \"key1\": \"\",\n \"key2\": \"\",\n },\n billing_address_fields=polar_sdk.CheckoutBillingAddressFields(\n country=polar_sdk.BillingAddressFieldMode.DISABLED,\n state=polar_sdk.BillingAddressFieldMode.DISABLED,\n city=polar_sdk.BillingAddressFieldMode.DISABLED,\n postal_code=polar_sdk.BillingAddressFieldMode.DISABLED,\n line1=polar_sdk.BillingAddressFieldMode.DISABLED,\n line2=polar_sdk.BillingAddressFieldMode.DISABLED,\n ),\n metadata={\n\n },\n external_customer_id=\"\",\n customer_external_id=\"\",\n products=[],\n product=polar_sdk.CheckoutProduct(\n created_at=parse_datetime(\"2024-09-25T08:09:25.820Z\"),\n modified_at=parse_datetime(\"2025-04-15T15:50:37.647Z\"),\n id=\"\",\n name=\"\",\n description=\"gee noisily mouser tentacle\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n prices=[],\n benefits=[],\n medias=[],\n ),\n product_price=polar_sdk.LegacyRecurringProductPriceFree(\n created_at=parse_datetime(\"2023-10-02T03:50:07.919Z\"),\n modified_at=parse_datetime(\"2025-06-07T12:37:50.969Z\"),\n id=\"\",\n is_archived=True,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n ),\n discount=polar_sdk.CheckoutDiscountFixedOnceForeverDuration(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.FIXED,\n amount=168537,\n currency=\"Tala\",\n id=\"\",\n name=\"\",\n code=\"\",\n ),\n subscription_id=\"\",\n attached_custom_fields=[],\n customer_metadata={\n \"key\": True,\n },\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["checkout.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcheckout_updated_post(request=polar_sdk.WebhookCheckoutUpdatedPayload(\n data=polar_sdk.Checkout(\n created_at=parse_datetime(\"2023-03-19T05:40:46.816Z\"),\n modified_at=parse_datetime(\"2025-01-17T21:45:54.449Z\"),\n id=\"\",\n payment_processor=polar_sdk.PaymentProcessor.STRIPE,\n status=polar_sdk.CheckoutStatus.SUCCEEDED,\n client_secret=\"\",\n url=\"https://wasteful-kinase.net/\",\n expires_at=parse_datetime(\"2024-07-13T07:40:45.762Z\"),\n success_url=\"https://unwieldy-lift.name\",\n embed_origin=\"\",\n amount=328864,\n discount_amount=67168,\n net_amount=710560,\n tax_amount=164230,\n total_amount=754328,\n currency=\"New Taiwan Dollar\",\n product_id=\"\",\n product_price_id=\"\",\n discount_id=\"\",\n allow_discount_codes=True,\n require_billing_address=True,\n is_discount_applicable=True,\n is_free_product_price=True,\n is_payment_required=True,\n is_payment_setup_required=False,\n is_payment_form_required=True,\n customer_id=None,\n is_business_customer=False,\n customer_name=\"\",\n customer_email=\"\",\n customer_ip_address=\"\",\n customer_billing_name=\"\",\n customer_billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n customer_tax_id=\"\",\n payment_processor_metadata={\n\n },\n customer_billing_address_fields=polar_sdk.CheckoutCustomerBillingAddressFields(\n country=False,\n state=False,\n city=False,\n postal_code=True,\n line1=True,\n line2=True,\n ),\n metadata={\n \"key\": True,\n },\n external_customer_id=\"\",\n customer_external_id=\"\",\n products=[],\n product=polar_sdk.CheckoutProduct(\n created_at=parse_datetime(\"2024-06-16T19:55:05.566Z\"),\n modified_at=parse_datetime(\"2025-10-23T11:11:52.082Z\"),\n id=\"\",\n name=\"\",\n description=\"under past upside-down tempting by or hippodrome mountain\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=True,\n is_archived=False,\n organization_id=\"\",\n prices=[],\n benefits=[\n polar_sdk.BenefitPublic(\n id=\"\",\n created_at=parse_datetime(\"2025-06-02T16:08:47.056Z\"),\n modified_at=parse_datetime(\"2024-07-14T16:21:23.700Z\"),\n type=polar_sdk.BenefitType.GITHUB_REPOSITORY,\n description=\"mid stained mmm splendid\",\n selectable=True,\n deletable=True,\n organization_id=\"\",\n ),\n ],\n medias=[],\n ),\n product_price=polar_sdk.LegacyRecurringProductPriceFixed(),\n discount=polar_sdk.CheckoutDiscountPercentageOnceForeverDuration(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.FIXED,\n basis_points=237002,\n id=\"\",\n name=\"\",\n code=\"\",\n ),\n subscription_id=\"\",\n attached_custom_fields=[\n polar_sdk.AttachedCustomField(\n custom_field_id=\"\",\n custom_field=polar_sdk.CustomFieldSelect(\n created_at=parse_datetime(\"2024-08-12T14:24:20.342Z\"),\n modified_at=parse_datetime(\"2023-08-01T03:55:09.650Z\"),\n id=\"\",\n metadata={\n \"key\": 6493.42,\n },\n slug=\"\",\n name=\"\",\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties=polar_sdk.CustomFieldSelectProperties(\n options=[],\n ),\n ),\n order=519931,\n required=True,\n ),\n ],\n customer_metadata={\n\n },\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcheckout_updated_post(request=polar_sdk.WebhookCheckoutUpdatedPayload(\n data=polar_sdk.Checkout(\n created_at=parse_datetime(\"2023-03-19T05:40:46.816Z\"),\n modified_at=parse_datetime(\"2025-01-17T21:45:54.449Z\"),\n id=\"\",\n payment_processor=polar_sdk.PaymentProcessor.STRIPE,\n status=polar_sdk.CheckoutStatus.SUCCEEDED,\n client_secret=\"\",\n url=\"https://wasteful-kinase.net/\",\n expires_at=parse_datetime(\"2024-07-13T07:40:45.762Z\"),\n success_url=\"https://unwieldy-lift.name\",\n embed_origin=\"\",\n amount=328864,\n discount_amount=67168,\n net_amount=710560,\n tax_amount=164230,\n total_amount=754328,\n currency=\"New Taiwan Dollar\",\n product_id=\"\",\n product_price_id=\"\",\n discount_id=\"\",\n allow_discount_codes=True,\n require_billing_address=True,\n is_discount_applicable=True,\n is_free_product_price=True,\n is_payment_required=True,\n is_payment_setup_required=False,\n is_payment_form_required=True,\n customer_id=None,\n is_business_customer=False,\n customer_name=\"\",\n customer_email=\"\",\n customer_ip_address=\"\",\n customer_billing_name=\"\",\n customer_billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n customer_tax_id=\"\",\n payment_processor_metadata={\n\n },\n billing_address_fields=polar_sdk.CheckoutBillingAddressFields(\n country=polar_sdk.BillingAddressFieldMode.DISABLED,\n state=polar_sdk.BillingAddressFieldMode.DISABLED,\n city=polar_sdk.BillingAddressFieldMode.DISABLED,\n postal_code=polar_sdk.BillingAddressFieldMode.REQUIRED,\n line1=polar_sdk.BillingAddressFieldMode.OPTIONAL,\n line2=polar_sdk.BillingAddressFieldMode.REQUIRED,\n ),\n metadata={\n \"key\": True,\n },\n external_customer_id=\"\",\n customer_external_id=\"\",\n products=[],\n product=polar_sdk.CheckoutProduct(\n created_at=parse_datetime(\"2024-06-16T19:55:05.566Z\"),\n modified_at=parse_datetime(\"2025-10-23T11:11:52.082Z\"),\n id=\"\",\n name=\"\",\n description=\"under past upside-down tempting by or hippodrome mountain\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=True,\n is_archived=False,\n organization_id=\"\",\n prices=[],\n benefits=[\n polar_sdk.BenefitPublic(\n id=\"\",\n created_at=parse_datetime(\"2025-06-02T16:08:47.056Z\"),\n modified_at=parse_datetime(\"2024-07-14T16:21:23.700Z\"),\n type=polar_sdk.BenefitType.GITHUB_REPOSITORY,\n description=\"mid stained mmm splendid\",\n selectable=True,\n deletable=True,\n organization_id=\"\",\n ),\n ],\n medias=[],\n ),\n product_price=polar_sdk.LegacyRecurringProductPriceFixed(\n created_at=parse_datetime(\"2025-12-11T13:44:40.797Z\"),\n modified_at=parse_datetime(\"2024-04-10T22:07:41.629Z\"),\n id=\"\",\n is_archived=True,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n price_currency=\"\",\n price_amount=351578,\n ),\n discount=polar_sdk.CheckoutDiscountPercentageOnceForeverDuration(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.FIXED,\n basis_points=237002,\n id=\"\",\n name=\"\",\n code=\"\",\n ),\n subscription_id=\"\",\n attached_custom_fields=[\n polar_sdk.AttachedCustomField(\n custom_field_id=\"\",\n custom_field=polar_sdk.CustomFieldSelect(\n created_at=parse_datetime(\"2024-08-12T14:24:20.342Z\"),\n modified_at=parse_datetime(\"2023-08-01T03:55:09.650Z\"),\n id=\"\",\n metadata={\n \"key\": 6493.42,\n },\n slug=\"\",\n name=\"\",\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties=polar_sdk.CustomFieldSelectProperties(\n options=[],\n ),\n ),\n order=519931,\n required=True,\n ),\n ],\n customer_metadata={\n\n },\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["customer.created"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_created_post(request={\n \"type\": \"customer.created\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2025-10-24T17:37:29.711Z\"),\n \"modified_at\": parse_datetime(\"2025-07-16T19:46:09.413Z\"),\n \"metadata\": {\n \"key\": \"\",\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2023-03-24T20:28:46.681Z\"),\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=blank\",\n },\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_created_post(request={\n \"type\": \"customer.created\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2025-10-24T17:37:29.711Z\"),\n \"modified_at\": parse_datetime(\"2025-07-16T19:46:09.413Z\"),\n \"metadata\": {\n \"key\": \"\",\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2023-03-24T20:28:46.681Z\"),\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=404\",\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["customer.deleted"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_deleted_post(request={\n \"type\": \"customer.deleted\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2023-07-12T21:40:34.752Z\"),\n \"modified_at\": parse_datetime(\"2025-02-26T09:36:28.870Z\"),\n \"metadata\": {\n\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2023-07-08T00:32:27.730Z\"),\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=blank\",\n },\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_deleted_post(request={\n \"type\": \"customer.deleted\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2023-07-12T21:40:34.752Z\"),\n \"modified_at\": parse_datetime(\"2025-02-26T09:36:28.870Z\"),\n \"metadata\": {\n\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2023-07-08T00:32:27.730Z\"),\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=404\",\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["customer.state_changed"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_state_changed_post(request={\n \"type\": \"customer.state_changed\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2025-05-22T16:03:32.369Z\"),\n \"modified_at\": parse_datetime(\"2023-04-17T22:11:17.879Z\"),\n \"metadata\": {\n\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2025-09-08T18:19:10.187Z\"),\n \"active_subscriptions\": [],\n \"granted_benefits\": [\n {\n \"id\": \"d322132c-a9d0-4e0d-b8d3-d81ad021a3a9\",\n \"created_at\": parse_datetime(\"2025-09-01T02:21:29.525Z\"),\n \"modified_at\": parse_datetime(\"2023-11-12T17:51:37.646Z\"),\n \"granted_at\": parse_datetime(\"2025-01-03T13:37:00Z\"),\n \"benefit_id\": \"397a17aa-15cf-4cb4-9333-18040203cf98\",\n \"benefit_type\": polar_sdk.BenefitType.METER_CREDIT,\n \"benefit_metadata\": {\n \"key\": \"value\",\n },\n \"properties\": {},\n },\n ],\n \"active_meters\": [\n {\n \"id\": \"\",\n \"created_at\": parse_datetime(\"2023-08-10T12:57:32.427Z\"),\n \"modified_at\": parse_datetime(\"2024-11-09T02:09:01.550Z\"),\n \"meter_id\": \"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n \"consumed_units\": 25,\n \"credited_units\": 100,\n \"balance\": 75,\n },\n ],\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=blank\",\n },\n })\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_state_changed_post(request={\n \"type\": \"customer.state_changed\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2025-05-22T16:03:32.369Z\"),\n \"modified_at\": parse_datetime(\"2023-04-17T22:11:17.879Z\"),\n \"metadata\": {\n\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2025-09-08T18:19:10.187Z\"),\n \"active_subscriptions\": [],\n \"granted_benefits\": [\n {\n \"id\": \"d322132c-a9d0-4e0d-b8d3-d81ad021a3a9\",\n \"created_at\": parse_datetime(\"2025-09-01T02:21:29.525Z\"),\n \"modified_at\": parse_datetime(\"2023-11-12T17:51:37.646Z\"),\n \"granted_at\": parse_datetime(\"2025-01-03T13:37:00Z\"),\n \"benefit_id\": \"397a17aa-15cf-4cb4-9333-18040203cf98\",\n \"benefit_type\": polar_sdk.BenefitType.METER_CREDIT,\n \"benefit_metadata\": {\n \"key\": \"value\",\n },\n \"properties\": {},\n },\n ],\n \"active_meters\": [\n {\n \"id\": \"\",\n \"created_at\": parse_datetime(\"2023-08-10T12:57:32.427Z\"),\n \"modified_at\": parse_datetime(\"2024-11-09T02:09:01.550Z\"),\n \"meter_id\": \"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n \"consumed_units\": 25,\n \"credited_units\": 100,\n \"balance\": 75,\n },\n ],\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=404\",\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["customer.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_updated_post(request={\n \"type\": \"customer.updated\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2023-07-09T20:22:33.716Z\"),\n \"modified_at\": parse_datetime(\"2024-10-16T21:39:43.150Z\"),\n \"metadata\": {\n\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2025-12-14T00:37:03.564Z\"),\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=blank\",\n },\n })\n\n # Handle response\n print(res)" + "source": "from polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointcustomer_updated_post(request={\n \"type\": \"customer.updated\",\n \"data\": {\n \"id\": \"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n \"created_at\": parse_datetime(\"2023-07-09T20:22:33.716Z\"),\n \"modified_at\": parse_datetime(\"2024-10-16T21:39:43.150Z\"),\n \"metadata\": {\n\n },\n \"external_id\": \"usr_1337\",\n \"email\": \"customer@example.com\",\n \"email_verified\": True,\n \"name\": \"John Doe\",\n \"billing_address\": {\n \"country\": \"US\",\n },\n \"tax_id\": [\n \"911144442\",\n \"us_ein\",\n ],\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"deleted_at\": parse_datetime(\"2025-12-14T00:37:03.564Z\"),\n \"avatar_url\": \"https://www.gravatar.com/avatar/xxx?d=404\",\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["order.created"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_created_post(request=polar_sdk.WebhookOrderCreatedPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2024-08-21T06:55:49.348Z\"),\n modified_at=None,\n status=polar_sdk.OrderStatus.REFUNDED,\n paid=True,\n subtotal_amount=952546,\n discount_amount=47294,\n net_amount=220865,\n amount=835005,\n tax_amount=913636,\n total_amount=727987,\n refunded_amount=597376,\n refunded_tax_amount=864844,\n currency=\"Kip\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CYCLE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=False,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=\"\",\n checkout_id=\"\",\n metadata={\n\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-02-07T21:01:19.424Z\"),\n modified_at=parse_datetime(\"2023-03-27T11:03:51.570Z\"),\n metadata={\n \"key\": 807321,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-07-30T20:36:36.637Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n\n },\n created_at=parse_datetime(\"2023-10-18T19:16:06.791Z\"),\n modified_at=parse_datetime(\"2023-07-25T14:06:55.496Z\"),\n id=\"\",\n name=\"\",\n description=\"hence hoof amid nimble\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountPercentageOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.REPEATING,\n type=polar_sdk.DiscountType.FIXED,\n basis_points=765577,\n created_at=parse_datetime(\"2025-12-27T11:04:16.188Z\"),\n modified_at=parse_datetime(\"2023-07-01T09:05:58.012Z\"),\n id=\"\",\n metadata={\n \"key\": 736909,\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2024-11-14T21:15:37.421Z\"),\n ends_at=parse_datetime(\"2023-03-07T03:56:36.953Z\"),\n max_redemptions=28675,\n redemptions_count=967708,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n\n },\n created_at=parse_datetime(\"2023-01-24T21:36:11.677Z\"),\n modified_at=parse_datetime(\"2025-12-03T03:30:23.797Z\"),\n id=\"\",\n amount=298671,\n currency=\"Boliviano boliviano\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.INCOMPLETE_EXPIRED,\n current_period_start=parse_datetime(\"2023-07-06T04:28:24.973Z\"),\n current_period_end=parse_datetime(\"2024-04-03T16:38:36.332Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2025-08-06T13:46:26.730Z\"),\n started_at=parse_datetime(\"2023-08-04T14:24:05.390Z\"),\n ends_at=parse_datetime(\"2023-01-25T10:47:26.689Z\"),\n ended_at=None,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=None,\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n ),\n items=[],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_created_post(request=polar_sdk.WebhookOrderCreatedPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2024-08-21T06:55:49.348Z\"),\n modified_at=None,\n status=polar_sdk.OrderStatus.REFUNDED,\n paid=True,\n subtotal_amount=952546,\n discount_amount=47294,\n net_amount=220865,\n amount=835005,\n tax_amount=913636,\n total_amount=727987,\n refunded_amount=597376,\n refunded_tax_amount=864844,\n currency=\"Kip\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CYCLE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=False,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=\"\",\n checkout_id=\"\",\n metadata={\n\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-02-07T21:01:19.424Z\"),\n modified_at=parse_datetime(\"2023-03-27T11:03:51.570Z\"),\n metadata={\n \"key\": 807321,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-07-30T20:36:36.637Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n\n },\n created_at=parse_datetime(\"2023-10-18T19:16:06.791Z\"),\n modified_at=parse_datetime(\"2023-07-25T14:06:55.496Z\"),\n id=\"\",\n name=\"\",\n description=\"hence hoof amid nimble\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountPercentageOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.REPEATING,\n type=polar_sdk.DiscountType.FIXED,\n basis_points=765577,\n created_at=parse_datetime(\"2025-12-27T11:04:16.188Z\"),\n modified_at=parse_datetime(\"2023-07-01T09:05:58.012Z\"),\n id=\"\",\n metadata={\n \"key\": 736909,\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2024-11-14T21:15:37.421Z\"),\n ends_at=parse_datetime(\"2023-03-07T03:56:36.953Z\"),\n max_redemptions=28675,\n redemptions_count=967708,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n\n },\n created_at=parse_datetime(\"2023-01-24T21:36:11.677Z\"),\n modified_at=parse_datetime(\"2025-12-03T03:30:23.797Z\"),\n id=\"\",\n amount=298671,\n currency=\"Boliviano boliviano\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.INCOMPLETE_EXPIRED,\n current_period_start=parse_datetime(\"2023-07-06T04:28:24.973Z\"),\n current_period_end=parse_datetime(\"2024-04-03T16:38:36.332Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2025-08-06T13:46:26.730Z\"),\n started_at=parse_datetime(\"2023-08-04T14:24:05.390Z\"),\n ends_at=parse_datetime(\"2023-01-25T10:47:26.689Z\"),\n ended_at=None,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=None,\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n ),\n items=[],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["order.paid"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_paid_post(request=polar_sdk.WebhookOrderPaidPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2025-12-05T07:44:21.172Z\"),\n modified_at=parse_datetime(\"2024-12-11T22:14:44.762Z\"),\n status=polar_sdk.OrderStatus.REFUNDED,\n paid=True,\n subtotal_amount=806442,\n discount_amount=990825,\n net_amount=746396,\n amount=341385,\n tax_amount=486648,\n total_amount=562504,\n refunded_amount=314047,\n refunded_tax_amount=570780,\n currency=\"Norwegian Krone\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CREATE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=False,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=None,\n checkout_id=\"\",\n metadata={\n \"key\": False,\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-06-20T08:16:19.561Z\"),\n modified_at=parse_datetime(\"2025-11-18T04:42:58.995Z\"),\n metadata={\n \"key\": True,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-06-08T00:11:47.056Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n \"key\": \"\",\n },\n created_at=parse_datetime(\"2025-10-14T16:14:37.497Z\"),\n modified_at=parse_datetime(\"2024-07-05T21:05:22.131Z\"),\n id=\"\",\n name=\"\",\n description=\"unlike hutch nor table reproachfully eulogise\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=False,\n is_archived=True,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountPercentageRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.FOREVER,\n duration_in_months=678845,\n type=polar_sdk.DiscountType.FIXED,\n basis_points=307762,\n created_at=parse_datetime(\"2024-04-10T18:11:00.918Z\"),\n modified_at=parse_datetime(\"2024-12-20T04:35:24.232Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2025-05-13T02:34:59.052Z\"),\n ends_at=parse_datetime(\"2024-05-17T02:38:00.485Z\"),\n max_redemptions=400985,\n redemptions_count=973205,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n \"key\": 568756,\n },\n created_at=parse_datetime(\"2024-05-24T21:01:40.292Z\"),\n modified_at=parse_datetime(\"2024-05-25T21:22:06.978Z\"),\n id=\"\",\n amount=299042,\n currency=\"Pound Sterling\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n status=polar_sdk.SubscriptionStatus.ACTIVE,\n current_period_start=parse_datetime(\"2025-03-08T16:10:05.952Z\"),\n current_period_end=parse_datetime(\"2024-09-10T07:58:34.888Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2023-09-16T09:43:57.152Z\"),\n started_at=parse_datetime(\"2024-08-15T07:25:23.875Z\"),\n ends_at=parse_datetime(\"2025-02-12T23:41:13.290Z\"),\n ended_at=parse_datetime(\"2023-02-24T15:15:22.018Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n ),\n items=[\n polar_sdk.OrderItemSchema(\n created_at=parse_datetime(\"2024-09-21T14:56:16.106Z\"),\n modified_at=parse_datetime(\"2023-01-21T03:35:38.158Z\"),\n id=\"\",\n label=\"\",\n amount=870773,\n tax_amount=305914,\n proration=True,\n product_price_id=\"\",\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_paid_post(request=polar_sdk.WebhookOrderPaidPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2025-12-05T07:44:21.172Z\"),\n modified_at=parse_datetime(\"2024-12-11T22:14:44.762Z\"),\n status=polar_sdk.OrderStatus.REFUNDED,\n paid=True,\n subtotal_amount=806442,\n discount_amount=990825,\n net_amount=746396,\n amount=341385,\n tax_amount=486648,\n total_amount=562504,\n refunded_amount=314047,\n refunded_tax_amount=570780,\n currency=\"Norwegian Krone\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CREATE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=False,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=None,\n checkout_id=\"\",\n metadata={\n \"key\": False,\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-06-20T08:16:19.561Z\"),\n modified_at=parse_datetime(\"2025-11-18T04:42:58.995Z\"),\n metadata={\n \"key\": True,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-06-08T00:11:47.056Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n \"key\": \"\",\n },\n created_at=parse_datetime(\"2025-10-14T16:14:37.497Z\"),\n modified_at=parse_datetime(\"2024-07-05T21:05:22.131Z\"),\n id=\"\",\n name=\"\",\n description=\"unlike hutch nor table reproachfully eulogise\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=False,\n is_archived=True,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountPercentageRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.FOREVER,\n duration_in_months=678845,\n type=polar_sdk.DiscountType.FIXED,\n basis_points=307762,\n created_at=parse_datetime(\"2024-04-10T18:11:00.918Z\"),\n modified_at=parse_datetime(\"2024-12-20T04:35:24.232Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2025-05-13T02:34:59.052Z\"),\n ends_at=parse_datetime(\"2024-05-17T02:38:00.485Z\"),\n max_redemptions=400985,\n redemptions_count=973205,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n \"key\": 568756,\n },\n created_at=parse_datetime(\"2024-05-24T21:01:40.292Z\"),\n modified_at=parse_datetime(\"2024-05-25T21:22:06.978Z\"),\n id=\"\",\n amount=299042,\n currency=\"Pound Sterling\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n status=polar_sdk.SubscriptionStatus.ACTIVE,\n current_period_start=parse_datetime(\"2025-03-08T16:10:05.952Z\"),\n current_period_end=parse_datetime(\"2024-09-10T07:58:34.888Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2023-09-16T09:43:57.152Z\"),\n started_at=parse_datetime(\"2024-08-15T07:25:23.875Z\"),\n ends_at=parse_datetime(\"2025-02-12T23:41:13.290Z\"),\n ended_at=parse_datetime(\"2023-02-24T15:15:22.018Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n ),\n items=[\n polar_sdk.OrderItemSchema(\n created_at=parse_datetime(\"2024-09-21T14:56:16.106Z\"),\n modified_at=parse_datetime(\"2023-01-21T03:35:38.158Z\"),\n id=\"\",\n label=\"\",\n amount=870773,\n tax_amount=305914,\n proration=True,\n product_price_id=\"\",\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["order.refunded"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_refunded_post(request=polar_sdk.WebhookOrderRefundedPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2024-07-23T18:00:11.615Z\"),\n modified_at=parse_datetime(\"2024-08-23T03:13:11.383Z\"),\n status=polar_sdk.OrderStatus.REFUNDED,\n paid=True,\n subtotal_amount=678552,\n discount_amount=294178,\n net_amount=721778,\n amount=913001,\n tax_amount=518308,\n total_amount=820663,\n refunded_amount=472431,\n refunded_tax_amount=879331,\n currency=\"Hong Kong Dollar\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CREATE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=False,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=\"\",\n checkout_id=\"\",\n metadata={\n\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-08-11T17:50:11.031Z\"),\n modified_at=parse_datetime(\"2023-02-24T05:25:29.794Z\"),\n metadata={\n \"key\": 97027,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-01-26T21:26:48.872Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n\n },\n created_at=parse_datetime(\"2023-01-16T07:26:04.196Z\"),\n modified_at=parse_datetime(\"2025-01-18T16:58:42.976Z\"),\n id=\"\",\n name=\"\",\n description=\"anxiously notwithstanding softly wilderness drat helpless conservation ew\",\n recurring_interval=None,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountPercentageRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.FOREVER,\n duration_in_months=177173,\n type=polar_sdk.DiscountType.PERCENTAGE,\n basis_points=175227,\n created_at=parse_datetime(\"2024-06-23T22:24:00.212Z\"),\n modified_at=parse_datetime(\"2025-09-20T03:04:20.355Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2024-09-22T11:17:00.498Z\"),\n ends_at=parse_datetime(\"2023-01-04T20:02:20.162Z\"),\n max_redemptions=477690,\n redemptions_count=429180,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n \"key\": True,\n },\n created_at=parse_datetime(\"2023-12-28T02:40:16.151Z\"),\n modified_at=None,\n id=\"\",\n amount=801440,\n currency=\"Kwanza\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.UNPAID,\n current_period_start=parse_datetime(\"2025-12-13T00:18:40.316Z\"),\n current_period_end=parse_datetime(\"2025-09-10T16:01:49.333Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2023-11-12T03:39:13.416Z\"),\n started_at=parse_datetime(\"2024-11-06T04:39:52.000Z\"),\n ends_at=parse_datetime(\"2024-06-22T23:44:00.447Z\"),\n ended_at=parse_datetime(\"2024-11-02T04:41:56.340Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n ),\n items=[\n polar_sdk.OrderItemSchema(\n created_at=parse_datetime(\"2024-06-01T22:10:54.514Z\"),\n modified_at=None,\n id=\"\",\n label=\"\",\n amount=584605,\n tax_amount=493789,\n proration=True,\n product_price_id=\"\",\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_refunded_post(request=polar_sdk.WebhookOrderRefundedPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2024-07-23T18:00:11.615Z\"),\n modified_at=parse_datetime(\"2024-08-23T03:13:11.383Z\"),\n status=polar_sdk.OrderStatus.REFUNDED,\n paid=True,\n subtotal_amount=678552,\n discount_amount=294178,\n net_amount=721778,\n amount=913001,\n tax_amount=518308,\n total_amount=820663,\n refunded_amount=472431,\n refunded_tax_amount=879331,\n currency=\"Hong Kong Dollar\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CREATE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=False,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=\"\",\n checkout_id=\"\",\n metadata={\n\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-08-11T17:50:11.031Z\"),\n modified_at=parse_datetime(\"2023-02-24T05:25:29.794Z\"),\n metadata={\n \"key\": 97027,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-01-26T21:26:48.872Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n\n },\n created_at=parse_datetime(\"2023-01-16T07:26:04.196Z\"),\n modified_at=parse_datetime(\"2025-01-18T16:58:42.976Z\"),\n id=\"\",\n name=\"\",\n description=\"anxiously notwithstanding softly wilderness drat helpless conservation ew\",\n recurring_interval=None,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountPercentageRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.FOREVER,\n duration_in_months=177173,\n type=polar_sdk.DiscountType.PERCENTAGE,\n basis_points=175227,\n created_at=parse_datetime(\"2024-06-23T22:24:00.212Z\"),\n modified_at=parse_datetime(\"2025-09-20T03:04:20.355Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2024-09-22T11:17:00.498Z\"),\n ends_at=parse_datetime(\"2023-01-04T20:02:20.162Z\"),\n max_redemptions=477690,\n redemptions_count=429180,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n \"key\": True,\n },\n created_at=parse_datetime(\"2023-12-28T02:40:16.151Z\"),\n modified_at=None,\n id=\"\",\n amount=801440,\n currency=\"Kwanza\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.UNPAID,\n current_period_start=parse_datetime(\"2025-12-13T00:18:40.316Z\"),\n current_period_end=parse_datetime(\"2025-09-10T16:01:49.333Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2023-11-12T03:39:13.416Z\"),\n started_at=parse_datetime(\"2024-11-06T04:39:52.000Z\"),\n ends_at=parse_datetime(\"2024-06-22T23:44:00.447Z\"),\n ended_at=parse_datetime(\"2024-11-02T04:41:56.340Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n ),\n items=[\n polar_sdk.OrderItemSchema(\n created_at=parse_datetime(\"2024-06-01T22:10:54.514Z\"),\n modified_at=None,\n id=\"\",\n label=\"\",\n amount=584605,\n tax_amount=493789,\n proration=True,\n product_price_id=\"\",\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["order.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_updated_post(request=polar_sdk.WebhookOrderUpdatedPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2023-10-25T00:08:50.290Z\"),\n modified_at=parse_datetime(\"2024-01-08T20:00:47.692Z\"),\n status=polar_sdk.OrderStatus.PARTIALLY_REFUNDED,\n paid=True,\n subtotal_amount=198772,\n discount_amount=338283,\n net_amount=321919,\n amount=827864,\n tax_amount=380359,\n total_amount=596980,\n refunded_amount=404069,\n refunded_tax_amount=718668,\n currency=\"Nuevo Sol\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CREATE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=True,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=\"\",\n checkout_id=\"\",\n metadata={\n \"key\": 187509,\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-12-03T05:16:11.415Z\"),\n modified_at=parse_datetime(\"2023-03-11T05:58:05.184Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=None,\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-06-26T15:51:37.068Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n\n },\n created_at=parse_datetime(\"2024-07-10T12:45:44.731Z\"),\n modified_at=parse_datetime(\"2024-09-19T13:13:25.785Z\"),\n id=\"\",\n name=\"\",\n description=\"bossy direct reservation quaintly atop interestingly\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=False,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountFixedRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n duration_in_months=227959,\n type=polar_sdk.DiscountType.FIXED,\n amount=785594,\n currency=\"Barbados Dollar\",\n created_at=parse_datetime(\"2025-08-02T14:17:04.679Z\"),\n modified_at=parse_datetime(\"2023-04-10T21:27:35.876Z\"),\n id=\"\",\n metadata={\n \"key\": \"\",\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-05-20T13:29:26.710Z\"),\n ends_at=parse_datetime(\"2023-09-01T14:56:03.459Z\"),\n max_redemptions=583107,\n redemptions_count=378993,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n\n },\n created_at=parse_datetime(\"2025-11-15T17:24:36.671Z\"),\n modified_at=parse_datetime(\"2024-10-31T22:22:01.280Z\"),\n id=\"\",\n amount=531188,\n currency=\"Leone\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-03-12T02:07:55.904Z\"),\n current_period_end=parse_datetime(\"2023-08-26T12:56:24.423Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2023-02-18T06:04:41.480Z\"),\n started_at=parse_datetime(\"2024-03-28T15:10:13.508Z\"),\n ends_at=parse_datetime(\"2023-11-03T05:13:30.202Z\"),\n ended_at=parse_datetime(\"2024-03-03T03:52:46.888Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.CUSTOMER_SERVICE,\n customer_cancellation_comment=\"\",\n ),\n items=[],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorder_updated_post(request=polar_sdk.WebhookOrderUpdatedPayload(\n data=polar_sdk.Order(\n id=\"\",\n created_at=parse_datetime(\"2023-10-25T00:08:50.290Z\"),\n modified_at=parse_datetime(\"2024-01-08T20:00:47.692Z\"),\n status=polar_sdk.OrderStatus.PARTIALLY_REFUNDED,\n paid=True,\n subtotal_amount=198772,\n discount_amount=338283,\n net_amount=321919,\n amount=827864,\n tax_amount=380359,\n total_amount=596980,\n refunded_amount=404069,\n refunded_tax_amount=718668,\n currency=\"Nuevo Sol\",\n billing_reason=polar_sdk.OrderBillingReason.SUBSCRIPTION_CREATE,\n billing_name=\"\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n is_invoice_generated=True,\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n subscription_id=\"\",\n checkout_id=\"\",\n metadata={\n \"key\": 187509,\n },\n customer=polar_sdk.OrderCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2024-12-03T05:16:11.415Z\"),\n modified_at=parse_datetime(\"2023-03-11T05:58:05.184Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=None,\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-06-26T15:51:37.068Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n user_id=\"\",\n product=polar_sdk.OrderProduct(\n metadata={\n\n },\n created_at=parse_datetime(\"2024-07-10T12:45:44.731Z\"),\n modified_at=parse_datetime(\"2024-09-19T13:13:25.785Z\"),\n id=\"\",\n name=\"\",\n description=\"bossy direct reservation quaintly atop interestingly\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=False,\n organization_id=\"\",\n ),\n discount=polar_sdk.DiscountFixedRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n duration_in_months=227959,\n type=polar_sdk.DiscountType.FIXED,\n amount=785594,\n currency=\"Barbados Dollar\",\n created_at=parse_datetime(\"2025-08-02T14:17:04.679Z\"),\n modified_at=parse_datetime(\"2023-04-10T21:27:35.876Z\"),\n id=\"\",\n metadata={\n \"key\": \"\",\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-05-20T13:29:26.710Z\"),\n ends_at=parse_datetime(\"2023-09-01T14:56:03.459Z\"),\n max_redemptions=583107,\n redemptions_count=378993,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n subscription=polar_sdk.OrderSubscription(\n metadata={\n\n },\n created_at=parse_datetime(\"2025-11-15T17:24:36.671Z\"),\n modified_at=parse_datetime(\"2024-10-31T22:22:01.280Z\"),\n id=\"\",\n amount=531188,\n currency=\"Leone\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-03-12T02:07:55.904Z\"),\n current_period_end=parse_datetime(\"2023-08-26T12:56:24.423Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2023-02-18T06:04:41.480Z\"),\n started_at=parse_datetime(\"2024-03-28T15:10:13.508Z\"),\n ends_at=parse_datetime(\"2023-11-03T05:13:30.202Z\"),\n ended_at=parse_datetime(\"2024-03-03T03:52:46.888Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.CUSTOMER_SERVICE,\n customer_cancellation_comment=\"\",\n ),\n items=[],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["organization.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorganization_updated_post(request={\n \"type\": \"organization.updated\",\n \"data\": {\n \"created_at\": parse_datetime(\"2025-08-19T15:02:44.139Z\"),\n \"modified_at\": parse_datetime(\"2025-08-23T00:45:50.780Z\"),\n \"id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"name\": \"\",\n \"slug\": \"\",\n \"avatar_url\": None,\n \"email\": \"Lemuel44@gmail.com\",\n \"website\": \"\",\n \"socials\": [\n {\n \"platform\": polar_sdk.OrganizationSocialPlatforms.TIKTOK,\n \"url\": \"https://grizzled-patroller.info/\",\n },\n ],\n \"details_submitted_at\": None,\n \"feature_settings\": {},\n \"subscription_settings\": {\n \"allow_multiple_subscriptions\": True,\n \"allow_customer_updates\": False,\n \"proration_behavior\": polar_sdk.SubscriptionProrationBehavior.INVOICE,\n },\n },\n })\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointorganization_updated_post(request={\n \"type\": \"organization.updated\",\n \"data\": {\n \"created_at\": parse_datetime(\"2025-08-19T15:02:44.139Z\"),\n \"modified_at\": parse_datetime(\"2025-08-23T00:45:50.780Z\"),\n \"id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"name\": \"\",\n \"slug\": \"\",\n \"avatar_url\": None,\n \"email\": \"Lemuel44@gmail.com\",\n \"website\": \"\",\n \"socials\": [\n {\n \"platform\": polar_sdk.OrganizationSocialPlatforms.TIKTOK,\n \"url\": \"https://grizzled-patroller.info/\",\n },\n ],\n \"details_submitted_at\": None,\n \"feature_settings\": {},\n \"subscription_settings\": {\n \"allow_multiple_subscriptions\": True,\n \"allow_customer_updates\": False,\n \"proration_behavior\": polar_sdk.SubscriptionProrationBehavior.INVOICE,\n },\n \"notification_settings\": {\n \"new_order\": False,\n \"new_subscription\": False,\n },\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["product.created"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointproduct_created_post(request={\n \"type\": \"product.created\",\n \"data\": {\n \"created_at\": parse_datetime(\"2023-10-13T02:47:55.082Z\"),\n \"modified_at\": None,\n \"id\": \"\",\n \"name\": \"\",\n \"description\": \"till that ew put\",\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.MONTH,\n \"is_recurring\": False,\n \"is_archived\": True,\n \"organization_id\": \"\",\n \"metadata\": {\n \"key\": 785881,\n },\n \"prices\": [\n {\n \"created_at\": parse_datetime(\"2024-07-28T01:37:16.074Z\"),\n \"modified_at\": parse_datetime(\"2024-06-21T04:06:38.404Z\"),\n \"id\": \"\",\n \"amount_type\": \"custom\",\n \"is_archived\": True,\n \"product_id\": \"\",\n \"type\": \"recurring\",\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.MONTH,\n \"price_currency\": \"\",\n \"minimum_amount\": 351958,\n \"maximum_amount\": 675813,\n \"preset_amount\": 835712,\n \"legacy\": True,\n },\n ],\n \"benefits\": [],\n \"medias\": [],\n \"attached_custom_fields\": [\n {\n \"custom_field_id\": \"\",\n \"custom_field\": {\n \"created_at\": parse_datetime(\"2025-11-01T01:55:57.043Z\"),\n \"modified_at\": parse_datetime(\"2024-03-29T03:32:13.399Z\"),\n \"id\": \"\",\n \"metadata\": {\n\n },\n \"type\": \"number\",\n \"slug\": \"\",\n \"name\": \"\",\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"properties\": {},\n },\n \"order\": 253980,\n \"required\": False,\n },\n ],\n },\n })\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointproduct_created_post(request={\n \"type\": \"product.created\",\n \"data\": {\n \"created_at\": parse_datetime(\"2023-10-13T02:47:55.082Z\"),\n \"modified_at\": None,\n \"id\": \"\",\n \"name\": \"\",\n \"description\": \"till that ew put\",\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.MONTH,\n \"is_recurring\": False,\n \"is_archived\": True,\n \"organization_id\": \"\",\n \"metadata\": {\n \"key\": 785881,\n },\n \"prices\": [\n {\n \"created_at\": parse_datetime(\"2025-01-03T22:29:57.701Z\"),\n \"modified_at\": parse_datetime(\"2023-04-17T15:58:24.892Z\"),\n \"id\": \"\",\n \"amount_type\": \"metered_unit\",\n \"is_archived\": True,\n \"product_id\": \"\",\n \"type\": polar_sdk.ProductPriceType.RECURRING,\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.MONTH,\n \"price_currency\": \"\",\n \"unit_amount\": \"\",\n \"cap_amount\": 348450,\n \"meter_id\": \"\",\n \"meter\": {\n \"id\": \"\",\n \"name\": \"\",\n },\n },\n ],\n \"benefits\": [],\n \"medias\": [],\n \"attached_custom_fields\": [\n {\n \"custom_field_id\": \"\",\n \"custom_field\": {\n \"created_at\": parse_datetime(\"2025-11-01T01:55:57.043Z\"),\n \"modified_at\": parse_datetime(\"2024-03-29T03:32:13.399Z\"),\n \"id\": \"\",\n \"metadata\": {\n\n },\n \"type\": \"number\",\n \"slug\": \"\",\n \"name\": \"\",\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"properties\": {},\n },\n \"order\": 253980,\n \"required\": False,\n },\n ],\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["product.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointproduct_updated_post(request={\n \"type\": \"product.updated\",\n \"data\": {\n \"created_at\": parse_datetime(\"2024-08-25T02:00:54.049Z\"),\n \"modified_at\": parse_datetime(\"2023-07-21T03:22:42.071Z\"),\n \"id\": \"\",\n \"name\": \"\",\n \"description\": \"fooey optimistic beyond dress helpfully whispered structure heartfelt consequently\",\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.YEAR,\n \"is_recurring\": False,\n \"is_archived\": False,\n \"organization_id\": \"\",\n \"metadata\": {\n \"key\": 495401,\n },\n \"prices\": [\n {\n \"created_at\": parse_datetime(\"2023-07-21T03:22:42.071Z\"),\n \"modified_at\": parse_datetime(\"2025-05-10T05:05:05.968Z\"),\n \"id\": \"\",\n \"amount_type\": \"free\",\n \"is_archived\": False,\n \"product_id\": \"\",\n \"type\": polar_sdk.ProductPriceType.ONE_TIME,\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.YEAR,\n },\n ],\n \"benefits\": [],\n \"medias\": [],\n \"attached_custom_fields\": [\n {\n \"custom_field_id\": \"\",\n \"custom_field\": {\n \"created_at\": parse_datetime(\"2023-06-25T21:47:16.070Z\"),\n \"modified_at\": parse_datetime(\"2023-12-26T19:54:07.292Z\"),\n \"id\": \"\",\n \"metadata\": {\n\n },\n \"type\": \"number\",\n \"slug\": \"\",\n \"name\": \"\",\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"properties\": {},\n },\n \"order\": 910988,\n \"required\": True,\n },\n ],\n },\n })\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointproduct_updated_post(request={\n \"type\": \"product.updated\",\n \"data\": {\n \"created_at\": parse_datetime(\"2024-08-25T02:00:54.049Z\"),\n \"modified_at\": parse_datetime(\"2023-07-21T03:22:42.071Z\"),\n \"id\": \"\",\n \"name\": \"\",\n \"description\": \"fooey optimistic beyond dress helpfully whispered structure heartfelt consequently\",\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.YEAR,\n \"is_recurring\": False,\n \"is_archived\": False,\n \"organization_id\": \"\",\n \"metadata\": {\n \"key\": 495401,\n },\n \"prices\": [\n {\n \"created_at\": parse_datetime(\"2023-07-01T18:10:48.406Z\"),\n \"modified_at\": None,\n \"id\": \"\",\n \"amount_type\": \"free\",\n \"is_archived\": True,\n \"product_id\": \"\",\n \"type\": \"recurring\",\n \"recurring_interval\": polar_sdk.SubscriptionRecurringInterval.MONTH,\n \"legacy\": True,\n },\n ],\n \"benefits\": [],\n \"medias\": [],\n \"attached_custom_fields\": [\n {\n \"custom_field_id\": \"\",\n \"custom_field\": {\n \"created_at\": parse_datetime(\"2023-06-25T21:47:16.070Z\"),\n \"modified_at\": parse_datetime(\"2023-12-26T19:54:07.292Z\"),\n \"id\": \"\",\n \"metadata\": {\n\n },\n \"type\": \"number\",\n \"slug\": \"\",\n \"name\": \"\",\n \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n \"properties\": {},\n },\n \"order\": 910988,\n \"required\": True,\n },\n ],\n },\n })\n\n # Handle response\n print(res)" - target: $["paths"]["refund.created"]["post"] update: "x-codeSamples": @@ -902,34 +866,34 @@ actions: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_active_post(request=polar_sdk.WebhookSubscriptionActivePayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2023-08-13T01:28:21.362Z\"),\n modified_at=parse_datetime(\"2024-06-25T00:41:05.678Z\"),\n id=\"\",\n amount=320436,\n currency=\"Peso Uruguayo\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.PAST_DUE,\n current_period_start=parse_datetime(\"2023-06-09T14:14:48.363Z\"),\n current_period_end=None,\n cancel_at_period_end=True,\n canceled_at=None,\n started_at=parse_datetime(\"2023-07-21T07:29:31.409Z\"),\n ends_at=parse_datetime(\"2025-08-05T11:38:46.213Z\"),\n ended_at=parse_datetime(\"2024-09-05T04:27:23.768Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.TOO_COMPLEX,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-04-15T00:36:48.299Z\"),\n modified_at=parse_datetime(\"2024-08-17T18:35:42.212Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-01-01T03:00:09.282Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2025-03-11T11:17:02.540Z\"),\n modified_at=parse_datetime(\"2025-05-22T16:11:00.138Z\"),\n id=\"\",\n name=\"\",\n description=\"per indeed punctually\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n metadata={\n \"key\": \"\",\n },\n prices=[\n polar_sdk.LegacyRecurringProductPriceFixed(),\n ],\n benefits=[],\n medias=[\n polar_sdk.ProductMediaFileRead(\n id=\"\",\n organization_id=\"\",\n name=\"\",\n path=\"/home\",\n mime_type=\"\",\n size=462010,\n storage_version=\"\",\n checksum_etag=\"\",\n checksum_sha256_base64=\"\",\n checksum_sha256_hex=None,\n last_modified_at=parse_datetime(\"2024-12-02T20:32:47.578Z\"),\n version=\"\",\n is_uploaded=True,\n created_at=parse_datetime(\"2024-02-08T05:56:24.956Z\"),\n size_readable=\"\",\n public_url=\"https://regular-scratch.org/\",\n ),\n ],\n attached_custom_fields=[\n polar_sdk.AttachedCustomField(\n custom_field_id=\"\",\n custom_field=polar_sdk.CustomFieldDate(\n created_at=parse_datetime(\"2023-06-04T23:55:53.252Z\"),\n modified_at=parse_datetime(\"2024-08-20T09:23:26.342Z\"),\n id=\"\",\n metadata={\n \"key\": True,\n },\n slug=\"\",\n name=\"\",\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties=polar_sdk.CustomFieldDateProperties(),\n ),\n order=612157,\n required=True,\n ),\n ],\n ),\n discount=polar_sdk.DiscountPercentageRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n duration_in_months=829362,\n type=polar_sdk.DiscountType.PERCENTAGE,\n basis_points=431070,\n created_at=parse_datetime(\"2024-04-05T11:10:16.533Z\"),\n modified_at=parse_datetime(\"2023-02-12T06:44:11.052Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-03-15T20:22:59.077Z\"),\n ends_at=parse_datetime(\"2025-04-04T17:29:43.877Z\"),\n max_redemptions=90287,\n redemptions_count=180745,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[],\n meters=[],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_active_post(request=polar_sdk.WebhookSubscriptionActivePayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2023-08-13T01:28:21.362Z\"),\n modified_at=parse_datetime(\"2024-06-25T00:41:05.678Z\"),\n id=\"\",\n amount=320436,\n currency=\"Peso Uruguayo\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.PAST_DUE,\n current_period_start=parse_datetime(\"2023-06-09T14:14:48.363Z\"),\n current_period_end=None,\n cancel_at_period_end=True,\n canceled_at=None,\n started_at=parse_datetime(\"2023-07-21T07:29:31.409Z\"),\n ends_at=parse_datetime(\"2025-08-05T11:38:46.213Z\"),\n ended_at=parse_datetime(\"2024-09-05T04:27:23.768Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.TOO_COMPLEX,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-04-15T00:36:48.299Z\"),\n modified_at=parse_datetime(\"2024-08-17T18:35:42.212Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-01-01T03:00:09.282Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2025-03-11T11:17:02.540Z\"),\n modified_at=parse_datetime(\"2025-05-22T16:11:00.138Z\"),\n id=\"\",\n name=\"\",\n description=\"per indeed punctually\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=False,\n is_archived=False,\n organization_id=\"\",\n metadata={\n \"key\": \"\",\n },\n prices=[\n polar_sdk.LegacyRecurringProductPriceFixed(\n created_at=parse_datetime(\"2023-06-22T15:04:43.558Z\"),\n modified_at=parse_datetime(\"2023-02-05T17:39:30.893Z\"),\n id=\"\",\n is_archived=False,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n price_currency=\"\",\n price_amount=924076,\n ),\n ],\n benefits=[],\n medias=[\n polar_sdk.ProductMediaFileRead(\n id=\"\",\n organization_id=\"\",\n name=\"\",\n path=\"/home\",\n mime_type=\"\",\n size=462010,\n storage_version=\"\",\n checksum_etag=\"\",\n checksum_sha256_base64=\"\",\n checksum_sha256_hex=None,\n last_modified_at=parse_datetime(\"2024-12-02T20:32:47.578Z\"),\n version=\"\",\n is_uploaded=True,\n created_at=parse_datetime(\"2024-02-08T05:56:24.956Z\"),\n size_readable=\"\",\n public_url=\"https://regular-scratch.org/\",\n ),\n ],\n attached_custom_fields=[\n polar_sdk.AttachedCustomField(\n custom_field_id=\"\",\n custom_field=polar_sdk.CustomFieldDate(\n created_at=parse_datetime(\"2023-06-04T23:55:53.252Z\"),\n modified_at=parse_datetime(\"2024-08-20T09:23:26.342Z\"),\n id=\"\",\n metadata={\n \"key\": True,\n },\n slug=\"\",\n name=\"\",\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties=polar_sdk.CustomFieldDateProperties(),\n ),\n order=612157,\n required=True,\n ),\n ],\n ),\n discount=polar_sdk.DiscountPercentageRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n duration_in_months=829362,\n type=polar_sdk.DiscountType.PERCENTAGE,\n basis_points=431070,\n created_at=parse_datetime(\"2024-04-05T11:10:16.533Z\"),\n modified_at=parse_datetime(\"2023-02-12T06:44:11.052Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-03-15T20:22:59.077Z\"),\n ends_at=parse_datetime(\"2025-04-04T17:29:43.877Z\"),\n max_redemptions=90287,\n redemptions_count=180745,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[],\n meters=[],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["subscription.canceled"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_canceled_post(request=polar_sdk.WebhookSubscriptionCanceledPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2025-02-09T04:39:02.332Z\"),\n modified_at=parse_datetime(\"2023-04-18T10:38:03.481Z\"),\n id=\"\",\n amount=137392,\n currency=\"New Taiwan Dollar\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.ACTIVE,\n current_period_start=parse_datetime(\"2023-06-17T04:15:56.819Z\"),\n current_period_end=parse_datetime(\"2023-06-02T15:48:16.857Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2024-01-07T18:54:45.602Z\"),\n started_at=parse_datetime(\"2025-02-23T12:23:49.579Z\"),\n ends_at=parse_datetime(\"2023-11-16T08:24:59.166Z\"),\n ended_at=parse_datetime(\"2023-07-21T16:25:14.433Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=None,\n checkout_id=None,\n customer_cancellation_reason=None,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2023-10-25T05:52:42.846Z\"),\n modified_at=parse_datetime(\"2023-09-20T10:20:50.540Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-04-15T00:52:17.297Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2024-10-18T00:58:28.923Z\"),\n modified_at=parse_datetime(\"2025-06-11T17:21:10.206Z\"),\n id=\"\",\n name=\"\",\n description=\"rekindle very whoever happily provision pfft outrun surface\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=False,\n is_archived=True,\n organization_id=\"\",\n metadata={\n \"key\": True,\n },\n prices=[],\n benefits=[\n polar_sdk.BenefitLicenseKeys(\n id=\"\",\n created_at=parse_datetime(\"2024-10-21T11:59:45.315Z\"),\n modified_at=parse_datetime(\"2025-06-11T03:26:05.845Z\"),\n description=\"yippee broadcast er yowza\",\n selectable=True,\n deletable=True,\n organization_id=\"\",\n metadata={\n\n },\n properties=polar_sdk.BenefitLicenseKeysProperties(\n prefix=\"\",\n expires=polar_sdk.BenefitLicenseKeyExpirationProperties(\n ttl=156565,\n timeframe=polar_sdk.Timeframe.YEAR,\n ),\n activations=polar_sdk.BenefitLicenseKeyActivationProperties(\n limit=676095,\n enable_customer_admin=False,\n ),\n limit_usage=637284,\n ),\n ),\n ],\n medias=[],\n attached_custom_fields=[\n polar_sdk.AttachedCustomField(\n custom_field_id=\"\",\n custom_field=polar_sdk.CustomFieldText(\n created_at=parse_datetime(\"2023-03-07T15:42:46.324Z\"),\n modified_at=parse_datetime(\"2024-09-08T21:12:01.583Z\"),\n id=\"\",\n metadata={\n\n },\n slug=\"\",\n name=\"\",\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties=polar_sdk.CustomFieldTextProperties(),\n ),\n order=147849,\n required=False,\n ),\n ],\n ),\n discount=polar_sdk.DiscountFixedRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n duration_in_months=162086,\n type=polar_sdk.DiscountType.PERCENTAGE,\n amount=280213,\n currency=\"Mexican Peso\",\n created_at=parse_datetime(\"2024-09-21T23:00:18.902Z\"),\n modified_at=parse_datetime(\"2024-06-12T08:11:27.558Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2024-04-30T07:29:19.925Z\"),\n ends_at=parse_datetime(\"2025-12-08T04:46:29.428Z\"),\n max_redemptions=264852,\n redemptions_count=579638,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[\n polar_sdk.ProductPriceMeteredUnit(),\n ],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2023-04-20T13:22:47.883Z\"),\n modified_at=parse_datetime(\"2024-05-07T04:06:16.229Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n \"key\": False,\n },\n created_at=parse_datetime(\"2024-05-08T15:55:55.133Z\"),\n modified_at=parse_datetime(\"2024-02-15T18:41:28.030Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.AND,\n clauses=[],\n ),\n aggregation=polar_sdk.CountAggregation(),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_canceled_post(request=polar_sdk.WebhookSubscriptionCanceledPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2025-02-09T04:39:02.332Z\"),\n modified_at=parse_datetime(\"2023-04-18T10:38:03.481Z\"),\n id=\"\",\n amount=137392,\n currency=\"New Taiwan Dollar\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.ACTIVE,\n current_period_start=parse_datetime(\"2023-06-17T04:15:56.819Z\"),\n current_period_end=parse_datetime(\"2023-06-02T15:48:16.857Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2024-01-07T18:54:45.602Z\"),\n started_at=parse_datetime(\"2025-02-23T12:23:49.579Z\"),\n ends_at=parse_datetime(\"2023-11-16T08:24:59.166Z\"),\n ended_at=parse_datetime(\"2023-07-21T16:25:14.433Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=None,\n checkout_id=None,\n customer_cancellation_reason=None,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2023-10-25T05:52:42.846Z\"),\n modified_at=parse_datetime(\"2023-09-20T10:20:50.540Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-04-15T00:52:17.297Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2024-10-18T00:58:28.923Z\"),\n modified_at=parse_datetime(\"2025-06-11T17:21:10.206Z\"),\n id=\"\",\n name=\"\",\n description=\"rekindle very whoever happily provision pfft outrun surface\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=False,\n is_archived=True,\n organization_id=\"\",\n metadata={\n \"key\": True,\n },\n prices=[],\n benefits=[\n polar_sdk.BenefitLicenseKeys(\n id=\"\",\n created_at=parse_datetime(\"2024-10-21T11:59:45.315Z\"),\n modified_at=parse_datetime(\"2025-06-11T03:26:05.845Z\"),\n description=\"yippee broadcast er yowza\",\n selectable=True,\n deletable=True,\n organization_id=\"\",\n metadata={\n\n },\n properties=polar_sdk.BenefitLicenseKeysProperties(\n prefix=\"\",\n expires=polar_sdk.BenefitLicenseKeyExpirationProperties(\n ttl=156565,\n timeframe=polar_sdk.Timeframe.YEAR,\n ),\n activations=polar_sdk.BenefitLicenseKeyActivationProperties(\n limit=676095,\n enable_customer_admin=False,\n ),\n limit_usage=637284,\n ),\n ),\n ],\n medias=[],\n attached_custom_fields=[\n polar_sdk.AttachedCustomField(\n custom_field_id=\"\",\n custom_field=polar_sdk.CustomFieldText(\n created_at=parse_datetime(\"2023-03-07T15:42:46.324Z\"),\n modified_at=parse_datetime(\"2024-09-08T21:12:01.583Z\"),\n id=\"\",\n metadata={\n\n },\n slug=\"\",\n name=\"\",\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n properties=polar_sdk.CustomFieldTextProperties(),\n ),\n order=147849,\n required=False,\n ),\n ],\n ),\n discount=polar_sdk.DiscountFixedRepeatDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n duration_in_months=162086,\n type=polar_sdk.DiscountType.PERCENTAGE,\n amount=280213,\n currency=\"Mexican Peso\",\n created_at=parse_datetime(\"2024-09-21T23:00:18.902Z\"),\n modified_at=parse_datetime(\"2024-06-12T08:11:27.558Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2024-04-30T07:29:19.925Z\"),\n ends_at=parse_datetime(\"2025-12-08T04:46:29.428Z\"),\n max_redemptions=264852,\n redemptions_count=579638,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[\n polar_sdk.LegacyRecurringProductPriceFixed(\n created_at=parse_datetime(\"2024-05-17T23:59:28.786Z\"),\n modified_at=parse_datetime(\"2024-05-31T09:51:13.446Z\"),\n id=\"\",\n is_archived=True,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n price_currency=\"\",\n price_amount=57753,\n ),\n ],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2023-04-20T13:22:47.883Z\"),\n modified_at=parse_datetime(\"2024-05-07T04:06:16.229Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n \"key\": False,\n },\n created_at=parse_datetime(\"2024-05-08T15:55:55.133Z\"),\n modified_at=parse_datetime(\"2024-02-15T18:41:28.030Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.AND,\n clauses=[],\n ),\n aggregation=polar_sdk.CountAggregation(),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["subscription.created"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_created_post(request=polar_sdk.WebhookSubscriptionCreatedPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2024-05-03T11:46:21.459Z\"),\n modified_at=parse_datetime(\"2025-01-12T06:30:14.360Z\"),\n id=\"\",\n amount=469182,\n currency=\"Boliviano boliviano\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n status=polar_sdk.SubscriptionStatus.INCOMPLETE,\n current_period_start=parse_datetime(\"2024-01-07T06:33:36.381Z\"),\n current_period_end=parse_datetime(\"2024-07-30T16:54:44.427Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2023-09-10T18:39:16.136Z\"),\n started_at=parse_datetime(\"2025-08-30T21:29:16.432Z\"),\n ends_at=parse_datetime(\"2024-06-27T22:01:23.333Z\"),\n ended_at=parse_datetime(\"2024-07-24T19:43:04.879Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=None,\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-04-17T21:09:13.571Z\"),\n modified_at=parse_datetime(\"2023-05-18T22:55:50.482Z\"),\n metadata={\n \"key\": 5036.67,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-11-15T13:52:57.820Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2025-09-26T04:05:17.473Z\"),\n modified_at=parse_datetime(\"2025-06-26T21:09:46.234Z\"),\n id=\"\",\n name=\"\",\n description=\"mysteriously platypus scrape adventurously which cautiously\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=False,\n is_archived=True,\n organization_id=\"\",\n metadata={\n \"key\": 7184.85,\n },\n prices=[],\n benefits=[],\n medias=[],\n attached_custom_fields=[],\n ),\n discount=polar_sdk.DiscountPercentageOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.PERCENTAGE,\n basis_points=784251,\n created_at=parse_datetime(\"2025-10-28T15:34:36.012Z\"),\n modified_at=parse_datetime(\"2024-10-10T17:21:09.309Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-03-14T14:26:18.378Z\"),\n ends_at=parse_datetime(\"2023-02-06T08:50:56.809Z\"),\n max_redemptions=897788,\n redemptions_count=877303,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2025-09-05T16:45:03.444Z\"),\n modified_at=parse_datetime(\"2025-01-22T02:13:03.697Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n\n },\n created_at=parse_datetime(\"2024-02-18T16:04:27.179Z\"),\n modified_at=parse_datetime(\"2023-02-18T11:12:06.291Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.OR,\n clauses=[],\n ),\n aggregation=polar_sdk.PropertyAggregation(\n func=polar_sdk.Func.SUM,\n property=\"\",\n ),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_created_post(request=polar_sdk.WebhookSubscriptionCreatedPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2024-05-03T11:46:21.459Z\"),\n modified_at=parse_datetime(\"2025-01-12T06:30:14.360Z\"),\n id=\"\",\n amount=469182,\n currency=\"Boliviano boliviano\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n status=polar_sdk.SubscriptionStatus.INCOMPLETE,\n current_period_start=parse_datetime(\"2024-01-07T06:33:36.381Z\"),\n current_period_end=parse_datetime(\"2024-07-30T16:54:44.427Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2023-09-10T18:39:16.136Z\"),\n started_at=parse_datetime(\"2025-08-30T21:29:16.432Z\"),\n ends_at=parse_datetime(\"2024-06-27T22:01:23.333Z\"),\n ended_at=parse_datetime(\"2024-07-24T19:43:04.879Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=None,\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.MISSING_FEATURES,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-04-17T21:09:13.571Z\"),\n modified_at=parse_datetime(\"2023-05-18T22:55:50.482Z\"),\n metadata={\n \"key\": 5036.67,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2025-11-15T13:52:57.820Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2025-09-26T04:05:17.473Z\"),\n modified_at=parse_datetime(\"2025-06-26T21:09:46.234Z\"),\n id=\"\",\n name=\"\",\n description=\"mysteriously platypus scrape adventurously which cautiously\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.YEAR,\n is_recurring=False,\n is_archived=True,\n organization_id=\"\",\n metadata={\n \"key\": 7184.85,\n },\n prices=[],\n benefits=[],\n medias=[],\n attached_custom_fields=[],\n ),\n discount=polar_sdk.DiscountPercentageOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.PERCENTAGE,\n basis_points=784251,\n created_at=parse_datetime(\"2025-10-28T15:34:36.012Z\"),\n modified_at=parse_datetime(\"2024-10-10T17:21:09.309Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-03-14T14:26:18.378Z\"),\n ends_at=parse_datetime(\"2023-02-06T08:50:56.809Z\"),\n max_redemptions=897788,\n redemptions_count=877303,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2025-09-05T16:45:03.444Z\"),\n modified_at=parse_datetime(\"2025-01-22T02:13:03.697Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n\n },\n created_at=parse_datetime(\"2024-02-18T16:04:27.179Z\"),\n modified_at=parse_datetime(\"2023-02-18T11:12:06.291Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.OR,\n clauses=[],\n ),\n aggregation=polar_sdk.PropertyAggregation(\n func=polar_sdk.Func.SUM,\n property=\"\",\n ),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["subscription.revoked"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_revoked_post(request=polar_sdk.WebhookSubscriptionRevokedPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2024-01-02T06:40:50.860Z\"),\n modified_at=None,\n id=\"\",\n amount=357630,\n currency=\"Fiji Dollar\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-04-30T10:39:59.432Z\"),\n current_period_end=parse_datetime(\"2025-03-19T11:29:47.842Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2023-02-17T04:59:11.584Z\"),\n started_at=parse_datetime(\"2024-02-14T23:20:57.498Z\"),\n ends_at=parse_datetime(\"2025-04-28T23:19:31.379Z\"),\n ended_at=parse_datetime(\"2023-04-29T06:37:50.213Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.CUSTOMER_SERVICE,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2023-11-24T13:14:03.962Z\"),\n modified_at=parse_datetime(\"2025-03-17T11:47:03.932Z\"),\n metadata={\n \"key\": False,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-10-16T13:32:15.169Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2025-01-19T04:39:36.127Z\"),\n modified_at=parse_datetime(\"2023-07-14T08:43:45.509Z\"),\n id=\"\",\n name=\"\",\n description=\"longingly apparatus since acidly anti canter dimly fatherly as\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=False,\n organization_id=\"\",\n metadata={\n\n },\n prices=[],\n benefits=[],\n medias=[],\n attached_custom_fields=[],\n ),\n discount=None,\n prices=[\n polar_sdk.LegacyRecurringProductPriceFixed(),\n ],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2023-01-12T15:01:17.401Z\"),\n modified_at=parse_datetime(\"2024-03-19T23:35:08.612Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n \"key\": 463129,\n },\n created_at=parse_datetime(\"2023-11-24T08:24:04.782Z\"),\n modified_at=parse_datetime(\"2025-06-04T07:43:03.654Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.AND,\n clauses=[\n polar_sdk.FilterClause(\n property=\"\",\n operator=polar_sdk.FilterOperator.GTE,\n value=True,\n ),\n ],\n ),\n aggregation=polar_sdk.PropertyAggregation(\n func=polar_sdk.Func.SUM,\n property=\"\",\n ),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_revoked_post(request=polar_sdk.WebhookSubscriptionRevokedPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2024-01-02T06:40:50.860Z\"),\n modified_at=None,\n id=\"\",\n amount=357630,\n currency=\"Fiji Dollar\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-04-30T10:39:59.432Z\"),\n current_period_end=parse_datetime(\"2025-03-19T11:29:47.842Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2023-02-17T04:59:11.584Z\"),\n started_at=parse_datetime(\"2024-02-14T23:20:57.498Z\"),\n ends_at=parse_datetime(\"2025-04-28T23:19:31.379Z\"),\n ended_at=parse_datetime(\"2023-04-29T06:37:50.213Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.CUSTOMER_SERVICE,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2023-11-24T13:14:03.962Z\"),\n modified_at=parse_datetime(\"2025-03-17T11:47:03.932Z\"),\n metadata={\n \"key\": False,\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2023-10-16T13:32:15.169Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2025-01-19T04:39:36.127Z\"),\n modified_at=parse_datetime(\"2023-07-14T08:43:45.509Z\"),\n id=\"\",\n name=\"\",\n description=\"longingly apparatus since acidly anti canter dimly fatherly as\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=False,\n organization_id=\"\",\n metadata={\n\n },\n prices=[],\n benefits=[],\n medias=[],\n attached_custom_fields=[],\n ),\n discount=None,\n prices=[\n polar_sdk.LegacyRecurringProductPriceFixed(\n created_at=parse_datetime(\"2025-11-28T05:50:39.876Z\"),\n modified_at=parse_datetime(\"2023-01-18T23:12:00.000Z\"),\n id=\"\",\n is_archived=True,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n price_currency=\"\",\n price_amount=60934,\n ),\n ],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2023-01-12T15:01:17.401Z\"),\n modified_at=parse_datetime(\"2024-03-19T23:35:08.612Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n \"key\": 463129,\n },\n created_at=parse_datetime(\"2023-11-24T08:24:04.782Z\"),\n modified_at=parse_datetime(\"2025-06-04T07:43:03.654Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.AND,\n clauses=[\n polar_sdk.FilterClause(\n property=\"\",\n operator=polar_sdk.FilterOperator.GTE,\n value=True,\n ),\n ],\n ),\n aggregation=polar_sdk.PropertyAggregation(\n func=polar_sdk.Func.SUM,\n property=\"\",\n ),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["subscription.uncanceled"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_uncanceled_post(request=polar_sdk.WebhookSubscriptionUncanceledPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2023-02-06T17:25:10.106Z\"),\n modified_at=parse_datetime(\"2023-01-25T07:20:02.381Z\"),\n id=\"\",\n amount=755736,\n currency=\"Iceland Krona\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-04-11T19:08:16.655Z\"),\n current_period_end=parse_datetime(\"2023-08-23T01:03:59.107Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2024-11-16T02:01:16.824Z\"),\n started_at=None,\n ends_at=parse_datetime(\"2023-12-23T04:50:00.016Z\"),\n ended_at=parse_datetime(\"2024-10-18T16:25:47.209Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=None,\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.LOW_QUALITY,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-10-01T20:42:25.530Z\"),\n modified_at=parse_datetime(\"2024-07-04T17:30:56.477Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-12-20T09:31:52.259Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2024-03-26T06:19:23.237Z\"),\n modified_at=parse_datetime(\"2024-05-11T18:08:21.251Z\"),\n id=\"\",\n name=\"\",\n description=\"questioningly proliferate yet vanish mooch yowza hopeful\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=True,\n organization_id=\"\",\n metadata={\n\n },\n prices=[],\n benefits=[],\n medias=[\n polar_sdk.ProductMediaFileRead(\n id=\"\",\n organization_id=\"\",\n name=\"\",\n path=\"/usr/local/src\",\n mime_type=\"\",\n size=930595,\n storage_version=\"\",\n checksum_etag=\"\",\n checksum_sha256_base64=\"\",\n checksum_sha256_hex=\"\",\n last_modified_at=parse_datetime(\"2024-07-09T11:35:46.121Z\"),\n version=\"\",\n is_uploaded=False,\n created_at=parse_datetime(\"2023-01-04T05:09:14.269Z\"),\n size_readable=\"\",\n public_url=\"https://distant-fen.org/\",\n ),\n ],\n attached_custom_fields=[],\n ),\n discount=polar_sdk.DiscountFixedOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.PERCENTAGE,\n amount=930,\n currency=\"Armenian Dram\",\n created_at=parse_datetime(\"2024-08-04T07:10:18.397Z\"),\n modified_at=parse_datetime(\"2024-03-24T21:29:58.344Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2025-01-07T18:49:53.331Z\"),\n ends_at=parse_datetime(\"2023-11-21T17:11:26.125Z\"),\n max_redemptions=None,\n redemptions_count=198129,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[\n polar_sdk.LegacyRecurringProductPriceCustom(),\n ],\n meters=[],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_uncanceled_post(request=polar_sdk.WebhookSubscriptionUncanceledPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2023-02-06T17:25:10.106Z\"),\n modified_at=parse_datetime(\"2023-01-25T07:20:02.381Z\"),\n id=\"\",\n amount=755736,\n currency=\"Iceland Krona\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-04-11T19:08:16.655Z\"),\n current_period_end=parse_datetime(\"2023-08-23T01:03:59.107Z\"),\n cancel_at_period_end=True,\n canceled_at=parse_datetime(\"2024-11-16T02:01:16.824Z\"),\n started_at=None,\n ends_at=parse_datetime(\"2023-12-23T04:50:00.016Z\"),\n ended_at=parse_datetime(\"2024-10-18T16:25:47.209Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=None,\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.LOW_QUALITY,\n customer_cancellation_comment=\"\",\n metadata={\n\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-10-01T20:42:25.530Z\"),\n modified_at=parse_datetime(\"2024-07-04T17:30:56.477Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-12-20T09:31:52.259Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2024-03-26T06:19:23.237Z\"),\n modified_at=parse_datetime(\"2024-05-11T18:08:21.251Z\"),\n id=\"\",\n name=\"\",\n description=\"questioningly proliferate yet vanish mooch yowza hopeful\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=True,\n organization_id=\"\",\n metadata={\n\n },\n prices=[],\n benefits=[],\n medias=[\n polar_sdk.ProductMediaFileRead(\n id=\"\",\n organization_id=\"\",\n name=\"\",\n path=\"/usr/local/src\",\n mime_type=\"\",\n size=930595,\n storage_version=\"\",\n checksum_etag=\"\",\n checksum_sha256_base64=\"\",\n checksum_sha256_hex=\"\",\n last_modified_at=parse_datetime(\"2024-07-09T11:35:46.121Z\"),\n version=\"\",\n is_uploaded=False,\n created_at=parse_datetime(\"2023-01-04T05:09:14.269Z\"),\n size_readable=\"\",\n public_url=\"https://distant-fen.org/\",\n ),\n ],\n attached_custom_fields=[],\n ),\n discount=polar_sdk.DiscountFixedOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.PERCENTAGE,\n amount=930,\n currency=\"Armenian Dram\",\n created_at=parse_datetime(\"2024-08-04T07:10:18.397Z\"),\n modified_at=parse_datetime(\"2024-03-24T21:29:58.344Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2025-01-07T18:49:53.331Z\"),\n ends_at=parse_datetime(\"2023-11-21T17:11:26.125Z\"),\n max_redemptions=None,\n redemptions_count=198129,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[\n polar_sdk.LegacyRecurringProductPriceFixed(\n created_at=parse_datetime(\"2024-08-25T04:34:39.417Z\"),\n modified_at=parse_datetime(\"2024-09-10T10:32:32.710Z\"),\n id=\"\",\n is_archived=False,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n price_currency=\"\",\n price_amount=456635,\n ),\n ],\n meters=[],\n ),\n ))\n\n # Handle response\n print(res)" - target: $["paths"]["subscription.updated"]["post"] update: "x-codeSamples": - "lang": "python" "label": "Python (SDK)" - "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_updated_post(request=polar_sdk.WebhookSubscriptionUpdatedPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2023-06-24T13:26:25.969Z\"),\n modified_at=parse_datetime(\"2024-10-16T16:24:20.274Z\"),\n id=\"\",\n amount=505562,\n currency=\"Guyana Dollar\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-06-19T12:29:28.503Z\"),\n current_period_end=parse_datetime(\"2023-08-24T22:14:10.131Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2025-08-31T06:08:08.476Z\"),\n started_at=parse_datetime(\"2023-06-01T08:01:27.951Z\"),\n ends_at=parse_datetime(\"2025-01-23T22:07:32.693Z\"),\n ended_at=parse_datetime(\"2025-05-14T13:55:44.367Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.LOW_QUALITY,\n customer_cancellation_comment=\"\",\n metadata={\n \"key\": 477870,\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-10-16T06:48:13.474Z\"),\n modified_at=parse_datetime(\"2024-02-26T04:35:08.698Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-01-24T02:08:13.039Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=blank\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2024-07-19T12:18:25.544Z\"),\n modified_at=parse_datetime(\"2023-05-10T07:26:17.258Z\"),\n id=\"\",\n name=\"\",\n description=\"fooey disbar athwart permafrost happy sun successfully steak ew\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=True,\n organization_id=\"\",\n metadata={\n \"key\": 2229.58,\n },\n prices=[\n polar_sdk.LegacyRecurringProductPriceCustom(),\n ],\n benefits=[],\n medias=[],\n attached_custom_fields=[],\n ),\n discount=polar_sdk.DiscountFixedOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.PERCENTAGE,\n amount=960746,\n currency=\"Tunisian Dinar\",\n created_at=parse_datetime(\"2024-05-31T09:53:13.946Z\"),\n modified_at=parse_datetime(\"2025-09-04T19:30:54.013Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-06-09T06:11:59.062Z\"),\n ends_at=parse_datetime(\"2024-09-28T05:16:48.757Z\"),\n max_redemptions=359864,\n redemptions_count=962223,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2024-02-19T12:40:10.475Z\"),\n modified_at=parse_datetime(\"2023-04-12T20:54:06.410Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n \"key\": 2623.94,\n },\n created_at=parse_datetime(\"2025-07-23T17:13:45.998Z\"),\n modified_at=parse_datetime(\"2023-02-28T06:14:05.829Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.OR,\n clauses=[\n polar_sdk.FilterClause(\n property=\"\",\n operator=polar_sdk.FilterOperator.GT,\n value=True,\n ),\n ],\n ),\n aggregation=polar_sdk.PropertyAggregation(\n func=polar_sdk.Func.AVG,\n property=\"\",\n ),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" + "source": "import polar_sdk\nfrom polar_sdk import Polar\nfrom polar_sdk.utils import parse_datetime\n\n\nwith Polar() as polar:\n\n res = polar.endpointsubscription_updated_post(request=polar_sdk.WebhookSubscriptionUpdatedPayload(\n data=polar_sdk.Subscription(\n created_at=parse_datetime(\"2023-06-24T13:26:25.969Z\"),\n modified_at=parse_datetime(\"2024-10-16T16:24:20.274Z\"),\n id=\"\",\n amount=505562,\n currency=\"Guyana Dollar\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n status=polar_sdk.SubscriptionStatus.CANCELED,\n current_period_start=parse_datetime(\"2024-06-19T12:29:28.503Z\"),\n current_period_end=parse_datetime(\"2023-08-24T22:14:10.131Z\"),\n cancel_at_period_end=False,\n canceled_at=parse_datetime(\"2025-08-31T06:08:08.476Z\"),\n started_at=parse_datetime(\"2023-06-01T08:01:27.951Z\"),\n ends_at=parse_datetime(\"2025-01-23T22:07:32.693Z\"),\n ended_at=parse_datetime(\"2025-05-14T13:55:44.367Z\"),\n customer_id=\"\",\n product_id=\"\",\n discount_id=\"\",\n checkout_id=\"\",\n customer_cancellation_reason=polar_sdk.CustomerCancellationReason.LOW_QUALITY,\n customer_cancellation_comment=\"\",\n metadata={\n \"key\": 477870,\n },\n customer=polar_sdk.SubscriptionCustomer(\n id=\"992fae2a-2a17-4b7a-8d9e-e287cf90131b\",\n created_at=parse_datetime(\"2025-10-16T06:48:13.474Z\"),\n modified_at=parse_datetime(\"2024-02-26T04:35:08.698Z\"),\n metadata={\n\n },\n external_id=\"usr_1337\",\n email=\"customer@example.com\",\n email_verified=True,\n name=\"John Doe\",\n billing_address=polar_sdk.Address(\n country=\"US\",\n ),\n tax_id=[\n \"911144442\",\n \"us_ein\",\n ],\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n deleted_at=parse_datetime(\"2024-01-24T02:08:13.039Z\"),\n avatar_url=\"https://www.gravatar.com/avatar/xxx?d=404\",\n ),\n product=polar_sdk.Product(\n created_at=parse_datetime(\"2024-07-19T12:18:25.544Z\"),\n modified_at=parse_datetime(\"2023-05-10T07:26:17.258Z\"),\n id=\"\",\n name=\"\",\n description=\"fooey disbar athwart permafrost happy sun successfully steak ew\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n is_recurring=True,\n is_archived=True,\n organization_id=\"\",\n metadata={\n \"key\": 2229.58,\n },\n prices=[\n polar_sdk.LegacyRecurringProductPriceCustom(\n created_at=parse_datetime(\"2024-10-24T03:47:20.035Z\"),\n modified_at=parse_datetime(\"2023-07-28T10:52:24.280Z\"),\n id=\"\",\n is_archived=True,\n product_id=\"\",\n recurring_interval=polar_sdk.SubscriptionRecurringInterval.MONTH,\n price_currency=\"\",\n minimum_amount=588876,\n maximum_amount=280866,\n preset_amount=942797,\n ),\n ],\n benefits=[],\n medias=[],\n attached_custom_fields=[],\n ),\n discount=polar_sdk.DiscountFixedOnceForeverDurationBase(\n duration=polar_sdk.DiscountDuration.ONCE,\n type=polar_sdk.DiscountType.PERCENTAGE,\n amount=960746,\n currency=\"Tunisian Dinar\",\n created_at=parse_datetime(\"2024-05-31T09:53:13.946Z\"),\n modified_at=parse_datetime(\"2025-09-04T19:30:54.013Z\"),\n id=\"\",\n metadata={\n\n },\n name=\"\",\n code=\"\",\n starts_at=parse_datetime(\"2023-06-09T06:11:59.062Z\"),\n ends_at=parse_datetime(\"2024-09-28T05:16:48.757Z\"),\n max_redemptions=359864,\n redemptions_count=962223,\n organization_id=\"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n ),\n prices=[],\n meters=[\n polar_sdk.SubscriptionMeter(\n created_at=parse_datetime(\"2024-02-19T12:40:10.475Z\"),\n modified_at=parse_datetime(\"2023-04-12T20:54:06.410Z\"),\n id=\"\",\n consumed_units=25,\n credited_units=100,\n amount=0,\n meter_id=\"d498a884-e2cd-4d3e-8002-f536468a8b22\",\n meter=polar_sdk.Meter(\n metadata={\n \"key\": 2623.94,\n },\n created_at=parse_datetime(\"2025-07-23T17:13:45.998Z\"),\n modified_at=parse_datetime(\"2023-02-28T06:14:05.829Z\"),\n id=\"\",\n name=\"\",\n filter_=polar_sdk.Filter(\n conjunction=polar_sdk.FilterConjunction.OR,\n clauses=[\n polar_sdk.FilterClause(\n property=\"\",\n operator=polar_sdk.FilterOperator.GT,\n value=True,\n ),\n ],\n ),\n aggregation=polar_sdk.PropertyAggregation(\n func=polar_sdk.Func.AVG,\n property=\"\",\n ),\n organization_id=\"\",\n ),\n ),\n ],\n ),\n ))\n\n # Handle response\n print(res)" diff --git a/docs/models/benefitdiscordcreateproperties.md b/docs/models/benefitdiscordcreateproperties.md index b9b920d7..8b08c42e 100644 --- a/docs/models/benefitdiscordcreateproperties.md +++ b/docs/models/benefitdiscordcreateproperties.md @@ -5,7 +5,8 @@ Properties to create a benefit of type `discord`. ## Fields -| Field | Type | Required | Description | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `guild_token` | *str* | :heavy_check_mark: | N/A | -| `role_id` | *str* | :heavy_check_mark: | The ID of the Discord role to grant. | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `guild_token` | *str* | :heavy_check_mark: | N/A | +| `role_id` | *str* | :heavy_check_mark: | The ID of the Discord role to grant. | +| `kick_member` | *bool* | :heavy_check_mark: | Whether to kick the member from the Discord server on revocation. | \ No newline at end of file diff --git a/docs/models/benefitdiscordproperties.md b/docs/models/benefitdiscordproperties.md index be106a0e..9a60b0c8 100644 --- a/docs/models/benefitdiscordproperties.md +++ b/docs/models/benefitdiscordproperties.md @@ -5,8 +5,9 @@ Properties for a benefit of type `discord`. ## Fields -| Field | Type | Required | Description | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `guild_id` | *str* | :heavy_check_mark: | The ID of the Discord server. | -| `role_id` | *str* | :heavy_check_mark: | The ID of the Discord role to grant. | -| `guild_token` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `guild_id` | *str* | :heavy_check_mark: | The ID of the Discord server. | +| `role_id` | *str* | :heavy_check_mark: | The ID of the Discord role to grant. | +| `kick_member` | *bool* | :heavy_check_mark: | Whether to kick the member from the Discord server on revocation. | +| `guild_token` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/billingaddressfieldmode.md b/docs/models/billingaddressfieldmode.md new file mode 100644 index 00000000..034f664e --- /dev/null +++ b/docs/models/billingaddressfieldmode.md @@ -0,0 +1,10 @@ +# BillingAddressFieldMode + + +## Values + +| Name | Value | +| ---------- | ---------- | +| `REQUIRED` | required | +| `OPTIONAL` | optional | +| `DISABLED` | disabled | \ No newline at end of file diff --git a/docs/models/checkout.md b/docs/models/checkout.md index 862e072a..457e88c5 100644 --- a/docs/models/checkout.md +++ b/docs/models/checkout.md @@ -43,7 +43,7 @@ Checkout session data retrieved using an access token. | `customer_billing_address` | [Nullable[models.Address]](../models/address.md) | :heavy_check_mark: | N/A | | `customer_tax_id` | *Nullable[str]* | :heavy_check_mark: | N/A | | `payment_processor_metadata` | Dict[str, *str*] | :heavy_check_mark: | N/A | -| `customer_billing_address_fields` | [models.CheckoutCustomerBillingAddressFields](../models/checkoutcustomerbillingaddressfields.md) | :heavy_check_mark: | N/A | +| `billing_address_fields` | [models.CheckoutBillingAddressFields](../models/checkoutbillingaddressfields.md) | :heavy_check_mark: | N/A | | `metadata` | Dict[str, [models.CheckoutMetadata](../models/checkoutmetadata.md)] | :heavy_check_mark: | N/A | | `external_customer_id` | *Nullable[str]* | :heavy_check_mark: | ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set. | | ~~`customer_external_id`~~ | *Nullable[str]* | :heavy_check_mark: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | diff --git a/docs/models/checkoutbillingaddressfields.md b/docs/models/checkoutbillingaddressfields.md new file mode 100644 index 00000000..ddeb5c7a --- /dev/null +++ b/docs/models/checkoutbillingaddressfields.md @@ -0,0 +1,13 @@ +# CheckoutBillingAddressFields + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `country` | [models.BillingAddressFieldMode](../models/billingaddressfieldmode.md) | :heavy_check_mark: | N/A | +| `state` | [models.BillingAddressFieldMode](../models/billingaddressfieldmode.md) | :heavy_check_mark: | N/A | +| `city` | [models.BillingAddressFieldMode](../models/billingaddressfieldmode.md) | :heavy_check_mark: | N/A | +| `postal_code` | [models.BillingAddressFieldMode](../models/billingaddressfieldmode.md) | :heavy_check_mark: | N/A | +| `line1` | [models.BillingAddressFieldMode](../models/billingaddressfieldmode.md) | :heavy_check_mark: | N/A | +| `line2` | [models.BillingAddressFieldMode](../models/billingaddressfieldmode.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/checkoutcustomerbillingaddressfields.md b/docs/models/checkoutcustomerbillingaddressfields.md deleted file mode 100644 index 9e7559ae..00000000 --- a/docs/models/checkoutcustomerbillingaddressfields.md +++ /dev/null @@ -1,13 +0,0 @@ -# CheckoutCustomerBillingAddressFields - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `country` | *bool* | :heavy_check_mark: | N/A | -| `state` | *bool* | :heavy_check_mark: | N/A | -| `city` | *bool* | :heavy_check_mark: | N/A | -| `postal_code` | *bool* | :heavy_check_mark: | N/A | -| `line1` | *bool* | :heavy_check_mark: | N/A | -| `line2` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/checkoutpublic.md b/docs/models/checkoutpublic.md index 97fb31c5..027c135e 100644 --- a/docs/models/checkoutpublic.md +++ b/docs/models/checkoutpublic.md @@ -43,7 +43,7 @@ Checkout session data retrieved using the client secret. | `customer_billing_address` | [Nullable[models.Address]](../models/address.md) | :heavy_check_mark: | N/A | | `customer_tax_id` | *Nullable[str]* | :heavy_check_mark: | N/A | | `payment_processor_metadata` | Dict[str, *str*] | :heavy_check_mark: | N/A | -| `customer_billing_address_fields` | [models.CheckoutCustomerBillingAddressFields](../models/checkoutcustomerbillingaddressfields.md) | :heavy_check_mark: | N/A | +| `billing_address_fields` | [models.CheckoutBillingAddressFields](../models/checkoutbillingaddressfields.md) | :heavy_check_mark: | N/A | | `products` | List[[models.CheckoutProduct](../models/checkoutproduct.md)] | :heavy_check_mark: | List of products available to select. | | `product` | [models.CheckoutProduct](../models/checkoutproduct.md) | :heavy_check_mark: | Product data for a checkout session. | | `product_price` | [models.CheckoutPublicProductPrice](../models/checkoutpublicproductprice.md) | :heavy_check_mark: | Price of the selected product. | diff --git a/docs/models/checkoutpublicconfirmed.md b/docs/models/checkoutpublicconfirmed.md index c743c651..e322c65d 100644 --- a/docs/models/checkoutpublicconfirmed.md +++ b/docs/models/checkoutpublicconfirmed.md @@ -46,7 +46,7 @@ right after the checkout. | `customer_billing_address` | [Nullable[models.Address]](../models/address.md) | :heavy_check_mark: | N/A | | `customer_tax_id` | *Nullable[str]* | :heavy_check_mark: | N/A | | `payment_processor_metadata` | Dict[str, *str*] | :heavy_check_mark: | N/A | -| `customer_billing_address_fields` | [models.CheckoutCustomerBillingAddressFields](../models/checkoutcustomerbillingaddressfields.md) | :heavy_check_mark: | N/A | +| `billing_address_fields` | [models.CheckoutBillingAddressFields](../models/checkoutbillingaddressfields.md) | :heavy_check_mark: | N/A | | `products` | List[[models.CheckoutProduct](../models/checkoutproduct.md)] | :heavy_check_mark: | List of products available to select. | | `product` | [models.CheckoutProduct](../models/checkoutproduct.md) | :heavy_check_mark: | Product data for a checkout session. | | `product_price` | [models.CheckoutPublicConfirmedProductPrice](../models/checkoutpublicconfirmedproductprice.md) | :heavy_check_mark: | Price of the selected product. | diff --git a/docs/models/customer.md b/docs/models/customer.md index f4f930bc..e413e759 100644 --- a/docs/models/customer.md +++ b/docs/models/customer.md @@ -19,4 +19,4 @@ A customer in an organization. | `tax_id` | List[[Nullable[models.CustomerTaxID]](../models/customertaxid.md)] | :heavy_check_mark: | N/A | [
"911144442",
"us_ein"
] | | `organization_id` | *str* | :heavy_check_mark: | The ID of the organization owning the customer. | 1dbfc517-0bbf-4301-9ba8-555ca42b9737 | | `deleted_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Timestamp for when the customer was soft deleted. | | -| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=blank | \ No newline at end of file +| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=404 | \ No newline at end of file diff --git a/docs/models/customerportalcustomer.md b/docs/models/customerportalcustomer.md index adf63ad6..f6af18bd 100644 --- a/docs/models/customerportalcustomer.md +++ b/docs/models/customerportalcustomer.md @@ -13,4 +13,5 @@ | `name` | *Nullable[str]* | :heavy_check_mark: | N/A | | | `billing_address` | [Nullable[models.Address]](../models/address.md) | :heavy_check_mark: | N/A | | | `tax_id` | List[[Nullable[models.CustomerPortalCustomerTaxID]](../models/customerportalcustomertaxid.md)] | :heavy_check_mark: | N/A | [
"911144442",
"us_ein"
] | -| `oauth_accounts` | Dict[str, [models.CustomerPortalOAuthAccount](../models/customerportaloauthaccount.md)] | :heavy_check_mark: | N/A | | \ No newline at end of file +| `oauth_accounts` | Dict[str, [models.CustomerPortalOAuthAccount](../models/customerportaloauthaccount.md)] | :heavy_check_mark: | N/A | | +| `default_payment_method_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/customerportalcustomersgetpaymentmethodsrequest.md b/docs/models/customerportalcustomerslistpaymentmethodsrequest.md similarity index 94% rename from docs/models/customerportalcustomersgetpaymentmethodsrequest.md rename to docs/models/customerportalcustomerslistpaymentmethodsrequest.md index 5dc34341..91b90b37 100644 --- a/docs/models/customerportalcustomersgetpaymentmethodsrequest.md +++ b/docs/models/customerportalcustomerslistpaymentmethodsrequest.md @@ -1,4 +1,4 @@ -# CustomerPortalCustomersGetPaymentMethodsRequest +# CustomerPortalCustomersListPaymentMethodsRequest ## Fields diff --git a/docs/models/customerportalcustomersgetpaymentmethodsresponse.md b/docs/models/customerportalcustomerslistpaymentmethodsresponse.md similarity index 96% rename from docs/models/customerportalcustomersgetpaymentmethodsresponse.md rename to docs/models/customerportalcustomerslistpaymentmethodsresponse.md index 4b3aa7dc..758a2074 100644 --- a/docs/models/customerportalcustomersgetpaymentmethodsresponse.md +++ b/docs/models/customerportalcustomerslistpaymentmethodsresponse.md @@ -1,4 +1,4 @@ -# CustomerPortalCustomersGetPaymentMethodsResponse +# CustomerPortalCustomersListPaymentMethodsResponse ## Fields diff --git a/docs/models/customerportalcustomersgetpaymentmethodssecurity.md b/docs/models/customerportalcustomerslistpaymentmethodssecurity.md similarity index 83% rename from docs/models/customerportalcustomersgetpaymentmethodssecurity.md rename to docs/models/customerportalcustomerslistpaymentmethodssecurity.md index 4f4e02c4..24d6a7b5 100644 --- a/docs/models/customerportalcustomersgetpaymentmethodssecurity.md +++ b/docs/models/customerportalcustomerslistpaymentmethodssecurity.md @@ -1,4 +1,4 @@ -# CustomerPortalCustomersGetPaymentMethodsSecurity +# CustomerPortalCustomersListPaymentMethodsSecurity ## Fields diff --git a/docs/models/customerportaldownloadablescustomerportaldownloadablesgetrequest.md b/docs/models/customerportaldownloadablescustomerportaldownloadablesgetrequest.md deleted file mode 100644 index 1578501a..00000000 --- a/docs/models/customerportaldownloadablescustomerportaldownloadablesgetrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `token` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/customerstate.md b/docs/models/customerstate.md index e589bca2..0c8a8d21 100644 --- a/docs/models/customerstate.md +++ b/docs/models/customerstate.md @@ -26,4 +26,4 @@ A customer along with additional state information: | `active_subscriptions` | List[[models.CustomerStateSubscription](../models/customerstatesubscription.md)] | :heavy_check_mark: | The customer's active subscriptions. | | | `granted_benefits` | List[[models.CustomerStateBenefitGrant](../models/customerstatebenefitgrant.md)] | :heavy_check_mark: | The customer's active benefit grants. | | | `active_meters` | List[[models.CustomerStateMeter](../models/customerstatemeter.md)] | :heavy_check_mark: | The customer's active meters. | | -| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=blank | \ No newline at end of file +| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=404 | \ No newline at end of file diff --git a/docs/models/eventslistnamesqueryparamexternalcustomeridfilter.md b/docs/models/eventslistnamesqueryparamexternalcustomeridfilter.md new file mode 100644 index 00000000..940645c2 --- /dev/null +++ b/docs/models/eventslistnamesqueryparamexternalcustomeridfilter.md @@ -0,0 +1,19 @@ +# EventsListNamesQueryParamExternalCustomerIDFilter + +Filter by external customer ID. + + +## Supported Types + +### `str` + +```python +value: str = /* values here */ +``` + +### `List[str]` + +```python +value: List[str] = /* values here */ +``` + diff --git a/docs/models/eventslistnamesrequest.md b/docs/models/eventslistnamesrequest.md index a0a8d86c..d55e71d2 100644 --- a/docs/models/eventslistnamesrequest.md +++ b/docs/models/eventslistnamesrequest.md @@ -7,7 +7,7 @@ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `organization_id` | [OptionalNullable[models.EventsListNamesQueryParamOrganizationIDFilter]](../models/eventslistnamesqueryparamorganizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `customer_id` | [OptionalNullable[models.EventsListNamesQueryParamCustomerIDFilter]](../models/eventslistnamesqueryparamcustomeridfilter.md) | :heavy_minus_sign: | Filter by customer ID. | -| `external_customer_id` | [OptionalNullable[models.QueryParamExternalCustomerIDFilter]](../models/queryparamexternalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | +| `external_customer_id` | [OptionalNullable[models.EventsListNamesQueryParamExternalCustomerIDFilter]](../models/eventslistnamesqueryparamexternalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | | `source` | [OptionalNullable[models.QueryParamSourceFilter]](../models/queryparamsourcefilter.md) | :heavy_minus_sign: | Filter by event source. | | `query` | *OptionalNullable[str]* | :heavy_minus_sign: | Query to filter event names. | | `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | diff --git a/docs/models/eventslistrequest.md b/docs/models/eventslistrequest.md index da01c4df..f44efd3a 100644 --- a/docs/models/eventslistrequest.md +++ b/docs/models/eventslistrequest.md @@ -10,7 +10,7 @@ | `end_timestamp` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Filter events before this timestamp. | | `organization_id` | [OptionalNullable[models.EventsListQueryParamOrganizationIDFilter]](../models/eventslistqueryparamorganizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `customer_id` | [OptionalNullable[models.EventsListQueryParamCustomerIDFilter]](../models/eventslistqueryparamcustomeridfilter.md) | :heavy_minus_sign: | Filter by customer ID. | -| `external_customer_id` | [OptionalNullable[models.ExternalCustomerIDFilter]](../models/externalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | +| `external_customer_id` | [OptionalNullable[models.QueryParamExternalCustomerIDFilter]](../models/queryparamexternalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | | `meter_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Filter by a meter filter clause. | | `name` | [OptionalNullable[models.NameFilter]](../models/namefilter.md) | :heavy_minus_sign: | Filter by event name. | | `source` | [OptionalNullable[models.SourceFilter]](../models/sourcefilter.md) | :heavy_minus_sign: | Filter by event source. | diff --git a/docs/models/externalcustomeridfilter.md b/docs/models/externalcustomeridfilter.md index 008ec68e..a3248980 100644 --- a/docs/models/externalcustomeridfilter.md +++ b/docs/models/externalcustomeridfilter.md @@ -1,6 +1,6 @@ # ExternalCustomerIDFilter -Filter by external customer ID. +Filter by customer external ID. ## Supported Types diff --git a/docs/models/granttypes.md b/docs/models/granttypes.md deleted file mode 100644 index 3e217d3b..00000000 --- a/docs/models/granttypes.md +++ /dev/null @@ -1,9 +0,0 @@ -# GrantTypes - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `AUTHORIZATION_CODE` | authorization_code | -| `REFRESH_TOKEN` | refresh_token | \ No newline at end of file diff --git a/docs/models/licensekeycustomer.md b/docs/models/licensekeycustomer.md index fa6e7305..2df21bb6 100644 --- a/docs/models/licensekeycustomer.md +++ b/docs/models/licensekeycustomer.md @@ -17,4 +17,4 @@ | `tax_id` | List[[Nullable[models.LicenseKeyCustomerTaxID]](../models/licensekeycustomertaxid.md)] | :heavy_check_mark: | N/A | [
"911144442",
"us_ein"
] | | `organization_id` | *str* | :heavy_check_mark: | The ID of the organization owning the customer. | 1dbfc517-0bbf-4301-9ba8-555ca42b9737 | | `deleted_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Timestamp for when the customer was soft deleted. | | -| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=blank | \ No newline at end of file +| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=404 | \ No newline at end of file diff --git a/docs/models/listresourceoauth2client.md b/docs/models/listresourceoauth2client.md deleted file mode 100644 index 2b96c92f..00000000 --- a/docs/models/listresourceoauth2client.md +++ /dev/null @@ -1,9 +0,0 @@ -# ListResourceOAuth2Client - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | -| `items` | List[[models.OAuth2Client](../models/oauth2client.md)] | :heavy_check_mark: | N/A | -| `pagination` | [models.Pagination](../models/pagination.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/metricsgetrequest.md b/docs/models/metricsgetrequest.md index cb3d2a51..9ce34a1d 100644 --- a/docs/models/metricsgetrequest.md +++ b/docs/models/metricsgetrequest.md @@ -7,6 +7,7 @@ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `start_date` | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) | :heavy_check_mark: | Start date. | | `end_date` | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) | :heavy_check_mark: | End date. | +| `timezone` | *Optional[str]* | :heavy_minus_sign: | Timezone to use for the timestamps. Default is UTC. | | `interval` | [models.TimeInterval](../models/timeinterval.md) | :heavy_check_mark: | Interval between two timestamps. | | `organization_id` | [OptionalNullable[models.MetricsGetQueryParamOrganizationIDFilter]](../models/metricsgetqueryparamorganizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `product_id` | [OptionalNullable[models.MetricsGetQueryParamProductIDFilter]](../models/metricsgetqueryparamproductidfilter.md) | :heavy_minus_sign: | Filter by product ID. | diff --git a/docs/models/oauth2client.md b/docs/models/oauth2client.md deleted file mode 100644 index afefc2de..00000000 --- a/docs/models/oauth2client.md +++ /dev/null @@ -1,23 +0,0 @@ -# OAuth2Client - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `redirect_uris` | List[*str*] | :heavy_check_mark: | N/A | -| `token_endpoint_auth_method` | [Optional[models.TokenEndpointAuthMethod]](../models/tokenendpointauthmethod.md) | :heavy_minus_sign: | N/A | -| `grant_types` | List[[models.GrantTypes](../models/granttypes.md)] | :heavy_minus_sign: | N/A | -| `response_types` | List[*str*] | :heavy_minus_sign: | N/A | -| `scope` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `client_name` | *str* | :heavy_check_mark: | N/A | -| `client_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `logo_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `tos_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `policy_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Creation timestamp of the object. | -| `modified_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Last modification timestamp of the object. | -| `client_id` | *str* | :heavy_check_mark: | N/A | -| `client_secret` | *str* | :heavy_check_mark: | N/A | -| `client_id_issued_at` | *int* | :heavy_check_mark: | N/A | -| `client_secret_expires_at` | *int* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/oauth2clientconfiguration.md b/docs/models/oauth2clientconfiguration.md deleted file mode 100644 index 9cd54184..00000000 --- a/docs/models/oauth2clientconfiguration.md +++ /dev/null @@ -1,17 +0,0 @@ -# OAuth2ClientConfiguration - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | -| `redirect_uris` | List[*str*] | :heavy_check_mark: | N/A | -| `token_endpoint_auth_method` | [Optional[models.OAuth2ClientConfigurationTokenEndpointAuthMethod]](../models/oauth2clientconfigurationtokenendpointauthmethod.md) | :heavy_minus_sign: | N/A | -| `grant_types` | List[[models.OAuth2ClientConfigurationGrantTypes](../models/oauth2clientconfigurationgranttypes.md)] | :heavy_minus_sign: | N/A | -| `response_types` | List[*str*] | :heavy_minus_sign: | N/A | -| `scope` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `client_name` | *str* | :heavy_check_mark: | N/A | -| `client_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `logo_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `tos_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `policy_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/oauth2clientconfigurationgranttypes.md b/docs/models/oauth2clientconfigurationgranttypes.md deleted file mode 100644 index 7190db35..00000000 --- a/docs/models/oauth2clientconfigurationgranttypes.md +++ /dev/null @@ -1,9 +0,0 @@ -# OAuth2ClientConfigurationGrantTypes - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `AUTHORIZATION_CODE` | authorization_code | -| `REFRESH_TOKEN` | refresh_token | \ No newline at end of file diff --git a/docs/models/oauth2clientconfigurationtokenendpointauthmethod.md b/docs/models/oauth2clientconfigurationtokenendpointauthmethod.md deleted file mode 100644 index 7706ecb0..00000000 --- a/docs/models/oauth2clientconfigurationtokenendpointauthmethod.md +++ /dev/null @@ -1,10 +0,0 @@ -# OAuth2ClientConfigurationTokenEndpointAuthMethod - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `CLIENT_SECRET_BASIC` | client_secret_basic | -| `CLIENT_SECRET_POST` | client_secret_post | -| `NONE` | none | \ No newline at end of file diff --git a/docs/models/oauth2clientconfigurationupdate.md b/docs/models/oauth2clientconfigurationupdate.md deleted file mode 100644 index a6c4a84c..00000000 --- a/docs/models/oauth2clientconfigurationupdate.md +++ /dev/null @@ -1,18 +0,0 @@ -# OAuth2ClientConfigurationUpdate - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `redirect_uris` | List[*str*] | :heavy_check_mark: | N/A | -| `token_endpoint_auth_method` | [Optional[models.OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod]](../models/oauth2clientconfigurationupdatetokenendpointauthmethod.md) | :heavy_minus_sign: | N/A | -| `grant_types` | List[[models.OAuth2ClientConfigurationUpdateGrantTypes](../models/oauth2clientconfigurationupdategranttypes.md)] | :heavy_minus_sign: | N/A | -| `response_types` | List[*str*] | :heavy_minus_sign: | N/A | -| `scope` | *Optional[str]* | :heavy_minus_sign: | N/A | -| `client_name` | *str* | :heavy_check_mark: | N/A | -| `client_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `logo_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `tos_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `policy_uri` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | -| `client_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/oauth2clientconfigurationupdategranttypes.md b/docs/models/oauth2clientconfigurationupdategranttypes.md deleted file mode 100644 index 8c8ba6d0..00000000 --- a/docs/models/oauth2clientconfigurationupdategranttypes.md +++ /dev/null @@ -1,9 +0,0 @@ -# OAuth2ClientConfigurationUpdateGrantTypes - - -## Values - -| Name | Value | -| -------------------- | -------------------- | -| `AUTHORIZATION_CODE` | authorization_code | -| `REFRESH_TOKEN` | refresh_token | \ No newline at end of file diff --git a/docs/models/oauth2clientconfigurationupdatetokenendpointauthmethod.md b/docs/models/oauth2clientconfigurationupdatetokenendpointauthmethod.md deleted file mode 100644 index ea26ad16..00000000 --- a/docs/models/oauth2clientconfigurationupdatetokenendpointauthmethod.md +++ /dev/null @@ -1,10 +0,0 @@ -# OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `CLIENT_SECRET_BASIC` | client_secret_basic | -| `CLIENT_SECRET_POST` | client_secret_post | -| `NONE` | none | \ No newline at end of file diff --git a/docs/models/oauth2clientslistrequest.md b/docs/models/oauth2clientslistrequest.md deleted file mode 100644 index f4a9c2b0..00000000 --- a/docs/models/oauth2clientslistrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# Oauth2ClientsListRequest - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | -| `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Size of a page, defaults to 10. Maximum is 100. | \ No newline at end of file diff --git a/docs/models/oauth2clientslistresponse.md b/docs/models/oauth2clientslistresponse.md deleted file mode 100644 index 0eb51070..00000000 --- a/docs/models/oauth2clientslistresponse.md +++ /dev/null @@ -1,8 +0,0 @@ -# Oauth2ClientsListResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | -| `result` | [models.ListResourceOAuth2Client](../models/listresourceoauth2client.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/oauth2clientsoauth2deleteclientrequest.md b/docs/models/oauth2clientsoauth2deleteclientrequest.md deleted file mode 100644 index 5a55cca5..00000000 --- a/docs/models/oauth2clientsoauth2deleteclientrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# Oauth2ClientsOauth2DeleteClientRequest - - -## Fields - -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `client_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/oauth2clientsoauth2updateclientrequest.md b/docs/models/oauth2clientsoauth2updateclientrequest.md deleted file mode 100644 index dd7543fc..00000000 --- a/docs/models/oauth2clientsoauth2updateclientrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# Oauth2ClientsOauth2UpdateClientRequest - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `client_id` | *str* | :heavy_check_mark: | N/A | -| `o_auth2_client_configuration_update` | [models.OAuth2ClientConfigurationUpdate](../models/oauth2clientconfigurationupdate.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/ordercustomer.md b/docs/models/ordercustomer.md index 73738677..24bca366 100644 --- a/docs/models/ordercustomer.md +++ b/docs/models/ordercustomer.md @@ -17,4 +17,4 @@ | `tax_id` | List[[Nullable[models.OrderCustomerTaxID]](../models/ordercustomertaxid.md)] | :heavy_check_mark: | N/A | [
"911144442",
"us_ein"
] | | `organization_id` | *str* | :heavy_check_mark: | The ID of the organization owning the customer. | 1dbfc517-0bbf-4301-9ba8-555ca42b9737 | | `deleted_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Timestamp for when the customer was soft deleted. | | -| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=blank | \ No newline at end of file +| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=404 | \ No newline at end of file diff --git a/docs/models/organization.md b/docs/models/organization.md index 967362cf..be93e7b5 100644 --- a/docs/models/organization.md +++ b/docs/models/organization.md @@ -16,4 +16,5 @@ | `socials` | List[[models.OrganizationSocialLink](../models/organizationsociallink.md)] | :heavy_check_mark: | Links to social profiles. | | | `details_submitted_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | When the business details were submitted. | | | `feature_settings` | [Nullable[models.OrganizationFeatureSettings]](../models/organizationfeaturesettings.md) | :heavy_check_mark: | Organization feature settings | | -| `subscription_settings` | [models.OrganizationSubscriptionSettings](../models/organizationsubscriptionsettings.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| `subscription_settings` | [models.OrganizationSubscriptionSettings](../models/organizationsubscriptionsettings.md) | :heavy_check_mark: | N/A | | +| `notification_settings` | [models.OrganizationNotificationSettings](../models/organizationnotificationsettings.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/organizationcreate.md b/docs/models/organizationcreate.md index a08756c9..1a2ca7b5 100644 --- a/docs/models/organizationcreate.md +++ b/docs/models/organizationcreate.md @@ -13,4 +13,5 @@ | `socials` | List[[models.OrganizationSocialLink](../models/organizationsociallink.md)] | :heavy_minus_sign: | Link to social profiles. | | `details` | [OptionalNullable[models.OrganizationDetails]](../models/organizationdetails.md) | :heavy_minus_sign: | Additional, private, business details Polar needs about active organizations for compliance (KYC). | | `feature_settings` | [OptionalNullable[models.OrganizationFeatureSettings]](../models/organizationfeaturesettings.md) | :heavy_minus_sign: | N/A | -| `subscription_settings` | [OptionalNullable[models.OrganizationSubscriptionSettings]](../models/organizationsubscriptionsettings.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `subscription_settings` | [OptionalNullable[models.OrganizationSubscriptionSettings]](../models/organizationsubscriptionsettings.md) | :heavy_minus_sign: | N/A | +| `notification_settings` | [OptionalNullable[models.OrganizationNotificationSettings]](../models/organizationnotificationsettings.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/organizationfeaturesettings.md b/docs/models/organizationfeaturesettings.md index 183bf450..fcdbc7fa 100644 --- a/docs/models/organizationfeaturesettings.md +++ b/docs/models/organizationfeaturesettings.md @@ -3,7 +3,6 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `issue_funding_enabled` | *Optional[bool]* | :heavy_minus_sign: | If this organization has issue funding enabled | -| `usage_based_billing_enabled` | *Optional[bool]* | :heavy_minus_sign: | If this organization has usage-based billing enabled | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `issue_funding_enabled` | *Optional[bool]* | :heavy_minus_sign: | If this organization has issue funding enabled | \ No newline at end of file diff --git a/docs/models/oauth2clientsoauth2getclientrequest.md b/docs/models/organizationnotificationsettings.md similarity index 52% rename from docs/models/oauth2clientsoauth2getclientrequest.md rename to docs/models/organizationnotificationsettings.md index e63d7d5d..35a6f9ad 100644 --- a/docs/models/oauth2clientsoauth2getclientrequest.md +++ b/docs/models/organizationnotificationsettings.md @@ -1,8 +1,9 @@ -# Oauth2ClientsOauth2GetClientRequest +# OrganizationNotificationSettings ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `client_id` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file +| `new_order` | *bool* | :heavy_check_mark: | N/A | +| `new_subscription` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/organizationupdate.md b/docs/models/organizationupdate.md index 35d21abc..d0535924 100644 --- a/docs/models/organizationupdate.md +++ b/docs/models/organizationupdate.md @@ -12,4 +12,5 @@ | `socials` | List[[models.OrganizationSocialLink](../models/organizationsociallink.md)] | :heavy_minus_sign: | Links to social profiles. | | `details` | [OptionalNullable[models.OrganizationDetails]](../models/organizationdetails.md) | :heavy_minus_sign: | Additional, private, business details Polar needs about active organizations for compliance (KYC). | | `feature_settings` | [OptionalNullable[models.OrganizationFeatureSettings]](../models/organizationfeaturesettings.md) | :heavy_minus_sign: | N/A | -| `subscription_settings` | [OptionalNullable[models.OrganizationSubscriptionSettings]](../models/organizationsubscriptionsettings.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| `subscription_settings` | [OptionalNullable[models.OrganizationSubscriptionSettings]](../models/organizationsubscriptionsettings.md) | :heavy_minus_sign: | N/A | +| `notification_settings` | [OptionalNullable[models.OrganizationNotificationSettings]](../models/organizationnotificationsettings.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/paymentmethodcard.md b/docs/models/paymentmethodcard.md index 0b99e916..ce4427c4 100644 --- a/docs/models/paymentmethodcard.md +++ b/docs/models/paymentmethodcard.md @@ -3,10 +3,12 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `type` | *Literal["card"]* | :heavy_check_mark: | N/A | -| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A | -| `default` | *bool* | :heavy_check_mark: | N/A | -| `card` | [models.PaymentMethodCardData](../models/paymentmethodcarddata.md) | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The ID of the object. | +| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Creation timestamp of the object. | +| `modified_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Last modification timestamp of the object. | +| `processor` | [models.PaymentProcessor](../models/paymentprocessor.md) | :heavy_check_mark: | N/A | +| `customer_id` | *str* | :heavy_check_mark: | N/A | +| `type` | *Literal["card"]* | :heavy_check_mark: | N/A | +| `method_metadata` | [models.PaymentMethodCardMetadata](../models/paymentmethodcardmetadata.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/paymentmethodcarddata.md b/docs/models/paymentmethodcardmetadata.md similarity index 96% rename from docs/models/paymentmethodcarddata.md rename to docs/models/paymentmethodcardmetadata.md index f160bf20..6ecb2304 100644 --- a/docs/models/paymentmethodcarddata.md +++ b/docs/models/paymentmethodcardmetadata.md @@ -1,4 +1,4 @@ -# PaymentMethodCardData +# PaymentMethodCardMetadata ## Fields diff --git a/docs/models/paymentmethodgeneric.md b/docs/models/paymentmethodgeneric.md index bcaa4983..4084118a 100644 --- a/docs/models/paymentmethodgeneric.md +++ b/docs/models/paymentmethodgeneric.md @@ -5,7 +5,9 @@ | Field | Type | Required | Description | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `id` | *str* | :heavy_check_mark: | N/A | -| `type` | *str* | :heavy_check_mark: | N/A | -| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | N/A | -| `default` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file +| `id` | *str* | :heavy_check_mark: | The ID of the object. | +| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Creation timestamp of the object. | +| `modified_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Last modification timestamp of the object. | +| `processor` | [models.PaymentProcessor](../models/paymentprocessor.md) | :heavy_check_mark: | N/A | +| `customer_id` | *str* | :heavy_check_mark: | N/A | +| `type` | *str* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/subscriptioncustomer.md b/docs/models/subscriptioncustomer.md index 51b32121..525ffba7 100644 --- a/docs/models/subscriptioncustomer.md +++ b/docs/models/subscriptioncustomer.md @@ -17,4 +17,4 @@ | `tax_id` | List[[Nullable[models.TaxID]](../models/taxid.md)] | :heavy_check_mark: | N/A | [
"911144442",
"us_ein"
] | | `organization_id` | *str* | :heavy_check_mark: | The ID of the organization owning the customer. | 1dbfc517-0bbf-4301-9ba8-555ca42b9737 | | `deleted_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Timestamp for when the customer was soft deleted. | | -| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=blank | \ No newline at end of file +| `avatar_url` | *str* | :heavy_check_mark: | N/A | https://www.gravatar.com/avatar/xxx?d=404 | \ No newline at end of file diff --git a/docs/models/subscriptionslistrequest.md b/docs/models/subscriptionslistrequest.md index c723408e..155ab5a1 100644 --- a/docs/models/subscriptionslistrequest.md +++ b/docs/models/subscriptionslistrequest.md @@ -8,6 +8,7 @@ | `organization_id` | [OptionalNullable[models.OrganizationIDFilter]](../models/organizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `product_id` | [OptionalNullable[models.ProductIDFilter]](../models/productidfilter.md) | :heavy_minus_sign: | Filter by product ID. | | `customer_id` | [OptionalNullable[models.CustomerIDFilter]](../models/customeridfilter.md) | :heavy_minus_sign: | Filter by customer ID. | +| `external_customer_id` | [OptionalNullable[models.ExternalCustomerIDFilter]](../models/externalcustomeridfilter.md) | :heavy_minus_sign: | Filter by customer external ID. | | `discount_id` | [OptionalNullable[models.DiscountIDFilter]](../models/discountidfilter.md) | :heavy_minus_sign: | Filter by discount ID. | | `active` | *OptionalNullable[bool]* | :heavy_minus_sign: | Filter by active or inactive subscription. | | `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | diff --git a/docs/models/tokenendpointauthmethod.md b/docs/models/tokenendpointauthmethod.md deleted file mode 100644 index 34a8034c..00000000 --- a/docs/models/tokenendpointauthmethod.md +++ /dev/null @@ -1,10 +0,0 @@ -# TokenEndpointAuthMethod - - -## Values - -| Name | Value | -| --------------------- | --------------------- | -| `CLIENT_SECRET_BASIC` | client_secret_basic | -| `CLIENT_SECRET_POST` | client_secret_post | -| `NONE` | none | \ No newline at end of file diff --git a/docs/sdks/checkouts/README.md b/docs/sdks/checkouts/README.md index 310f5d73..8a8c1cae 100644 --- a/docs/sdks/checkouts/README.md +++ b/docs/sdks/checkouts/README.md @@ -214,7 +214,9 @@ Get a checkout session by client secret. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.checkouts.client_get(client_secret="") @@ -253,7 +255,9 @@ Update a checkout session by client secret. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.checkouts.client_update(client_secret="", checkout_update_public={ "customer_billing_address": None, diff --git a/docs/sdks/clients/README.md b/docs/sdks/clients/README.md deleted file mode 100644 index c14f87d9..00000000 --- a/docs/sdks/clients/README.md +++ /dev/null @@ -1,224 +0,0 @@ -# Clients -(*oauth2.clients*) - -## Overview - -### Available Operations - -* [list](#list) - List Clients -* [create](#create) - Create Client -* [get](#get) - Get Client -* [update](#update) - Update Client -* [delete](#delete) - Delete Client - -## list - -List OAuth2 clients. - -### Example Usage - -```python -from polar_sdk import Polar - - -with Polar( - access_token="", -) as polar: - - res = polar.oauth2.clients.list(page=1, limit=10) - - while res is not None: - # Handle items - - res = res.next() - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Size of a page, defaults to 10. Maximum is 100. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[models.Oauth2ClientsListResponse](../../models/oauth2clientslistresponse.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------- | -------------------------- | -------------------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | - -## create - -Create an OAuth2 client. - -### Example Usage - -```python -from polar_sdk import Polar - - -with Polar( - access_token="", -) as polar: - - res = polar.oauth2.clients.create(request={ - "redirect_uris": [ - "https://impolite-hippodrome.com/", - "https://acidic-tomography.net/", - ], - "client_name": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | -| `request` | [models.OAuth2ClientConfiguration](../../models/oauth2clientconfiguration.md) | :heavy_check_mark: | The request object to use for the request. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[Any](../../models/.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------- | -------------------------- | -------------------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | - -## get - -Get an OAuth2 client by Client ID. - -### Example Usage - -```python -from polar_sdk import Polar - - -with Polar( - access_token="", -) as polar: - - res = polar.oauth2.clients.get(client_id="") - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `client_id` | *str* | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[Any](../../models/.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------- | -------------------------- | -------------------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | - -## update - -Update an OAuth2 client. - -### Example Usage - -```python -from polar_sdk import Polar - - -with Polar( - access_token="", -) as polar: - - res = polar.oauth2.clients.update(client_id="", o_auth2_client_configuration_update={ - "redirect_uris": [ - "https://classic-cantaloupe.org", - "https://corrupt-status.biz/", - ], - "client_name": "", - "client_id": "", - }) - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `client_id` | *str* | :heavy_check_mark: | N/A | -| `o_auth2_client_configuration_update` | [models.OAuth2ClientConfigurationUpdate](../../models/oauth2clientconfigurationupdate.md) | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[Any](../../models/.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------- | -------------------------- | -------------------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | - -## delete - -Delete an OAuth2 client. - -### Example Usage - -```python -from polar_sdk import Polar - - -with Polar( - access_token="", -) as polar: - - res = polar.oauth2.clients.delete(client_id="") - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `client_id` | *str* | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[Any](../../models/.md)** - -### Errors - -| Error Type | Status Code | Content Type | -| -------------------------- | -------------------------- | -------------------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/downloadables/README.md b/docs/sdks/downloadables/README.md index 9347b4cf..5f3e76fe 100644 --- a/docs/sdks/downloadables/README.md +++ b/docs/sdks/downloadables/README.md @@ -6,7 +6,6 @@ ### Available Operations * [list](#list) - List Downloadables -* [get](#get) - Get Downloadable ## list @@ -49,45 +48,6 @@ with Polar() as polar: ### Errors -| Error Type | Status Code | Content Type | -| -------------------------- | -------------------------- | -------------------------- | -| models.HTTPValidationError | 422 | application/json | -| models.SDKError | 4XX, 5XX | \*/\* | - -## get - -Get Downloadable - -### Example Usage - -```python -from polar_sdk import Polar - - -with Polar() as polar: - - res = polar.customer_portal.downloadables.get(token="") - - assert res is not None - - # Handle response - print(res) - -``` - -### Parameters - -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | -| `token` | *str* | :heavy_check_mark: | N/A | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | - -### Response - -**[Any](../../models/.md)** - -### Errors - | Error Type | Status Code | Content Type | | -------------------------- | -------------------------- | -------------------------- | | models.HTTPValidationError | 422 | application/json | diff --git a/docs/sdks/events/README.md b/docs/sdks/events/README.md index 51207bca..b0934c48 100644 --- a/docs/sdks/events/README.md +++ b/docs/sdks/events/README.md @@ -44,7 +44,7 @@ with Polar( | `end_timestamp` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Filter events before this timestamp. | | `organization_id` | [OptionalNullable[models.EventsListQueryParamOrganizationIDFilter]](../../models/eventslistqueryparamorganizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `customer_id` | [OptionalNullable[models.EventsListQueryParamCustomerIDFilter]](../../models/eventslistqueryparamcustomeridfilter.md) | :heavy_minus_sign: | Filter by customer ID. | -| `external_customer_id` | [OptionalNullable[models.ExternalCustomerIDFilter]](../../models/externalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | +| `external_customer_id` | [OptionalNullable[models.QueryParamExternalCustomerIDFilter]](../../models/queryparamexternalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | | `meter_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Filter by a meter filter clause. | | `name` | [OptionalNullable[models.NameFilter]](../../models/namefilter.md) | :heavy_minus_sign: | Filter by event name. | | `source` | [OptionalNullable[models.SourceFilter]](../../models/sourcefilter.md) | :heavy_minus_sign: | Filter by event source. | @@ -96,7 +96,7 @@ with Polar( | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `organization_id` | [OptionalNullable[models.EventsListNamesQueryParamOrganizationIDFilter]](../../models/eventslistnamesqueryparamorganizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `customer_id` | [OptionalNullable[models.EventsListNamesQueryParamCustomerIDFilter]](../../models/eventslistnamesqueryparamcustomeridfilter.md) | :heavy_minus_sign: | Filter by customer ID. | -| `external_customer_id` | [OptionalNullable[models.QueryParamExternalCustomerIDFilter]](../../models/queryparamexternalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | +| `external_customer_id` | [OptionalNullable[models.EventsListNamesQueryParamExternalCustomerIDFilter]](../../models/eventslistnamesqueryparamexternalcustomeridfilter.md) | :heavy_minus_sign: | Filter by external customer ID. | | `source` | [OptionalNullable[models.QueryParamSourceFilter]](../../models/queryparamsourcefilter.md) | :heavy_minus_sign: | Filter by event source. | | `query` | *OptionalNullable[str]* | :heavy_minus_sign: | Query to filter event names. | | `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | diff --git a/docs/sdks/metricssdk/README.md b/docs/sdks/metricssdk/README.md index cb0721de..80228376 100644 --- a/docs/sdks/metricssdk/README.md +++ b/docs/sdks/metricssdk/README.md @@ -28,7 +28,7 @@ with Polar( access_token="", ) as polar: - res = polar.metrics.get(start_date=date.fromisoformat("2025-03-14"), end_date=date.fromisoformat("2025-03-18"), interval=polar_sdk.TimeInterval.HOUR, organization_id=None) + res = polar.metrics.get(start_date=date.fromisoformat("2025-03-14"), end_date=date.fromisoformat("2025-03-18"), interval=polar_sdk.TimeInterval.HOUR, timezone="UTC", organization_id=None) # Handle response print(res) @@ -42,6 +42,7 @@ with Polar( | `start_date` | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) | :heavy_check_mark: | Start date. | | `end_date` | [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) | :heavy_check_mark: | End date. | | `interval` | [models.TimeInterval](../../models/timeinterval.md) | :heavy_check_mark: | Interval between two timestamps. | +| `timezone` | *Optional[str]* | :heavy_minus_sign: | Timezone to use for the timestamps. Default is UTC. | | `organization_id` | [OptionalNullable[models.MetricsGetQueryParamOrganizationIDFilter]](../../models/metricsgetqueryparamorganizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `product_id` | [OptionalNullable[models.MetricsGetQueryParamProductIDFilter]](../../models/metricsgetqueryparamproductidfilter.md) | :heavy_minus_sign: | Filter by product ID. | | `billing_type` | [OptionalNullable[models.QueryParamProductBillingTypeFilter]](../../models/queryparamproductbillingtypefilter.md) | :heavy_minus_sign: | Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. | diff --git a/docs/sdks/oauth2/README.md b/docs/sdks/oauth2/README.md index d4cf73f5..b7fb23a9 100644 --- a/docs/sdks/oauth2/README.md +++ b/docs/sdks/oauth2/README.md @@ -58,7 +58,9 @@ Request an access token using a valid grant. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.oauth2.token(request={ "grant_type": "authorization_code", @@ -100,7 +102,9 @@ Revoke an access token or a refresh token. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.oauth2.revoke(request={ "token": "", @@ -140,7 +144,9 @@ Get information about an access token. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.oauth2.introspect(request={ "token": "", diff --git a/docs/sdks/polarcustomers/README.md b/docs/sdks/polarcustomers/README.md index e69656e4..5df2d002 100644 --- a/docs/sdks/polarcustomers/README.md +++ b/docs/sdks/polarcustomers/README.md @@ -7,7 +7,7 @@ * [get](#get) - Get Customer * [update](#update) - Update Customer -* [get_payment_methods](#get_payment_methods) - Get Customer Payment Methods +* [list_payment_methods](#list_payment_methods) - List Customer Payment Methods * [add_payment_method](#add_payment_method) - Add Customer Payment Method * [delete_payment_method](#delete_payment_method) - Delete Customer Payment Method @@ -99,7 +99,7 @@ with Polar() as polar: | models.HTTPValidationError | 422 | application/json | | models.SDKError | 4XX, 5XX | \*/\* | -## get_payment_methods +## list_payment_methods Get saved payment methods of the authenticated customer. @@ -114,7 +114,7 @@ from polar_sdk import Polar with Polar() as polar: - res = polar.customer_portal.customers.get_payment_methods(security=polar_sdk.CustomerPortalCustomersGetPaymentMethodsSecurity( + res = polar.customer_portal.customers.list_payment_methods(security=polar_sdk.CustomerPortalCustomersListPaymentMethodsSecurity( customer_session="", ), page=1, limit=10) @@ -127,16 +127,16 @@ with Polar() as polar: ### Parameters -| Parameter | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `security` | [models.CustomerPortalCustomersGetPaymentMethodsSecurity](../../models/customerportalcustomersgetpaymentmethodssecurity.md) | :heavy_check_mark: | N/A | -| `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | -| `limit` | *Optional[int]* | :heavy_minus_sign: | Size of a page, defaults to 10. Maximum is 100. | -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | +| `security` | [models.CustomerPortalCustomersListPaymentMethodsSecurity](../../models/customerportalcustomerslistpaymentmethodssecurity.md) | :heavy_check_mark: | N/A | +| `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Size of a page, defaults to 10. Maximum is 100. | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response -**[models.CustomerPortalCustomersGetPaymentMethodsResponse](../../models/customerportalcustomersgetpaymentmethodsresponse.md)** +**[models.CustomerPortalCustomersListPaymentMethodsResponse](../../models/customerportalcustomerslistpaymentmethodsresponse.md)** ### Errors diff --git a/docs/sdks/polarlicensekeys/README.md b/docs/sdks/polarlicensekeys/README.md index 67237480..eadfc297 100644 --- a/docs/sdks/polarlicensekeys/README.md +++ b/docs/sdks/polarlicensekeys/README.md @@ -113,7 +113,9 @@ Validate a license key. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.customer_portal.license_keys.validate(request={ "key": "", @@ -154,7 +156,9 @@ Activate a license key instance. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: res = polar.customer_portal.license_keys.activate(request={ "key": "", @@ -197,7 +201,9 @@ Deactivate a license key instance. from polar_sdk import Polar -with Polar() as polar: +with Polar( + access_token="", +) as polar: polar.customer_portal.license_keys.deactivate(request={ "key": "", diff --git a/docs/sdks/subscriptions/README.md b/docs/sdks/subscriptions/README.md index 73b13919..3c0cb547 100644 --- a/docs/sdks/subscriptions/README.md +++ b/docs/sdks/subscriptions/README.md @@ -43,6 +43,7 @@ with Polar( | `organization_id` | [OptionalNullable[models.OrganizationIDFilter]](../../models/organizationidfilter.md) | :heavy_minus_sign: | Filter by organization ID. | | `product_id` | [OptionalNullable[models.ProductIDFilter]](../../models/productidfilter.md) | :heavy_minus_sign: | Filter by product ID. | | `customer_id` | [OptionalNullable[models.CustomerIDFilter]](../../models/customeridfilter.md) | :heavy_minus_sign: | Filter by customer ID. | +| `external_customer_id` | [OptionalNullable[models.ExternalCustomerIDFilter]](../../models/externalcustomeridfilter.md) | :heavy_minus_sign: | Filter by customer external ID. | | `discount_id` | [OptionalNullable[models.DiscountIDFilter]](../../models/discountidfilter.md) | :heavy_minus_sign: | Filter by discount ID. | | `active` | *OptionalNullable[bool]* | :heavy_minus_sign: | Filter by active or inactive subscription. | | `page` | *Optional[int]* | :heavy_minus_sign: | Page number, defaults to 1. | diff --git a/pyproject.toml b/pyproject.toml index a3d3ef7e..190129ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "polar-sdk" -version = "0.22.1" +version = "0.22.2" description = "Polar SDK for Python" authors = [{ name = "Polar" },] readme = "README-PYPI.md" diff --git a/src/polar_sdk/_version.py b/src/polar_sdk/_version.py index 6475e702..b0ec757c 100644 --- a/src/polar_sdk/_version.py +++ b/src/polar_sdk/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "polar-sdk" -__version__: str = "0.22.1" +__version__: str = "0.22.2" __openapi_doc_version__: str = "0.1.0" -__gen_version__: str = "2.632.0" -__user_agent__: str = "speakeasy-sdk/python 0.22.1 2.632.0 0.1.0 polar-sdk" +__gen_version__: str = "2.656.9" +__user_agent__: str = "speakeasy-sdk/python 0.22.2 2.656.9 0.1.0 polar-sdk" try: if __package__ is not None: diff --git a/src/polar_sdk/basesdk.py b/src/polar_sdk/basesdk.py index 7ba95b08..5642112d 100644 --- a/src/polar_sdk/basesdk.py +++ b/src/polar_sdk/basesdk.py @@ -244,7 +244,7 @@ def do(): if http_res is None: logger.debug("Raising no response SDK error") - raise models.SDKError("No response received") + raise models.NoResponseError("No response received") logger.debug( "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s", @@ -265,7 +265,7 @@ def do(): http_res = result else: logger.debug("Raising unexpected SDK error") - raise models.SDKError("Unexpected error occurred") + raise models.SDKError("Unexpected error occurred", http_res) return http_res @@ -316,7 +316,7 @@ async def do(): if http_res is None: logger.debug("Raising no response SDK error") - raise models.SDKError("No response received") + raise models.NoResponseError("No response received") logger.debug( "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s", @@ -337,7 +337,7 @@ async def do(): http_res = result else: logger.debug("Raising unexpected SDK error") - raise models.SDKError("Unexpected error occurred") + raise models.SDKError("Unexpected error occurred", http_res) return http_res diff --git a/src/polar_sdk/benefit_grants.py b/src/polar_sdk/benefit_grants.py index 4d303a8a..bd12f50d 100644 --- a/src/polar_sdk/benefit_grants.py +++ b/src/polar_sdk/benefit_grants.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -178,35 +179,24 @@ def next_func() -> Optional[models.CustomerPortalBenefitGrantsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalBenefitGrantsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerBenefitGrant + result=unmarshal_json_response( + models.ListResourceCustomerBenefitGrant, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -377,35 +367,24 @@ def next_func() -> Optional[models.CustomerPortalBenefitGrantsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalBenefitGrantsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerBenefitGrant + result=unmarshal_json_response( + models.ListResourceCustomerBenefitGrant, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -488,36 +467,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerBenefitGrant) + return unmarshal_json_response(models.CustomerBenefitGrant, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -600,36 +568,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerBenefitGrant) + return unmarshal_json_response(models.CustomerBenefitGrant, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -727,39 +684,28 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerBenefitGrant) + return unmarshal_json_response(models.CustomerBenefitGrant, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -857,36 +803,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerBenefitGrant) + return unmarshal_json_response(models.CustomerBenefitGrant, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/benefits.py b/src/polar_sdk/benefits.py index 8ff7e103..f1408367 100644 --- a/src/polar_sdk/benefits.py +++ b/src/polar_sdk/benefits.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -143,33 +144,22 @@ def next_func() -> Optional[models.BenefitsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.BenefitsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceBenefit), + result=unmarshal_json_response(models.ListResourceBenefit, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -305,33 +295,22 @@ def next_func() -> Optional[models.BenefitsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.BenefitsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceBenefit), + result=unmarshal_json_response(models.ListResourceBenefit, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -410,31 +389,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Benefit) + return unmarshal_json_response(models.Benefit, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -513,31 +481,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Benefit) + return unmarshal_json_response(models.Benefit, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -613,36 +570,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Benefit) + return unmarshal_json_response(models.Benefit, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -718,36 +664,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Benefit) + return unmarshal_json_response(models.Benefit, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -838,36 +773,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Benefit) + return unmarshal_json_response(models.Benefit, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -958,36 +882,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Benefit) + return unmarshal_json_response(models.Benefit, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete( self, @@ -1069,37 +982,26 @@ def delete( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_async( self, @@ -1181,37 +1083,26 @@ async def delete_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def grants( self, @@ -1334,40 +1225,29 @@ def next_func() -> Optional[models.BenefitsGrantsResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.BenefitsGrantsResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceBenefitGrant + result=unmarshal_json_response( + models.ListResourceBenefitGrant, http_res ), next=next_func, ) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def grants_async( self, @@ -1490,37 +1370,26 @@ def next_func() -> Optional[models.BenefitsGrantsResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.BenefitsGrantsResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceBenefitGrant + result=unmarshal_json_response( + models.ListResourceBenefitGrant, http_res ), next=next_func, ) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/checkout_links.py b/src/polar_sdk/checkout_links.py index 1dff505c..109cddca 100644 --- a/src/polar_sdk/checkout_links.py +++ b/src/polar_sdk/checkout_links.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -133,35 +134,24 @@ def next_func() -> Optional[models.CheckoutLinksListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CheckoutLinksListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCheckoutLink + result=unmarshal_json_response( + models.ListResourceCheckoutLink, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -287,35 +277,24 @@ def next_func() -> Optional[models.CheckoutLinksListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CheckoutLinksListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCheckoutLink + result=unmarshal_json_response( + models.ListResourceCheckoutLink, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -403,31 +382,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutLink) + return unmarshal_json_response(models.CheckoutLink, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -515,31 +483,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutLink) + return unmarshal_json_response(models.CheckoutLink, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -615,36 +572,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutLink) + return unmarshal_json_response(models.CheckoutLink, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -720,36 +666,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutLink) + return unmarshal_json_response(models.CheckoutLink, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -839,36 +774,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutLink) + return unmarshal_json_response(models.CheckoutLink, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -958,36 +882,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutLink) + return unmarshal_json_response(models.CheckoutLink, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete( self, @@ -1065,34 +978,23 @@ def delete( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_async( self, @@ -1170,31 +1072,20 @@ async def delete_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/checkouts.py b/src/polar_sdk/checkouts.py index 75ea97cc..4ab2b997 100644 --- a/src/polar_sdk/checkouts.py +++ b/src/polar_sdk/checkouts.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -152,33 +153,22 @@ def next_func() -> Optional[models.CheckoutsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CheckoutsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceCheckout), + result=unmarshal_json_response(models.ListResourceCheckout, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -323,33 +313,22 @@ def next_func() -> Optional[models.CheckoutsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CheckoutsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceCheckout), + result=unmarshal_json_response(models.ListResourceCheckout, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -428,31 +407,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Checkout) + return unmarshal_json_response(models.Checkout, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -531,31 +499,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Checkout) + return unmarshal_json_response(models.Checkout, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -631,36 +588,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Checkout) + return unmarshal_json_response(models.Checkout, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -736,36 +682,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Checkout) + return unmarshal_json_response(models.Checkout, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -849,41 +784,30 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Checkout) + return unmarshal_json_response(models.Checkout, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.CheckoutForbiddenErrorUnion + response_data = unmarshal_json_response( + models.CheckoutForbiddenErrorUnion, http_res ) - raise models.CheckoutForbiddenError(data=response_data) + raise models.CheckoutForbiddenError(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -967,41 +891,30 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Checkout) + return unmarshal_json_response(models.Checkout, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.CheckoutForbiddenErrorUnion + response_data = unmarshal_json_response( + models.CheckoutForbiddenErrorUnion, http_res ) - raise models.CheckoutForbiddenError(data=response_data) + raise models.CheckoutForbiddenError(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def client_get( self, @@ -1044,10 +957,11 @@ def client_get( request=request, request_body_required=False, request_has_path_params=True, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1065,7 +979,7 @@ def client_get( base_url=base_url or "", operation_id="checkouts:client_get", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["404", "410", "422", "4XX", "5XX"], @@ -1074,41 +988,30 @@ def client_get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutPublic) + return unmarshal_json_response(models.CheckoutPublic, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "410", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ExpiredCheckoutErrorData + response_data = unmarshal_json_response( + models.ExpiredCheckoutErrorData, http_res ) - raise models.ExpiredCheckoutError(data=response_data) + raise models.ExpiredCheckoutError(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def client_get_async( self, @@ -1151,10 +1054,11 @@ async def client_get_async( request=request, request_body_required=False, request_has_path_params=True, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, timeout_ms=timeout_ms, ) @@ -1172,7 +1076,7 @@ async def client_get_async( base_url=base_url or "", operation_id="checkouts:client_get", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["404", "410", "422", "4XX", "5XX"], @@ -1181,41 +1085,30 @@ async def client_get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutPublic) + return unmarshal_json_response(models.CheckoutPublic, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "410", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ExpiredCheckoutErrorData + response_data = unmarshal_json_response( + models.ExpiredCheckoutErrorData, http_res ) - raise models.ExpiredCheckoutError(data=response_data) + raise models.ExpiredCheckoutError(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def client_update( self, @@ -1265,10 +1158,11 @@ def client_update( request=request, request_body_required=True, request_has_path_params=True, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.checkout_update_public, False, @@ -1293,7 +1187,7 @@ def client_update( base_url=base_url or "", operation_id="checkouts:client_update", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["403", "404", "410", "422", "4XX", "5XX"], @@ -1302,46 +1196,35 @@ def client_update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutPublic) + return unmarshal_json_response(models.CheckoutPublic, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.CheckoutForbiddenErrorUnion + response_data = unmarshal_json_response( + models.CheckoutForbiddenErrorUnion, http_res ) - raise models.CheckoutForbiddenError(data=response_data) + raise models.CheckoutForbiddenError(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "410", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ExpiredCheckoutErrorData + response_data = unmarshal_json_response( + models.ExpiredCheckoutErrorData, http_res ) - raise models.ExpiredCheckoutError(data=response_data) + raise models.ExpiredCheckoutError(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def client_update_async( self, @@ -1391,10 +1274,11 @@ async def client_update_async( request=request, request_body_required=True, request_has_path_params=True, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request.checkout_update_public, False, @@ -1419,7 +1303,7 @@ async def client_update_async( base_url=base_url or "", operation_id="checkouts:client_update", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["403", "404", "410", "422", "4XX", "5XX"], @@ -1428,46 +1312,35 @@ async def client_update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutPublic) + return unmarshal_json_response(models.CheckoutPublic, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.CheckoutForbiddenErrorUnion + response_data = unmarshal_json_response( + models.CheckoutForbiddenErrorUnion, http_res ) - raise models.CheckoutForbiddenError(data=response_data) + raise models.CheckoutForbiddenError(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "410", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ExpiredCheckoutErrorData + response_data = unmarshal_json_response( + models.ExpiredCheckoutErrorData, http_res ) - raise models.ExpiredCheckoutError(data=response_data) + raise models.ExpiredCheckoutError(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def client_confirm( self, @@ -1557,49 +1430,38 @@ def client_confirm( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutPublicConfirmed) + return unmarshal_json_response(models.CheckoutPublicConfirmed, http_res) if utils.match_response(http_res, "400", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.PaymentErrorData) - raise models.PaymentError(data=response_data) + response_data = unmarshal_json_response(models.PaymentErrorData, http_res) + raise models.PaymentError(response_data, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.CheckoutForbiddenErrorUnion + response_data = unmarshal_json_response( + models.CheckoutForbiddenErrorUnion, http_res ) - raise models.CheckoutForbiddenError(data=response_data) + raise models.CheckoutForbiddenError(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "410", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ExpiredCheckoutErrorData + response_data = unmarshal_json_response( + models.ExpiredCheckoutErrorData, http_res ) - raise models.ExpiredCheckoutError(data=response_data) + raise models.ExpiredCheckoutError(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def client_confirm_async( self, @@ -1689,46 +1551,35 @@ async def client_confirm_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CheckoutPublicConfirmed) + return unmarshal_json_response(models.CheckoutPublicConfirmed, http_res) if utils.match_response(http_res, "400", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.PaymentErrorData) - raise models.PaymentError(data=response_data) + response_data = unmarshal_json_response(models.PaymentErrorData, http_res) + raise models.PaymentError(response_data, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.CheckoutForbiddenErrorUnion + response_data = unmarshal_json_response( + models.CheckoutForbiddenErrorUnion, http_res ) - raise models.CheckoutForbiddenError(data=response_data) + raise models.CheckoutForbiddenError(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "410", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ExpiredCheckoutErrorData + response_data = unmarshal_json_response( + models.ExpiredCheckoutErrorData, http_res ) - raise models.ExpiredCheckoutError(data=response_data) + raise models.ExpiredCheckoutError(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/clients.py b/src/polar_sdk/clients.py deleted file mode 100644 index f386d2c7..00000000 --- a/src/polar_sdk/clients.py +++ /dev/null @@ -1,1096 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from .basesdk import BaseSDK -from jsonpath import JSONPath -from polar_sdk import models, utils -from polar_sdk._hooks import HookContext -from polar_sdk.types import BaseModel, OptionalNullable, UNSET -from typing import Any, Dict, List, Mapping, Optional, Union, cast - - -class Clients(BaseSDK): - def list( - self, - *, - page: Optional[int] = 1, - limit: Optional[int] = 10, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[models.Oauth2ClientsListResponse]: - r"""List Clients - - List OAuth2 clients. - - :param page: Page number, defaults to 1. - :param limit: Size of a page, defaults to 10. Maximum is 100. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsListRequest( - page=page, - limit=limit, - ) - - req = self._build_request( - method="GET", - path="/v1/oauth2/", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:list", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - def next_func() -> Optional[models.Oauth2ClientsListResponse]: - body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) - page = request.page if not request.page is None else 1 - next_page = page + 1 - - num_pages = JSONPath("$.pagination.max_page").parse(body) - if len(num_pages) == 0 or num_pages[0] <= page: - return None - - if not http_res.text: - return None - results = JSONPath("$.items").parse(body) - if len(results) == 0 or len(results[0]) == 0: - return None - limit = request.limit if not request.limit is None else 10 - if len(results[0]) < limit: - return None - - return self.list( - page=next_page, - limit=limit, - retries=retries, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return models.Oauth2ClientsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceOAuth2Client - ), - next=next_func, - ) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def list_async( - self, - *, - page: Optional[int] = 1, - limit: Optional[int] = 10, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[models.Oauth2ClientsListResponse]: - r"""List Clients - - List OAuth2 clients. - - :param page: Page number, defaults to 1. - :param limit: Size of a page, defaults to 10. Maximum is 100. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsListRequest( - page=page, - limit=limit, - ) - - req = self._build_request_async( - method="GET", - path="/v1/oauth2/", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:list", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - def next_func() -> Optional[models.Oauth2ClientsListResponse]: - body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) - page = request.page if not request.page is None else 1 - next_page = page + 1 - - num_pages = JSONPath("$.pagination.max_page").parse(body) - if len(num_pages) == 0 or num_pages[0] <= page: - return None - - if not http_res.text: - return None - results = JSONPath("$.items").parse(body) - if len(results) == 0 or len(results[0]) == 0: - return None - limit = request.limit if not request.limit is None else 10 - if len(results[0]) < limit: - return None - - return self.list( - page=next_page, - limit=limit, - retries=retries, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return models.Oauth2ClientsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceOAuth2Client - ), - next=next_func, - ) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - def create( - self, - *, - request: Union[ - models.OAuth2ClientConfiguration, models.OAuth2ClientConfigurationTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Create Client - - Create an OAuth2 client. - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.OAuth2ClientConfiguration) - request = cast(models.OAuth2ClientConfiguration, request) - - req = self._build_request( - method="POST", - path="/v1/oauth2/register", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.OAuth2ClientConfiguration - ), - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:create_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def create_async( - self, - *, - request: Union[ - models.OAuth2ClientConfiguration, models.OAuth2ClientConfigurationTypedDict - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Create Client - - Create an OAuth2 client. - - :param request: The request object to send. - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - if not isinstance(request, BaseModel): - request = utils.unmarshal(request, models.OAuth2ClientConfiguration) - request = cast(models.OAuth2ClientConfiguration, request) - - req = self._build_request_async( - method="POST", - path="/v1/oauth2/register", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=False, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request, False, False, "json", models.OAuth2ClientConfiguration - ), - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:create_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - def get( - self, - *, - client_id: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Get Client - - Get an OAuth2 client by Client ID. - - :param client_id: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsOauth2GetClientRequest( - client_id=client_id, - ) - - req = self._build_request( - method="GET", - path="/v1/oauth2/register/{client_id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:get_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def get_async( - self, - *, - client_id: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Get Client - - Get an OAuth2 client by Client ID. - - :param client_id: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsOauth2GetClientRequest( - client_id=client_id, - ) - - req = self._build_request_async( - method="GET", - path="/v1/oauth2/register/{client_id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:get_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - def update( - self, - *, - client_id: str, - o_auth2_client_configuration_update: Union[ - models.OAuth2ClientConfigurationUpdate, - models.OAuth2ClientConfigurationUpdateTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Update Client - - Update an OAuth2 client. - - :param client_id: - :param o_auth2_client_configuration_update: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsOauth2UpdateClientRequest( - client_id=client_id, - o_auth2_client_configuration_update=utils.get_pydantic_model( - o_auth2_client_configuration_update, - models.OAuth2ClientConfigurationUpdate, - ), - ) - - req = self._build_request( - method="PUT", - path="/v1/oauth2/register/{client_id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.o_auth2_client_configuration_update, - False, - False, - "json", - models.OAuth2ClientConfigurationUpdate, - ), - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:update_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def update_async( - self, - *, - client_id: str, - o_auth2_client_configuration_update: Union[ - models.OAuth2ClientConfigurationUpdate, - models.OAuth2ClientConfigurationUpdateTypedDict, - ], - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Update Client - - Update an OAuth2 client. - - :param client_id: - :param o_auth2_client_configuration_update: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsOauth2UpdateClientRequest( - client_id=client_id, - o_auth2_client_configuration_update=utils.get_pydantic_model( - o_auth2_client_configuration_update, - models.OAuth2ClientConfigurationUpdate, - ), - ) - - req = self._build_request_async( - method="PUT", - path="/v1/oauth2/register/{client_id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=True, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - get_serialized_body=lambda: utils.serialize_request_body( - request.o_auth2_client_configuration_update, - False, - False, - "json", - models.OAuth2ClientConfigurationUpdate, - ), - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:update_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - def delete( - self, - *, - client_id: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Delete Client - - Delete an OAuth2 client. - - :param client_id: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsOauth2DeleteClientRequest( - client_id=client_id, - ) - - req = self._build_request( - method="DELETE", - path="/v1/oauth2/register/{client_id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:delete_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def delete_async( - self, - *, - client_id: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Any: - r"""Delete Client - - Delete an OAuth2 client. - - :param client_id: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = models.Oauth2ClientsOauth2DeleteClientRequest( - client_id=client_id, - ) - - req = self._build_request_async( - method="DELETE", - path="/v1/oauth2/register/{client_id}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=True, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - security=self.sdk_configuration.security, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="oauth2:clients:oauth2:delete_client", - oauth2_scopes=[], - security_source=self.sdk_configuration.security, - ), - request=req, - error_status_codes=["422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, "4XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) diff --git a/src/polar_sdk/custom_fields.py b/src/polar_sdk/custom_fields.py index 642f4d88..66bcf218 100644 --- a/src/polar_sdk/custom_fields.py +++ b/src/polar_sdk/custom_fields.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -134,35 +135,24 @@ def next_func() -> Optional[models.CustomFieldsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomFieldsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomField + result=unmarshal_json_response( + models.ListResourceCustomField, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -289,35 +279,24 @@ def next_func() -> Optional[models.CustomFieldsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomFieldsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomField + result=unmarshal_json_response( + models.ListResourceCustomField, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -396,31 +375,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomField) + return unmarshal_json_response(models.CustomField, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -499,31 +467,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomField) + return unmarshal_json_response(models.CustomField, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -599,36 +556,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomField) + return unmarshal_json_response(models.CustomField, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -704,36 +650,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomField) + return unmarshal_json_response(models.CustomField, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -823,36 +758,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomField) + return unmarshal_json_response(models.CustomField, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -942,36 +866,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomField) + return unmarshal_json_response(models.CustomField, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete( self, @@ -1049,34 +962,23 @@ def delete( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_async( self, @@ -1154,31 +1056,20 @@ async def delete_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/customer_meters.py b/src/polar_sdk/customer_meters.py index a799a1e6..979e0e96 100644 --- a/src/polar_sdk/customer_meters.py +++ b/src/polar_sdk/customer_meters.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -150,35 +151,24 @@ def next_func() -> Optional[models.CustomerMetersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerMetersListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerMeter + result=unmarshal_json_response( + models.ListResourceCustomerMeter, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -321,35 +311,24 @@ def next_func() -> Optional[models.CustomerMetersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerMetersListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerMeter + result=unmarshal_json_response( + models.ListResourceCustomerMeter, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -425,36 +404,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerMeter) + return unmarshal_json_response(models.CustomerMeter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -530,33 +498,22 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerMeter) + return unmarshal_json_response(models.CustomerMeter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/customer_sessions.py b/src/polar_sdk/customer_sessions.py index 3fcf080f..91aebf2e 100644 --- a/src/polar_sdk/customer_sessions.py +++ b/src/polar_sdk/customer_sessions.py @@ -4,6 +4,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Mapping, Optional, Union, cast @@ -94,31 +95,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSession) + return unmarshal_json_response(models.CustomerSession, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -206,28 +196,17 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSession) + return unmarshal_json_response(models.CustomerSession, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/customers.py b/src/polar_sdk/customers.py index ea57f6c3..ab247a62 100644 --- a/src/polar_sdk/customers.py +++ b/src/polar_sdk/customers.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -141,33 +142,22 @@ def next_func() -> Optional[models.CustomersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomersListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceCustomer), + result=unmarshal_json_response(models.ListResourceCustomer, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -301,33 +291,22 @@ def next_func() -> Optional[models.CustomersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomersListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceCustomer), + result=unmarshal_json_response(models.ListResourceCustomer, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -406,31 +385,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -509,31 +477,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -609,36 +566,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -714,36 +660,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -827,36 +762,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -940,36 +864,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete( self, @@ -1059,34 +972,23 @@ def delete( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_async( self, @@ -1176,34 +1078,23 @@ async def delete_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get_external( self, @@ -1279,36 +1170,25 @@ def get_external( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_external_async( self, @@ -1384,36 +1264,25 @@ async def get_external_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update_external( self, @@ -1503,36 +1372,25 @@ def update_external( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_external_async( self, @@ -1622,36 +1480,25 @@ async def update_external_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Customer) + return unmarshal_json_response(models.Customer, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete_external( self, @@ -1731,34 +1578,23 @@ def delete_external( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_external_async( self, @@ -1838,34 +1674,23 @@ async def delete_external_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get_state( self, @@ -1947,36 +1772,25 @@ def get_state( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerState) + return unmarshal_json_response(models.CustomerState, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_state_async( self, @@ -2058,36 +1872,25 @@ async def get_state_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerState) + return unmarshal_json_response(models.CustomerState, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get_state_external( self, @@ -2169,36 +1972,25 @@ def get_state_external( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerState) + return unmarshal_json_response(models.CustomerState, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_state_external_async( self, @@ -2280,33 +2072,22 @@ async def get_state_external_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerState) + return unmarshal_json_response(models.CustomerState, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/discounts.py b/src/polar_sdk/discounts.py index 94b7e109..ee2416a2 100644 --- a/src/polar_sdk/discounts.py +++ b/src/polar_sdk/discounts.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -128,33 +129,22 @@ def next_func() -> Optional[models.DiscountsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DiscountsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceDiscount), + result=unmarshal_json_response(models.ListResourceDiscount, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -275,33 +265,22 @@ def next_func() -> Optional[models.DiscountsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.DiscountsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceDiscount), + result=unmarshal_json_response(models.ListResourceDiscount, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -380,31 +359,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Discount) + return unmarshal_json_response(models.Discount, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -483,31 +451,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Discount) + return unmarshal_json_response(models.Discount, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -583,36 +540,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Discount) + return unmarshal_json_response(models.Discount, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -688,36 +634,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Discount) + return unmarshal_json_response(models.Discount, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -801,36 +736,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Discount) + return unmarshal_json_response(models.Discount, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -914,36 +838,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Discount) + return unmarshal_json_response(models.Discount, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete( self, @@ -1021,34 +934,23 @@ def delete( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_async( self, @@ -1126,31 +1028,20 @@ async def delete_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/downloadables.py b/src/polar_sdk/downloadables.py index b357007c..6419e1e1 100644 --- a/src/polar_sdk/downloadables.py +++ b/src/polar_sdk/downloadables.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -135,35 +136,24 @@ def next_func() -> Optional[models.CustomerPortalDownloadablesListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalDownloadablesListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceDownloadableRead + result=unmarshal_json_response( + models.ListResourceDownloadableRead, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -291,230 +281,21 @@ def next_func() -> Optional[models.CustomerPortalDownloadablesListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalDownloadablesListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceDownloadableRead + result=unmarshal_json_response( + models.ListResourceDownloadableRead, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - def get( - self, - *, - token: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[Any]: - r"""Get Downloadable - - :param token: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = ( - models.CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest( - token=token, - ) - ) - - req = self._build_request( - method="GET", - path="/v1/customer-portal/downloadables/{token}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=False, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = self.do_request( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="customer_portal:downloadables:customer_portal.downloadables.get", - oauth2_scopes=[], - security_source=None, - ), - request=req, - error_status_codes=["400", "404", "410", "422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "302", "*"): - return None - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, ["400", "404", "410", "4XX"], "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - if utils.match_response(http_res, "5XX", "*"): - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) - - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) - - async def get_async( - self, - *, - token: str, - retries: OptionalNullable[utils.RetryConfig] = UNSET, - server_url: Optional[str] = None, - timeout_ms: Optional[int] = None, - http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[Any]: - r"""Get Downloadable - - :param token: - :param retries: Override the default retry configuration for this method - :param server_url: Override the default server URL for this method - :param timeout_ms: Override the default request timeout configuration for this method in milliseconds - :param http_headers: Additional headers to set or replace on requests. - """ - base_url = None - url_variables = None - if timeout_ms is None: - timeout_ms = self.sdk_configuration.timeout_ms - - if server_url is not None: - base_url = server_url - else: - base_url = self._get_url(base_url, url_variables) - - request = ( - models.CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest( - token=token, - ) - ) - - req = self._build_request_async( - method="GET", - path="/v1/customer-portal/downloadables/{token}", - base_url=base_url, - url_variables=url_variables, - request=request, - request_body_required=False, - request_has_path_params=True, - request_has_query_params=False, - user_agent_header="user-agent", - accept_header_value="application/json", - http_headers=http_headers, - timeout_ms=timeout_ms, - ) - - if retries == UNSET: - if self.sdk_configuration.retry_config is not UNSET: - retries = self.sdk_configuration.retry_config - - retry_config = None - if isinstance(retries, utils.RetryConfig): - retry_config = (retries, ["429", "500", "502", "503", "504"]) - - http_res = await self.do_request_async( - hook_ctx=HookContext( - config=self.sdk_configuration, - base_url=base_url or "", - operation_id="customer_portal:downloadables:customer_portal.downloadables.get", - oauth2_scopes=[], - security_source=None, - ), - request=req, - error_status_codes=["400", "404", "410", "422", "4XX", "5XX"], - retry_config=retry_config, - ) - - response_data: Any = None - if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) - if utils.match_response(http_res, "302", "*"): - return None - if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData - ) - raise models.HTTPValidationError(data=response_data) - if utils.match_response(http_res, ["400", "404", "410", "4XX"], "*"): - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/events.py b/src/polar_sdk/events.py index 6d9c3c81..bfbf8517 100644 --- a/src/polar_sdk/events.py +++ b/src/polar_sdk/events.py @@ -6,6 +6,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -30,8 +31,8 @@ def list( ] = UNSET, external_customer_id: OptionalNullable[ Union[ - models.ExternalCustomerIDFilter, - models.ExternalCustomerIDFilterTypedDict, + models.QueryParamExternalCustomerIDFilter, + models.QueryParamExternalCustomerIDFilterTypedDict, ] ] = UNSET, meter_id: OptionalNullable[str] = UNSET, @@ -180,33 +181,22 @@ def next_func() -> Optional[models.EventsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.EventsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceEvent), + result=unmarshal_json_response(models.ListResourceEvent, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -228,8 +218,8 @@ async def list_async( ] = UNSET, external_customer_id: OptionalNullable[ Union[ - models.ExternalCustomerIDFilter, - models.ExternalCustomerIDFilterTypedDict, + models.QueryParamExternalCustomerIDFilter, + models.QueryParamExternalCustomerIDFilterTypedDict, ] ] = UNSET, meter_id: OptionalNullable[str] = UNSET, @@ -378,33 +368,22 @@ def next_func() -> Optional[models.EventsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.EventsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceEvent), + result=unmarshal_json_response(models.ListResourceEvent, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def list_names( self, @@ -423,8 +402,8 @@ def list_names( ] = UNSET, external_customer_id: OptionalNullable[ Union[ - models.QueryParamExternalCustomerIDFilter, - models.QueryParamExternalCustomerIDFilterTypedDict, + models.EventsListNamesQueryParamExternalCustomerIDFilter, + models.EventsListNamesQueryParamExternalCustomerIDFilterTypedDict, ] ] = UNSET, source: OptionalNullable[ @@ -549,35 +528,22 @@ def next_func() -> Optional[models.EventsListNamesResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.EventsListNamesResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceEventName - ), + result=unmarshal_json_response(models.ListResourceEventName, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_names_async( self, @@ -596,8 +562,8 @@ async def list_names_async( ] = UNSET, external_customer_id: OptionalNullable[ Union[ - models.QueryParamExternalCustomerIDFilter, - models.QueryParamExternalCustomerIDFilterTypedDict, + models.EventsListNamesQueryParamExternalCustomerIDFilter, + models.EventsListNamesQueryParamExternalCustomerIDFilterTypedDict, ] ] = UNSET, source: OptionalNullable[ @@ -722,35 +688,22 @@ def next_func() -> Optional[models.EventsListNamesResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.EventsListNamesResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceEventName - ), + result=unmarshal_json_response(models.ListResourceEventName, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -826,36 +779,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Event) + return unmarshal_json_response(models.Event, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -931,36 +873,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Event) + return unmarshal_json_response(models.Event, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def ingest( self, @@ -1039,31 +970,20 @@ def ingest( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.EventsIngestResponse) + return unmarshal_json_response(models.EventsIngestResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def ingest_async( self, @@ -1142,28 +1062,17 @@ async def ingest_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.EventsIngestResponse) + return unmarshal_json_response(models.EventsIngestResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/files.py b/src/polar_sdk/files.py index 3d529cc8..6a00837c 100644 --- a/src/polar_sdk/files.py +++ b/src/polar_sdk/files.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -126,33 +127,22 @@ def next_func() -> Optional[models.FilesListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.FilesListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceFileRead), + result=unmarshal_json_response(models.ListResourceFileRead, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -271,33 +261,22 @@ def next_func() -> Optional[models.FilesListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.FilesListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceFileRead), + result=unmarshal_json_response(models.ListResourceFileRead, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -376,31 +355,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.FileUpload) + return unmarshal_json_response(models.FileUpload, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -479,31 +447,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.FileUpload) + return unmarshal_json_response(models.FileUpload, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def uploaded( self, @@ -593,41 +550,30 @@ def uploaded( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.FilesUploadedResponseFilesUploaded + return unmarshal_json_response( + models.FilesUploadedResponseFilesUploaded, http_res ) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def uploaded_async( self, @@ -717,41 +663,30 @@ async def uploaded_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.FilesUploadedResponseFilesUploaded + return unmarshal_json_response( + models.FilesUploadedResponseFilesUploaded, http_res ) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -833,41 +768,30 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.FilesUpdateResponseFilesUpdate + return unmarshal_json_response( + models.FilesUpdateResponseFilesUpdate, http_res ) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -949,41 +873,30 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.FilesUpdateResponseFilesUpdate + return unmarshal_json_response( + models.FilesUpdateResponseFilesUpdate, http_res ) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete( self, @@ -1061,37 +974,26 @@ def delete( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_async( self, @@ -1169,34 +1071,23 @@ async def delete_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/license_keys.py b/src/polar_sdk/license_keys.py index f3be8398..fd1faf38 100644 --- a/src/polar_sdk/license_keys.py +++ b/src/polar_sdk/license_keys.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -129,43 +130,32 @@ def next_func() -> Optional[models.LicenseKeysListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.LicenseKeysListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceLicenseKeyRead + result=unmarshal_json_response( + models.ListResourceLicenseKeyRead, http_res ), next=next_func, ) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -287,43 +277,32 @@ def next_func() -> Optional[models.LicenseKeysListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.LicenseKeysListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceLicenseKeyRead + result=unmarshal_json_response( + models.ListResourceLicenseKeyRead, http_res ), next=next_func, ) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -399,39 +378,28 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyWithActivations) + return unmarshal_json_response(models.LicenseKeyWithActivations, http_res) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -507,39 +475,28 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyWithActivations) + return unmarshal_json_response(models.LicenseKeyWithActivations, http_res) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -629,39 +586,28 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyRead) + return unmarshal_json_response(models.LicenseKeyRead, http_res) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -751,39 +697,28 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyRead) + return unmarshal_json_response(models.LicenseKeyRead, http_res) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get_activation( self, @@ -862,39 +797,28 @@ def get_activation( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyActivationRead) + return unmarshal_json_response(models.LicenseKeyActivationRead, http_res) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_activation_async( self, @@ -973,36 +897,25 @@ async def get_activation_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyActivationRead) + return unmarshal_json_response(models.LicenseKeyActivationRead, http_res) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/meters.py b/src/polar_sdk/meters.py index e3757056..1ffbd959 100644 --- a/src/polar_sdk/meters.py +++ b/src/polar_sdk/meters.py @@ -6,6 +6,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -138,33 +139,22 @@ def next_func() -> Optional[models.MetersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.MetersListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceMeter), + result=unmarshal_json_response(models.ListResourceMeter, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -294,33 +284,22 @@ def next_func() -> Optional[models.MetersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.MetersListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceMeter), + result=unmarshal_json_response(models.ListResourceMeter, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -399,31 +378,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Meter) + return unmarshal_json_response(models.Meter, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -502,31 +470,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Meter) + return unmarshal_json_response(models.Meter, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -602,36 +559,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Meter) + return unmarshal_json_response(models.Meter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -707,36 +653,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Meter) + return unmarshal_json_response(models.Meter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -818,36 +753,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Meter) + return unmarshal_json_response(models.Meter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -929,36 +853,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Meter) + return unmarshal_json_response(models.Meter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def quantities( self, @@ -1067,36 +980,25 @@ def quantities( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.MeterQuantities) + return unmarshal_json_response(models.MeterQuantities, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def quantities_async( self, @@ -1205,33 +1107,22 @@ async def quantities_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.MeterQuantities) + return unmarshal_json_response(models.MeterQuantities, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/metrics_sdk.py b/src/polar_sdk/metrics_sdk.py index 2a4238c6..bb17b138 100644 --- a/src/polar_sdk/metrics_sdk.py +++ b/src/polar_sdk/metrics_sdk.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Mapping, Optional, Union @@ -15,6 +16,7 @@ def get( start_date: date, end_date: date, interval: models.TimeInterval, + timezone: Optional[str] = "UTC", organization_id: OptionalNullable[ Union[ models.MetricsGetQueryParamOrganizationIDFilter, @@ -55,6 +57,7 @@ def get( :param start_date: Start date. :param end_date: End date. :param interval: Interval between two timestamps. + :param timezone: Timezone to use for the timestamps. Default is UTC. :param organization_id: Filter by organization ID. :param product_id: Filter by product ID. :param billing_type: Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. @@ -77,6 +80,7 @@ def get( request = models.MetricsGetRequest( start_date=start_date, end_date=end_date, + timezone=timezone, interval=interval, organization_id=organization_id, product_id=product_id, @@ -123,31 +127,20 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.MetricsResponse) + return unmarshal_json_response(models.MetricsResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -155,6 +148,7 @@ async def get_async( start_date: date, end_date: date, interval: models.TimeInterval, + timezone: Optional[str] = "UTC", organization_id: OptionalNullable[ Union[ models.MetricsGetQueryParamOrganizationIDFilter, @@ -195,6 +189,7 @@ async def get_async( :param start_date: Start date. :param end_date: End date. :param interval: Interval between two timestamps. + :param timezone: Timezone to use for the timestamps. Default is UTC. :param organization_id: Filter by organization ID. :param product_id: Filter by product ID. :param billing_type: Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. @@ -217,6 +212,7 @@ async def get_async( request = models.MetricsGetRequest( start_date=start_date, end_date=end_date, + timezone=timezone, interval=interval, organization_id=organization_id, product_id=product_id, @@ -263,31 +259,20 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.MetricsResponse) + return unmarshal_json_response(models.MetricsResponse, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def limits( self, @@ -355,26 +340,15 @@ def limits( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.MetricsLimits) + return unmarshal_json_response(models.MetricsLimits, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def limits_async( self, @@ -442,23 +416,12 @@ async def limits_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.MetricsLimits) + return unmarshal_json_response(models.MetricsLimits, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/models/__init__.py b/src/polar_sdk/models/__init__.py index 886050d0..f60ccfc5 100644 --- a/src/polar_sdk/models/__init__.py +++ b/src/polar_sdk/models/__init__.py @@ -336,6 +336,7 @@ from .benefitsortproperty import BenefitSortProperty from .benefittype import BenefitType from .benefitupdatedevent import BenefitUpdatedEvent, BenefitUpdatedEventTypedDict + from .billingaddressfieldmode import BillingAddressFieldMode from .cardpayment import CardPayment, CardPaymentTypedDict from .cardpaymentmetadata import CardPaymentMetadata, CardPaymentMetadataTypedDict from .checkout import ( @@ -378,6 +379,10 @@ CheckoutLinksUpdateRequest, CheckoutLinksUpdateRequestTypedDict, ) + from .checkoutbillingaddressfields import ( + CheckoutBillingAddressFields, + CheckoutBillingAddressFieldsTypedDict, + ) from .checkoutconfirmstripe import ( CheckoutConfirmStripe, CheckoutConfirmStripeCustomFieldData, @@ -394,10 +399,6 @@ CheckoutCreateMetadataTypedDict, CheckoutCreateTypedDict, ) - from .checkoutcustomerbillingaddressfields import ( - CheckoutCustomerBillingAddressFields, - CheckoutCustomerBillingAddressFieldsTypedDict, - ) from .checkoutdiscountfixedonceforeverduration import ( CheckoutDiscountFixedOnceForeverDuration, CheckoutDiscountFixedOnceForeverDurationTypedDict, @@ -643,26 +644,22 @@ CustomerPortalCustomersDeletePaymentMethodSecurity, CustomerPortalCustomersDeletePaymentMethodSecurityTypedDict, ) - from .customer_portal_customers_get_payment_methodsop import ( - CustomerPortalCustomersGetPaymentMethodsRequest, - CustomerPortalCustomersGetPaymentMethodsRequestTypedDict, - CustomerPortalCustomersGetPaymentMethodsResponse, - CustomerPortalCustomersGetPaymentMethodsResponseTypedDict, - CustomerPortalCustomersGetPaymentMethodsSecurity, - CustomerPortalCustomersGetPaymentMethodsSecurityTypedDict, - ) from .customer_portal_customers_getop import ( CustomerPortalCustomersGetSecurity, CustomerPortalCustomersGetSecurityTypedDict, ) + from .customer_portal_customers_list_payment_methodsop import ( + CustomerPortalCustomersListPaymentMethodsRequest, + CustomerPortalCustomersListPaymentMethodsRequestTypedDict, + CustomerPortalCustomersListPaymentMethodsResponse, + CustomerPortalCustomersListPaymentMethodsResponseTypedDict, + CustomerPortalCustomersListPaymentMethodsSecurity, + CustomerPortalCustomersListPaymentMethodsSecurityTypedDict, + ) from .customer_portal_customers_updateop import ( CustomerPortalCustomersUpdateSecurity, CustomerPortalCustomersUpdateSecurityTypedDict, ) - from .customer_portal_downloadables_customer_portal_downloadables_getop import ( - CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest, - CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequestTypedDict, - ) from .customer_portal_downloadables_listop import ( CustomerPortalDownloadablesListQueryParamBenefitIDFilter, CustomerPortalDownloadablesListQueryParamBenefitIDFilterTypedDict, @@ -1271,14 +1268,14 @@ from .events_list_namesop import ( EventsListNamesQueryParamCustomerIDFilter, EventsListNamesQueryParamCustomerIDFilterTypedDict, + EventsListNamesQueryParamExternalCustomerIDFilter, + EventsListNamesQueryParamExternalCustomerIDFilterTypedDict, EventsListNamesQueryParamOrganizationIDFilter, EventsListNamesQueryParamOrganizationIDFilterTypedDict, EventsListNamesRequest, EventsListNamesRequestTypedDict, EventsListNamesResponse, EventsListNamesResponseTypedDict, - QueryParamExternalCustomerIDFilter, - QueryParamExternalCustomerIDFilterTypedDict, QueryParamSourceFilter, QueryParamSourceFilterTypedDict, ) @@ -1493,10 +1490,6 @@ ListResourceLicenseKeyReadTypedDict, ) from .listresource_meter_ import ListResourceMeter, ListResourceMeterTypedDict - from .listresource_oauth2client_ import ( - ListResourceOAuth2Client, - ListResourceOAuth2ClientTypedDict, - ) from .listresource_order_ import ListResourceOrder, ListResourceOrderTypedDict from .listresource_organization_ import ( ListResourceOrganization, @@ -1655,6 +1648,7 @@ MissingInvoiceBillingDetails, MissingInvoiceBillingDetailsData, ) + from .no_response_error import NoResponseError from .notopencheckout import NotOpenCheckout, NotOpenCheckoutData from .notpaidorder import NotPaidOrder, NotPaidOrderData from .notpermitted import NotPermitted, NotPermittedData @@ -1662,24 +1656,6 @@ Oauth2AuthorizeResponseOauth2Authorize, Oauth2AuthorizeResponseOauth2AuthorizeTypedDict, ) - from .oauth2_clients_listop import ( - Oauth2ClientsListRequest, - Oauth2ClientsListRequestTypedDict, - Oauth2ClientsListResponse, - Oauth2ClientsListResponseTypedDict, - ) - from .oauth2_clients_oauth2_delete_clientop import ( - Oauth2ClientsOauth2DeleteClientRequest, - Oauth2ClientsOauth2DeleteClientRequestTypedDict, - ) - from .oauth2_clients_oauth2_get_clientop import ( - Oauth2ClientsOauth2GetClientRequest, - Oauth2ClientsOauth2GetClientRequestTypedDict, - ) - from .oauth2_clients_oauth2_update_clientop import ( - Oauth2ClientsOauth2UpdateClientRequest, - Oauth2ClientsOauth2UpdateClientRequestTypedDict, - ) from .oauth2_request_tokenop import ( Oauth2RequestTokenRequestBody, Oauth2RequestTokenRequestBodyTypedDict, @@ -1688,24 +1664,6 @@ Oauth2UserinfoResponseOauth2Userinfo, Oauth2UserinfoResponseOauth2UserinfoTypedDict, ) - from .oauth2client import ( - GrantTypes, - OAuth2Client, - OAuth2ClientTypedDict, - TokenEndpointAuthMethod, - ) - from .oauth2clientconfiguration import ( - OAuth2ClientConfiguration, - OAuth2ClientConfigurationGrantTypes, - OAuth2ClientConfigurationTokenEndpointAuthMethod, - OAuth2ClientConfigurationTypedDict, - ) - from .oauth2clientconfigurationupdate import ( - OAuth2ClientConfigurationUpdate, - OAuth2ClientConfigurationUpdateGrantTypes, - OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod, - OAuth2ClientConfigurationUpdateTypedDict, - ) from .oauth2clientpublic import OAuth2ClientPublic, OAuth2ClientPublicTypedDict from .order import ( Order, @@ -1771,6 +1729,10 @@ OrganizationFeatureSettings, OrganizationFeatureSettingsTypedDict, ) + from .organizationnotificationsettings import ( + OrganizationNotificationSettings, + OrganizationNotificationSettingsTypedDict, + ) from .organizations_getop import ( OrganizationsGetRequest, OrganizationsGetRequestTypedDict, @@ -1800,9 +1762,9 @@ from .payment import Payment, PaymentTypedDict from .paymenterror import PaymentError, PaymentErrorData from .paymentmethodcard import PaymentMethodCard, PaymentMethodCardTypedDict - from .paymentmethodcarddata import ( - PaymentMethodCardData, - PaymentMethodCardDataTypedDict, + from .paymentmethodcardmetadata import ( + PaymentMethodCardMetadata, + PaymentMethodCardMetadataTypedDict, ) from .paymentmethodgeneric import ( PaymentMethodGeneric, @@ -1830,6 +1792,7 @@ ) from .paymentsortproperty import PaymentSortProperty from .paymentstatus import PaymentStatus + from .polarerror import PolarError from .product import ( Prices, PricesTypedDict, @@ -1937,6 +1900,7 @@ from .refundsortproperty import RefundSortProperty from .refundstatus import RefundStatus from .resourcenotfound import ResourceNotFound, ResourceNotFoundData + from .responsevalidationerror import ResponseValidationError from .revoketokenrequest import ( RevokeTokenRequest, RevokeTokenRequestTypedDict, @@ -2067,6 +2031,8 @@ ProductsListResponseTypedDict, QueryParamDiscountIDFilter, QueryParamDiscountIDFilterTypedDict, + QueryParamExternalCustomerIDFilter, + QueryParamExternalCustomerIDFilterTypedDict, QueryParamOrganizationIDFilter, QueryParamOrganizationIDFilterTypedDict, QueryParamProductIDFilter, @@ -2504,11 +2470,14 @@ "BenefitsUpdateBenefitUpdateTypedDict", "BenefitsUpdateRequest", "BenefitsUpdateRequestTypedDict", + "BillingAddressFieldMode", "CardPayment", "CardPaymentMetadata", "CardPaymentMetadataTypedDict", "CardPaymentTypedDict", "Checkout", + "CheckoutBillingAddressFields", + "CheckoutBillingAddressFieldsTypedDict", "CheckoutConfirmStripe", "CheckoutConfirmStripeCustomFieldData", "CheckoutConfirmStripeCustomFieldDataTypedDict", @@ -2523,8 +2492,6 @@ "CheckoutCreateTypedDict", "CheckoutCustomFieldData", "CheckoutCustomFieldDataTypedDict", - "CheckoutCustomerBillingAddressFields", - "CheckoutCustomerBillingAddressFieldsTypedDict", "CheckoutDiscount", "CheckoutDiscountFixedOnceForeverDuration", "CheckoutDiscountFixedOnceForeverDurationTypedDict", @@ -2879,18 +2846,16 @@ "CustomerPortalCustomersDeletePaymentMethodRequestTypedDict", "CustomerPortalCustomersDeletePaymentMethodSecurity", "CustomerPortalCustomersDeletePaymentMethodSecurityTypedDict", - "CustomerPortalCustomersGetPaymentMethodsRequest", - "CustomerPortalCustomersGetPaymentMethodsRequestTypedDict", - "CustomerPortalCustomersGetPaymentMethodsResponse", - "CustomerPortalCustomersGetPaymentMethodsResponseTypedDict", - "CustomerPortalCustomersGetPaymentMethodsSecurity", - "CustomerPortalCustomersGetPaymentMethodsSecurityTypedDict", "CustomerPortalCustomersGetSecurity", "CustomerPortalCustomersGetSecurityTypedDict", + "CustomerPortalCustomersListPaymentMethodsRequest", + "CustomerPortalCustomersListPaymentMethodsRequestTypedDict", + "CustomerPortalCustomersListPaymentMethodsResponse", + "CustomerPortalCustomersListPaymentMethodsResponseTypedDict", + "CustomerPortalCustomersListPaymentMethodsSecurity", + "CustomerPortalCustomersListPaymentMethodsSecurityTypedDict", "CustomerPortalCustomersUpdateSecurity", "CustomerPortalCustomersUpdateSecurityTypedDict", - "CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest", - "CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequestTypedDict", "CustomerPortalDownloadablesListQueryParamBenefitIDFilter", "CustomerPortalDownloadablesListQueryParamBenefitIDFilterTypedDict", "CustomerPortalDownloadablesListQueryParamOrganizationIDFilter", @@ -3168,6 +3133,8 @@ "EventsIngestTypedDict", "EventsListNamesQueryParamCustomerIDFilter", "EventsListNamesQueryParamCustomerIDFilterTypedDict", + "EventsListNamesQueryParamExternalCustomerIDFilter", + "EventsListNamesQueryParamExternalCustomerIDFilterTypedDict", "EventsListNamesQueryParamOrganizationIDFilter", "EventsListNamesQueryParamOrganizationIDFilterTypedDict", "EventsListNamesRequest", @@ -3230,7 +3197,6 @@ "Func", "GenericPayment", "GenericPaymentTypedDict", - "GrantTypes", "HTTPValidationError", "HTTPValidationErrorData", "IntrospectTokenRequest", @@ -3328,8 +3294,6 @@ "ListResourceLicenseKeyReadTypedDict", "ListResourceMeter", "ListResourceMeterTypedDict", - "ListResourceOAuth2Client", - "ListResourceOAuth2ClientTypedDict", "ListResourceOrder", "ListResourceOrderTypedDict", "ListResourceOrganization", @@ -3469,36 +3433,17 @@ "NewSubscriptionsRevenue", "NewSubscriptionsRevenueTypedDict", "NewSubscriptionsTypedDict", + "NoResponseError", "NotOpenCheckout", "NotOpenCheckoutData", "NotPaidOrder", "NotPaidOrderData", "NotPermitted", "NotPermittedData", - "OAuth2Client", - "OAuth2ClientConfiguration", - "OAuth2ClientConfigurationGrantTypes", - "OAuth2ClientConfigurationTokenEndpointAuthMethod", - "OAuth2ClientConfigurationTypedDict", - "OAuth2ClientConfigurationUpdate", - "OAuth2ClientConfigurationUpdateGrantTypes", - "OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod", - "OAuth2ClientConfigurationUpdateTypedDict", "OAuth2ClientPublic", "OAuth2ClientPublicTypedDict", - "OAuth2ClientTypedDict", "Oauth2AuthorizeResponseOauth2Authorize", "Oauth2AuthorizeResponseOauth2AuthorizeTypedDict", - "Oauth2ClientsListRequest", - "Oauth2ClientsListRequestTypedDict", - "Oauth2ClientsListResponse", - "Oauth2ClientsListResponseTypedDict", - "Oauth2ClientsOauth2DeleteClientRequest", - "Oauth2ClientsOauth2DeleteClientRequestTypedDict", - "Oauth2ClientsOauth2GetClientRequest", - "Oauth2ClientsOauth2GetClientRequestTypedDict", - "Oauth2ClientsOauth2UpdateClientRequest", - "Oauth2ClientsOauth2UpdateClientRequestTypedDict", "Oauth2RequestTokenRequestBody", "Oauth2RequestTokenRequestBodyTypedDict", "Oauth2UserinfoResponseOauth2Userinfo", @@ -3577,6 +3522,8 @@ "OrganizationIDFilter", "OrganizationIDFilterTypedDict", "OrganizationIDTypedDict", + "OrganizationNotificationSettings", + "OrganizationNotificationSettingsTypedDict", "OrganizationSocialLink", "OrganizationSocialLinkTypedDict", "OrganizationSocialPlatforms", @@ -3600,8 +3547,8 @@ "PaymentError", "PaymentErrorData", "PaymentMethodCard", - "PaymentMethodCardData", - "PaymentMethodCardDataTypedDict", + "PaymentMethodCardMetadata", + "PaymentMethodCardMetadataTypedDict", "PaymentMethodCardTypedDict", "PaymentMethodGeneric", "PaymentMethodGenericTypedDict", @@ -3622,6 +3569,7 @@ "PaymentsListResponse", "PaymentsListResponseTypedDict", "Permission", + "PolarError", "PreviousProperties", "PreviousPropertiesTypedDict", "Prices", @@ -3754,6 +3702,7 @@ "RenewedSubscriptionsTypedDict", "ResourceNotFound", "ResourceNotFoundData", + "ResponseValidationError", "Revenue", "RevenueTypedDict", "RevokeTokenRequest", @@ -3831,7 +3780,6 @@ "TaxIDTypedDict", "TimeInterval", "Timeframe", - "TokenEndpointAuthMethod", "TokenResponse", "TokenResponseTypedDict", "TokenType", @@ -4157,6 +4105,7 @@ "BenefitType": ".benefittype", "BenefitUpdatedEvent": ".benefitupdatedevent", "BenefitUpdatedEventTypedDict": ".benefitupdatedevent", + "BillingAddressFieldMode": ".billingaddressfieldmode", "CardPayment": ".cardpayment", "CardPaymentTypedDict": ".cardpayment", "CardPaymentMetadata": ".cardpaymentmetadata", @@ -4189,6 +4138,8 @@ "CheckoutLinksListResponseTypedDict": ".checkout_links_listop", "CheckoutLinksUpdateRequest": ".checkout_links_updateop", "CheckoutLinksUpdateRequestTypedDict": ".checkout_links_updateop", + "CheckoutBillingAddressFields": ".checkoutbillingaddressfields", + "CheckoutBillingAddressFieldsTypedDict": ".checkoutbillingaddressfields", "CheckoutConfirmStripe": ".checkoutconfirmstripe", "CheckoutConfirmStripeCustomFieldData": ".checkoutconfirmstripe", "CheckoutConfirmStripeCustomFieldDataTypedDict": ".checkoutconfirmstripe", @@ -4201,8 +4152,6 @@ "CheckoutCreateMetadata": ".checkoutcreate", "CheckoutCreateMetadataTypedDict": ".checkoutcreate", "CheckoutCreateTypedDict": ".checkoutcreate", - "CheckoutCustomerBillingAddressFields": ".checkoutcustomerbillingaddressfields", - "CheckoutCustomerBillingAddressFieldsTypedDict": ".checkoutcustomerbillingaddressfields", "CheckoutDiscountFixedOnceForeverDuration": ".checkoutdiscountfixedonceforeverduration", "CheckoutDiscountFixedOnceForeverDurationTypedDict": ".checkoutdiscountfixedonceforeverduration", "CheckoutDiscountFixedRepeatDuration": ".checkoutdiscountfixedrepeatduration", @@ -4380,18 +4329,16 @@ "CustomerPortalCustomersDeletePaymentMethodRequestTypedDict": ".customer_portal_customers_delete_payment_methodop", "CustomerPortalCustomersDeletePaymentMethodSecurity": ".customer_portal_customers_delete_payment_methodop", "CustomerPortalCustomersDeletePaymentMethodSecurityTypedDict": ".customer_portal_customers_delete_payment_methodop", - "CustomerPortalCustomersGetPaymentMethodsRequest": ".customer_portal_customers_get_payment_methodsop", - "CustomerPortalCustomersGetPaymentMethodsRequestTypedDict": ".customer_portal_customers_get_payment_methodsop", - "CustomerPortalCustomersGetPaymentMethodsResponse": ".customer_portal_customers_get_payment_methodsop", - "CustomerPortalCustomersGetPaymentMethodsResponseTypedDict": ".customer_portal_customers_get_payment_methodsop", - "CustomerPortalCustomersGetPaymentMethodsSecurity": ".customer_portal_customers_get_payment_methodsop", - "CustomerPortalCustomersGetPaymentMethodsSecurityTypedDict": ".customer_portal_customers_get_payment_methodsop", "CustomerPortalCustomersGetSecurity": ".customer_portal_customers_getop", "CustomerPortalCustomersGetSecurityTypedDict": ".customer_portal_customers_getop", + "CustomerPortalCustomersListPaymentMethodsRequest": ".customer_portal_customers_list_payment_methodsop", + "CustomerPortalCustomersListPaymentMethodsRequestTypedDict": ".customer_portal_customers_list_payment_methodsop", + "CustomerPortalCustomersListPaymentMethodsResponse": ".customer_portal_customers_list_payment_methodsop", + "CustomerPortalCustomersListPaymentMethodsResponseTypedDict": ".customer_portal_customers_list_payment_methodsop", + "CustomerPortalCustomersListPaymentMethodsSecurity": ".customer_portal_customers_list_payment_methodsop", + "CustomerPortalCustomersListPaymentMethodsSecurityTypedDict": ".customer_portal_customers_list_payment_methodsop", "CustomerPortalCustomersUpdateSecurity": ".customer_portal_customers_updateop", "CustomerPortalCustomersUpdateSecurityTypedDict": ".customer_portal_customers_updateop", - "CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest": ".customer_portal_downloadables_customer_portal_downloadables_getop", - "CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequestTypedDict": ".customer_portal_downloadables_customer_portal_downloadables_getop", "CustomerPortalDownloadablesListQueryParamBenefitIDFilter": ".customer_portal_downloadables_listop", "CustomerPortalDownloadablesListQueryParamBenefitIDFilterTypedDict": ".customer_portal_downloadables_listop", "CustomerPortalDownloadablesListQueryParamOrganizationIDFilter": ".customer_portal_downloadables_listop", @@ -4803,14 +4750,14 @@ "EventsGetRequestTypedDict": ".events_getop", "EventsListNamesQueryParamCustomerIDFilter": ".events_list_namesop", "EventsListNamesQueryParamCustomerIDFilterTypedDict": ".events_list_namesop", + "EventsListNamesQueryParamExternalCustomerIDFilter": ".events_list_namesop", + "EventsListNamesQueryParamExternalCustomerIDFilterTypedDict": ".events_list_namesop", "EventsListNamesQueryParamOrganizationIDFilter": ".events_list_namesop", "EventsListNamesQueryParamOrganizationIDFilterTypedDict": ".events_list_namesop", "EventsListNamesRequest": ".events_list_namesop", "EventsListNamesRequestTypedDict": ".events_list_namesop", "EventsListNamesResponse": ".events_list_namesop", "EventsListNamesResponseTypedDict": ".events_list_namesop", - "QueryParamExternalCustomerIDFilter": ".events_list_namesop", - "QueryParamExternalCustomerIDFilterTypedDict": ".events_list_namesop", "QueryParamSourceFilter": ".events_list_namesop", "QueryParamSourceFilterTypedDict": ".events_list_namesop", "EventsIngest": ".eventsingest", @@ -4967,8 +4914,6 @@ "ListResourceLicenseKeyReadTypedDict": ".listresource_licensekeyread_", "ListResourceMeter": ".listresource_meter_", "ListResourceMeterTypedDict": ".listresource_meter_", - "ListResourceOAuth2Client": ".listresource_oauth2client_", - "ListResourceOAuth2ClientTypedDict": ".listresource_oauth2client_", "ListResourceOrder": ".listresource_order_", "ListResourceOrderTypedDict": ".listresource_order_", "ListResourceOrganization": ".listresource_organization_", @@ -5111,6 +5056,7 @@ "MetricType": ".metrictype", "MissingInvoiceBillingDetails": ".missinginvoicebillingdetails", "MissingInvoiceBillingDetailsData": ".missinginvoicebillingdetails", + "NoResponseError": ".no_response_error", "NotOpenCheckout": ".notopencheckout", "NotOpenCheckoutData": ".notopencheckout", "NotPaidOrder": ".notpaidorder", @@ -5119,32 +5065,10 @@ "NotPermittedData": ".notpermitted", "Oauth2AuthorizeResponseOauth2Authorize": ".oauth2_authorizeop", "Oauth2AuthorizeResponseOauth2AuthorizeTypedDict": ".oauth2_authorizeop", - "Oauth2ClientsListRequest": ".oauth2_clients_listop", - "Oauth2ClientsListRequestTypedDict": ".oauth2_clients_listop", - "Oauth2ClientsListResponse": ".oauth2_clients_listop", - "Oauth2ClientsListResponseTypedDict": ".oauth2_clients_listop", - "Oauth2ClientsOauth2DeleteClientRequest": ".oauth2_clients_oauth2_delete_clientop", - "Oauth2ClientsOauth2DeleteClientRequestTypedDict": ".oauth2_clients_oauth2_delete_clientop", - "Oauth2ClientsOauth2GetClientRequest": ".oauth2_clients_oauth2_get_clientop", - "Oauth2ClientsOauth2GetClientRequestTypedDict": ".oauth2_clients_oauth2_get_clientop", - "Oauth2ClientsOauth2UpdateClientRequest": ".oauth2_clients_oauth2_update_clientop", - "Oauth2ClientsOauth2UpdateClientRequestTypedDict": ".oauth2_clients_oauth2_update_clientop", "Oauth2RequestTokenRequestBody": ".oauth2_request_tokenop", "Oauth2RequestTokenRequestBodyTypedDict": ".oauth2_request_tokenop", "Oauth2UserinfoResponseOauth2Userinfo": ".oauth2_userinfoop", "Oauth2UserinfoResponseOauth2UserinfoTypedDict": ".oauth2_userinfoop", - "GrantTypes": ".oauth2client", - "OAuth2Client": ".oauth2client", - "OAuth2ClientTypedDict": ".oauth2client", - "TokenEndpointAuthMethod": ".oauth2client", - "OAuth2ClientConfiguration": ".oauth2clientconfiguration", - "OAuth2ClientConfigurationGrantTypes": ".oauth2clientconfiguration", - "OAuth2ClientConfigurationTokenEndpointAuthMethod": ".oauth2clientconfiguration", - "OAuth2ClientConfigurationTypedDict": ".oauth2clientconfiguration", - "OAuth2ClientConfigurationUpdate": ".oauth2clientconfigurationupdate", - "OAuth2ClientConfigurationUpdateGrantTypes": ".oauth2clientconfigurationupdate", - "OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod": ".oauth2clientconfigurationupdate", - "OAuth2ClientConfigurationUpdateTypedDict": ".oauth2clientconfigurationupdate", "OAuth2ClientPublic": ".oauth2clientpublic", "OAuth2ClientPublicTypedDict": ".oauth2clientpublic", "Order": ".order", @@ -5201,6 +5125,8 @@ "SwitchingFrom": ".organizationdetails", "OrganizationFeatureSettings": ".organizationfeaturesettings", "OrganizationFeatureSettingsTypedDict": ".organizationfeaturesettings", + "OrganizationNotificationSettings": ".organizationnotificationsettings", + "OrganizationNotificationSettingsTypedDict": ".organizationnotificationsettings", "OrganizationsGetRequest": ".organizations_getop", "OrganizationsGetRequestTypedDict": ".organizations_getop", "OrganizationsListRequest": ".organizations_listop", @@ -5225,8 +5151,8 @@ "PaymentErrorData": ".paymenterror", "PaymentMethodCard": ".paymentmethodcard", "PaymentMethodCardTypedDict": ".paymentmethodcard", - "PaymentMethodCardData": ".paymentmethodcarddata", - "PaymentMethodCardDataTypedDict": ".paymentmethodcarddata", + "PaymentMethodCardMetadata": ".paymentmethodcardmetadata", + "PaymentMethodCardMetadataTypedDict": ".paymentmethodcardmetadata", "PaymentMethodGeneric": ".paymentmethodgeneric", "PaymentMethodGenericTypedDict": ".paymentmethodgeneric", "PaymentProcessor": ".paymentprocessor", @@ -5250,6 +5176,7 @@ "QueryParamStatusFilterTypedDict": ".payments_listop", "PaymentSortProperty": ".paymentsortproperty", "PaymentStatus": ".paymentstatus", + "PolarError": ".polarerror", "Prices": ".product", "PricesTypedDict": ".product", "Product": ".product", @@ -5341,6 +5268,7 @@ "RefundStatus": ".refundstatus", "ResourceNotFound": ".resourcenotfound", "ResourceNotFoundData": ".resourcenotfound", + "ResponseValidationError": ".responsevalidationerror", "RevokeTokenRequest": ".revoketokenrequest", "RevokeTokenRequestTypedDict": ".revoketokenrequest", "TokenTypeHint": ".revoketokenrequest", @@ -5462,6 +5390,8 @@ "ProductsListResponseTypedDict": ".subscriptions_listop", "QueryParamDiscountIDFilter": ".subscriptions_listop", "QueryParamDiscountIDFilterTypedDict": ".subscriptions_listop", + "QueryParamExternalCustomerIDFilter": ".subscriptions_listop", + "QueryParamExternalCustomerIDFilterTypedDict": ".subscriptions_listop", "QueryParamOrganizationIDFilter": ".subscriptions_listop", "QueryParamOrganizationIDFilterTypedDict": ".subscriptions_listop", "QueryParamProductIDFilter": ".subscriptions_listop", diff --git a/src/polar_sdk/models/alreadyactivesubscriptionerror.py b/src/polar_sdk/models/alreadyactivesubscriptionerror.py index d041bc0f..af22489e 100644 --- a/src/polar_sdk/models/alreadyactivesubscriptionerror.py +++ b/src/polar_sdk/models/alreadyactivesubscriptionerror.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class AlreadyActiveSubscriptionErrorData(BaseModel): ] = "AlreadyActiveSubscriptionError" -class AlreadyActiveSubscriptionError(Exception): +class AlreadyActiveSubscriptionError(PolarError): data: AlreadyActiveSubscriptionErrorData - def __init__(self, data: AlreadyActiveSubscriptionErrorData): + def __init__( + self, + data: AlreadyActiveSubscriptionErrorData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, AlreadyActiveSubscriptionErrorData) diff --git a/src/polar_sdk/models/alreadycanceledsubscription.py b/src/polar_sdk/models/alreadycanceledsubscription.py index 427cfe93..3b7fa62e 100644 --- a/src/polar_sdk/models/alreadycanceledsubscription.py +++ b/src/polar_sdk/models/alreadycanceledsubscription.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class AlreadyCanceledSubscriptionData(BaseModel): ] = "AlreadyCanceledSubscription" -class AlreadyCanceledSubscription(Exception): +class AlreadyCanceledSubscription(PolarError): data: AlreadyCanceledSubscriptionData - def __init__(self, data: AlreadyCanceledSubscriptionData): + def __init__( + self, + data: AlreadyCanceledSubscriptionData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, AlreadyCanceledSubscriptionData) diff --git a/src/polar_sdk/models/benefitdiscordcreateproperties.py b/src/polar_sdk/models/benefitdiscordcreateproperties.py index 1ca538bb..0075f743 100644 --- a/src/polar_sdk/models/benefitdiscordcreateproperties.py +++ b/src/polar_sdk/models/benefitdiscordcreateproperties.py @@ -11,6 +11,8 @@ class BenefitDiscordCreatePropertiesTypedDict(TypedDict): guild_token: str role_id: str r"""The ID of the Discord role to grant.""" + kick_member: bool + r"""Whether to kick the member from the Discord server on revocation.""" class BenefitDiscordCreateProperties(BaseModel): @@ -20,3 +22,6 @@ class BenefitDiscordCreateProperties(BaseModel): role_id: str r"""The ID of the Discord role to grant.""" + + kick_member: bool + r"""Whether to kick the member from the Discord server on revocation.""" diff --git a/src/polar_sdk/models/benefitdiscordproperties.py b/src/polar_sdk/models/benefitdiscordproperties.py index 04bb191c..c4ed96a5 100644 --- a/src/polar_sdk/models/benefitdiscordproperties.py +++ b/src/polar_sdk/models/benefitdiscordproperties.py @@ -12,6 +12,8 @@ class BenefitDiscordPropertiesTypedDict(TypedDict): r"""The ID of the Discord server.""" role_id: str r"""The ID of the Discord role to grant.""" + kick_member: bool + r"""Whether to kick the member from the Discord server on revocation.""" guild_token: str @@ -24,4 +26,7 @@ class BenefitDiscordProperties(BaseModel): role_id: str r"""The ID of the Discord role to grant.""" + kick_member: bool + r"""Whether to kick the member from the Discord server on revocation.""" + guild_token: str diff --git a/src/polar_sdk/models/billingaddressfieldmode.py b/src/polar_sdk/models/billingaddressfieldmode.py new file mode 100644 index 00000000..4c5a5fc2 --- /dev/null +++ b/src/polar_sdk/models/billingaddressfieldmode.py @@ -0,0 +1,10 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum + + +class BillingAddressFieldMode(str, Enum): + REQUIRED = "required" + OPTIONAL = "optional" + DISABLED = "disabled" diff --git a/src/polar_sdk/models/checkout.py b/src/polar_sdk/models/checkout.py index 1c4ea378..024585cf 100644 --- a/src/polar_sdk/models/checkout.py +++ b/src/polar_sdk/models/checkout.py @@ -3,9 +3,9 @@ from __future__ import annotations from .address import Address, AddressTypedDict from .attachedcustomfield import AttachedCustomField, AttachedCustomFieldTypedDict -from .checkoutcustomerbillingaddressfields import ( - CheckoutCustomerBillingAddressFields, - CheckoutCustomerBillingAddressFieldsTypedDict, +from .checkoutbillingaddressfields import ( + CheckoutBillingAddressFields, + CheckoutBillingAddressFieldsTypedDict, ) from .checkoutdiscountfixedonceforeverduration import ( CheckoutDiscountFixedOnceForeverDuration, @@ -165,7 +165,7 @@ class CheckoutTypedDict(TypedDict): customer_billing_address: Nullable[AddressTypedDict] customer_tax_id: Nullable[str] payment_processor_metadata: Dict[str, str] - customer_billing_address_fields: CheckoutCustomerBillingAddressFieldsTypedDict + billing_address_fields: CheckoutBillingAddressFieldsTypedDict metadata: Dict[str, CheckoutMetadataTypedDict] external_customer_id: Nullable[str] r"""ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set.""" @@ -286,7 +286,7 @@ class Checkout(BaseModel): payment_processor_metadata: Dict[str, str] - customer_billing_address_fields: CheckoutCustomerBillingAddressFields + billing_address_fields: CheckoutBillingAddressFields metadata: Dict[str, CheckoutMetadata] diff --git a/src/polar_sdk/models/checkoutbillingaddressfields.py b/src/polar_sdk/models/checkoutbillingaddressfields.py new file mode 100644 index 00000000..23007ab8 --- /dev/null +++ b/src/polar_sdk/models/checkoutbillingaddressfields.py @@ -0,0 +1,29 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .billingaddressfieldmode import BillingAddressFieldMode +from polar_sdk.types import BaseModel +from typing_extensions import TypedDict + + +class CheckoutBillingAddressFieldsTypedDict(TypedDict): + country: BillingAddressFieldMode + state: BillingAddressFieldMode + city: BillingAddressFieldMode + postal_code: BillingAddressFieldMode + line1: BillingAddressFieldMode + line2: BillingAddressFieldMode + + +class CheckoutBillingAddressFields(BaseModel): + country: BillingAddressFieldMode + + state: BillingAddressFieldMode + + city: BillingAddressFieldMode + + postal_code: BillingAddressFieldMode + + line1: BillingAddressFieldMode + + line2: BillingAddressFieldMode diff --git a/src/polar_sdk/models/checkoutcustomerbillingaddressfields.py b/src/polar_sdk/models/checkoutcustomerbillingaddressfields.py deleted file mode 100644 index 459773e6..00000000 --- a/src/polar_sdk/models/checkoutcustomerbillingaddressfields.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from polar_sdk.types import BaseModel -from typing_extensions import TypedDict - - -class CheckoutCustomerBillingAddressFieldsTypedDict(TypedDict): - country: bool - state: bool - city: bool - postal_code: bool - line1: bool - line2: bool - - -class CheckoutCustomerBillingAddressFields(BaseModel): - country: bool - - state: bool - - city: bool - - postal_code: bool - - line1: bool - - line2: bool diff --git a/src/polar_sdk/models/checkoutforbiddenerror.py b/src/polar_sdk/models/checkoutforbiddenerror.py index e5833464..8a0b0c12 100644 --- a/src/polar_sdk/models/checkoutforbiddenerror.py +++ b/src/polar_sdk/models/checkoutforbiddenerror.py @@ -3,8 +3,9 @@ from __future__ import annotations from .alreadyactivesubscriptionerror import AlreadyActiveSubscriptionErrorData from .notopencheckout import NotOpenCheckoutData -from polar_sdk import utils -from typing import Union +import httpx +from polar_sdk.models import PolarError +from typing import Optional, Union from typing_extensions import TypeAliasType @@ -14,11 +15,15 @@ ) -class CheckoutForbiddenError(Exception): +class CheckoutForbiddenError(PolarError): data: CheckoutForbiddenErrorUnion - def __init__(self, data: CheckoutForbiddenErrorUnion): + def __init__( + self, + data: CheckoutForbiddenErrorUnion, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, CheckoutForbiddenErrorUnion) diff --git a/src/polar_sdk/models/checkoutpublic.py b/src/polar_sdk/models/checkoutpublic.py index dbbf5a03..a327a166 100644 --- a/src/polar_sdk/models/checkoutpublic.py +++ b/src/polar_sdk/models/checkoutpublic.py @@ -3,9 +3,9 @@ from __future__ import annotations from .address import Address, AddressTypedDict from .attachedcustomfield import AttachedCustomField, AttachedCustomFieldTypedDict -from .checkoutcustomerbillingaddressfields import ( - CheckoutCustomerBillingAddressFields, - CheckoutCustomerBillingAddressFieldsTypedDict, +from .checkoutbillingaddressfields import ( + CheckoutBillingAddressFields, + CheckoutBillingAddressFieldsTypedDict, ) from .checkoutdiscountfixedonceforeverduration import ( CheckoutDiscountFixedOnceForeverDuration, @@ -149,7 +149,7 @@ class CheckoutPublicTypedDict(TypedDict): customer_billing_address: Nullable[AddressTypedDict] customer_tax_id: Nullable[str] payment_processor_metadata: Dict[str, str] - customer_billing_address_fields: CheckoutCustomerBillingAddressFieldsTypedDict + billing_address_fields: CheckoutBillingAddressFieldsTypedDict products: List[CheckoutProductTypedDict] r"""List of products available to select.""" product: CheckoutProductTypedDict @@ -265,7 +265,7 @@ class CheckoutPublic(BaseModel): payment_processor_metadata: Dict[str, str] - customer_billing_address_fields: CheckoutCustomerBillingAddressFields + billing_address_fields: CheckoutBillingAddressFields products: List[CheckoutProduct] r"""List of products available to select.""" diff --git a/src/polar_sdk/models/checkoutpublicconfirmed.py b/src/polar_sdk/models/checkoutpublicconfirmed.py index 39fc1a98..675c98a0 100644 --- a/src/polar_sdk/models/checkoutpublicconfirmed.py +++ b/src/polar_sdk/models/checkoutpublicconfirmed.py @@ -3,9 +3,9 @@ from __future__ import annotations from .address import Address, AddressTypedDict from .attachedcustomfield import AttachedCustomField, AttachedCustomFieldTypedDict -from .checkoutcustomerbillingaddressfields import ( - CheckoutCustomerBillingAddressFields, - CheckoutCustomerBillingAddressFieldsTypedDict, +from .checkoutbillingaddressfields import ( + CheckoutBillingAddressFields, + CheckoutBillingAddressFieldsTypedDict, ) from .checkoutdiscountfixedonceforeverduration import ( CheckoutDiscountFixedOnceForeverDuration, @@ -155,7 +155,7 @@ class CheckoutPublicConfirmedTypedDict(TypedDict): customer_billing_address: Nullable[AddressTypedDict] customer_tax_id: Nullable[str] payment_processor_metadata: Dict[str, str] - customer_billing_address_fields: CheckoutCustomerBillingAddressFieldsTypedDict + billing_address_fields: CheckoutBillingAddressFieldsTypedDict products: List[CheckoutProductTypedDict] r"""List of products available to select.""" product: CheckoutProductTypedDict @@ -275,7 +275,7 @@ class CheckoutPublicConfirmed(BaseModel): payment_processor_metadata: Dict[str, str] - customer_billing_address_fields: CheckoutCustomerBillingAddressFields + billing_address_fields: CheckoutBillingAddressFields products: List[CheckoutProduct] r"""List of products available to select.""" diff --git a/src/polar_sdk/models/customer_portal_customers_get_payment_methodsop.py b/src/polar_sdk/models/customer_portal_customers_list_payment_methodsop.py similarity index 75% rename from src/polar_sdk/models/customer_portal_customers_get_payment_methodsop.py rename to src/polar_sdk/models/customer_portal_customers_list_payment_methodsop.py index e3ff2991..f253d19f 100644 --- a/src/polar_sdk/models/customer_portal_customers_get_payment_methodsop.py +++ b/src/polar_sdk/models/customer_portal_customers_list_payment_methodsop.py @@ -11,11 +11,11 @@ from typing_extensions import Annotated, NotRequired, TypedDict -class CustomerPortalCustomersGetPaymentMethodsSecurityTypedDict(TypedDict): +class CustomerPortalCustomersListPaymentMethodsSecurityTypedDict(TypedDict): customer_session: str -class CustomerPortalCustomersGetPaymentMethodsSecurity(BaseModel): +class CustomerPortalCustomersListPaymentMethodsSecurity(BaseModel): customer_session: Annotated[ str, FieldMetadata( @@ -29,14 +29,14 @@ class CustomerPortalCustomersGetPaymentMethodsSecurity(BaseModel): ] -class CustomerPortalCustomersGetPaymentMethodsRequestTypedDict(TypedDict): +class CustomerPortalCustomersListPaymentMethodsRequestTypedDict(TypedDict): page: NotRequired[int] r"""Page number, defaults to 1.""" limit: NotRequired[int] r"""Size of a page, defaults to 10. Maximum is 100.""" -class CustomerPortalCustomersGetPaymentMethodsRequest(BaseModel): +class CustomerPortalCustomersListPaymentMethodsRequest(BaseModel): page: Annotated[ Optional[int], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), @@ -50,11 +50,11 @@ class CustomerPortalCustomersGetPaymentMethodsRequest(BaseModel): r"""Size of a page, defaults to 10. Maximum is 100.""" -class CustomerPortalCustomersGetPaymentMethodsResponseTypedDict(TypedDict): +class CustomerPortalCustomersListPaymentMethodsResponseTypedDict(TypedDict): result: ListResourceUnionPaymentMethodCardPaymentMethodGenericTypedDict -class CustomerPortalCustomersGetPaymentMethodsResponse(BaseModel): - next: Callable[[], Optional[CustomerPortalCustomersGetPaymentMethodsResponse]] +class CustomerPortalCustomersListPaymentMethodsResponse(BaseModel): + next: Callable[[], Optional[CustomerPortalCustomersListPaymentMethodsResponse]] result: ListResourceUnionPaymentMethodCardPaymentMethodGeneric diff --git a/src/polar_sdk/models/customer_portal_downloadables_customer_portal_downloadables_getop.py b/src/polar_sdk/models/customer_portal_downloadables_customer_portal_downloadables_getop.py deleted file mode 100644 index 4da503e7..00000000 --- a/src/polar_sdk/models/customer_portal_downloadables_customer_portal_downloadables_getop.py +++ /dev/null @@ -1,18 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from polar_sdk.types import BaseModel -from polar_sdk.utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict - - -class CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequestTypedDict( - TypedDict -): - token: str - - -class CustomerPortalDownloadablesCustomerPortalDownloadablesGetRequest(BaseModel): - token: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] diff --git a/src/polar_sdk/models/customer_portal_orders_generate_invoiceop.py b/src/polar_sdk/models/customer_portal_orders_generate_invoiceop.py index c9e8f208..2e925122 100644 --- a/src/polar_sdk/models/customer_portal_orders_generate_invoiceop.py +++ b/src/polar_sdk/models/customer_portal_orders_generate_invoiceop.py @@ -3,10 +3,11 @@ from __future__ import annotations from .missinginvoicebillingdetails import MissingInvoiceBillingDetailsData from .notpaidorder import NotPaidOrderData -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import FieldMetadata, PathParamMetadata, SecurityMetadata -from typing import Union +from typing import Optional, Union from typing_extensions import Annotated, TypeAliasType, TypedDict @@ -48,7 +49,7 @@ class CustomerPortalOrdersGenerateInvoiceRequest(BaseModel): class CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoice( - Exception + PolarError ): r"""Order is not paid or is missing billing name or address.""" @@ -57,11 +58,9 @@ class CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerate def __init__( self, data: CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoiceUnion, + raw_response: httpx.Response, + body: Optional[str] = None, ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json( - self.data, - CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoiceUnion, - ) diff --git a/src/polar_sdk/models/customerportalcustomer.py b/src/polar_sdk/models/customerportalcustomer.py index 7ba2d64a..7ddd3ef3 100644 --- a/src/polar_sdk/models/customerportalcustomer.py +++ b/src/polar_sdk/models/customerportalcustomer.py @@ -8,10 +8,10 @@ ) from .taxidformat import TaxIDFormat from datetime import datetime -from polar_sdk.types import BaseModel, Nullable, UNSET_SENTINEL +from polar_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL from pydantic import model_serializer from typing import Dict, List, Union -from typing_extensions import TypeAliasType, TypedDict +from typing_extensions import NotRequired, TypeAliasType, TypedDict CustomerPortalCustomerTaxIDTypedDict = TypeAliasType( @@ -37,6 +37,7 @@ class CustomerPortalCustomerTypedDict(TypedDict): billing_address: Nullable[AddressTypedDict] tax_id: Nullable[List[Nullable[CustomerPortalCustomerTaxIDTypedDict]]] oauth_accounts: Dict[str, CustomerPortalOAuthAccountTypedDict] + default_payment_method_id: NotRequired[Nullable[str]] class CustomerPortalCustomer(BaseModel): @@ -61,10 +62,18 @@ class CustomerPortalCustomer(BaseModel): oauth_accounts: Dict[str, CustomerPortalOAuthAccount] + default_payment_method_id: OptionalNullable[str] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = [] - nullable_fields = ["modified_at", "name", "billing_address", "tax_id"] + optional_fields = ["default_payment_method_id"] + nullable_fields = [ + "modified_at", + "name", + "billing_address", + "tax_id", + "default_payment_method_id", + ] null_default_fields = [] serialized = handler(self) diff --git a/src/polar_sdk/models/events_list_namesop.py b/src/polar_sdk/models/events_list_namesop.py index 7f295990..8d8799c0 100644 --- a/src/polar_sdk/models/events_list_namesop.py +++ b/src/polar_sdk/models/events_list_namesop.py @@ -38,14 +38,14 @@ r"""Filter by customer ID.""" -QueryParamExternalCustomerIDFilterTypedDict = TypeAliasType( - "QueryParamExternalCustomerIDFilterTypedDict", Union[str, List[str]] +EventsListNamesQueryParamExternalCustomerIDFilterTypedDict = TypeAliasType( + "EventsListNamesQueryParamExternalCustomerIDFilterTypedDict", Union[str, List[str]] ) r"""Filter by external customer ID.""" -QueryParamExternalCustomerIDFilter = TypeAliasType( - "QueryParamExternalCustomerIDFilter", Union[str, List[str]] +EventsListNamesQueryParamExternalCustomerIDFilter = TypeAliasType( + "EventsListNamesQueryParamExternalCustomerIDFilter", Union[str, List[str]] ) r"""Filter by external customer ID.""" @@ -72,7 +72,7 @@ class EventsListNamesRequestTypedDict(TypedDict): ] r"""Filter by customer ID.""" external_customer_id: NotRequired[ - Nullable[QueryParamExternalCustomerIDFilterTypedDict] + Nullable[EventsListNamesQueryParamExternalCustomerIDFilterTypedDict] ] r"""Filter by external customer ID.""" source: NotRequired[Nullable[QueryParamSourceFilterTypedDict]] @@ -101,7 +101,7 @@ class EventsListNamesRequest(BaseModel): r"""Filter by customer ID.""" external_customer_id: Annotated[ - OptionalNullable[QueryParamExternalCustomerIDFilter], + OptionalNullable[EventsListNamesQueryParamExternalCustomerIDFilter], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = UNSET r"""Filter by external customer ID.""" diff --git a/src/polar_sdk/models/expiredcheckouterror.py b/src/polar_sdk/models/expiredcheckouterror.py index 920097e5..60538025 100644 --- a/src/polar_sdk/models/expiredcheckouterror.py +++ b/src/polar_sdk/models/expiredcheckouterror.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class ExpiredCheckoutErrorData(BaseModel): ] = "ExpiredCheckoutError" -class ExpiredCheckoutError(Exception): +class ExpiredCheckoutError(PolarError): data: ExpiredCheckoutErrorData - def __init__(self, data: ExpiredCheckoutErrorData): + def __init__( + self, + data: ExpiredCheckoutErrorData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, ExpiredCheckoutErrorData) diff --git a/src/polar_sdk/models/httpvalidationerror.py b/src/polar_sdk/models/httpvalidationerror.py index da1366ea..fc6204b6 100644 --- a/src/polar_sdk/models/httpvalidationerror.py +++ b/src/polar_sdk/models/httpvalidationerror.py @@ -2,7 +2,8 @@ from __future__ import annotations from .validationerror import ValidationError -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from typing import List, Optional @@ -11,11 +12,15 @@ class HTTPValidationErrorData(BaseModel): detail: Optional[List[ValidationError]] = None -class HTTPValidationError(Exception): +class HTTPValidationError(PolarError): data: HTTPValidationErrorData - def __init__(self, data: HTTPValidationErrorData): + def __init__( + self, + data: HTTPValidationErrorData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, HTTPValidationErrorData) diff --git a/src/polar_sdk/models/invoicealreadyexists.py b/src/polar_sdk/models/invoicealreadyexists.py index be9df3fa..efd84f66 100644 --- a/src/polar_sdk/models/invoicealreadyexists.py +++ b/src/polar_sdk/models/invoicealreadyexists.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class InvoiceAlreadyExistsData(BaseModel): ] = "InvoiceAlreadyExists" -class InvoiceAlreadyExists(Exception): +class InvoiceAlreadyExists(PolarError): data: InvoiceAlreadyExistsData - def __init__(self, data: InvoiceAlreadyExistsData): + def __init__( + self, + data: InvoiceAlreadyExistsData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, InvoiceAlreadyExistsData) diff --git a/src/polar_sdk/models/listresource_oauth2client_.py b/src/polar_sdk/models/listresource_oauth2client_.py deleted file mode 100644 index 45a39e8e..00000000 --- a/src/polar_sdk/models/listresource_oauth2client_.py +++ /dev/null @@ -1,19 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .oauth2client import OAuth2Client, OAuth2ClientTypedDict -from .pagination import Pagination, PaginationTypedDict -from polar_sdk.types import BaseModel -from typing import List -from typing_extensions import TypedDict - - -class ListResourceOAuth2ClientTypedDict(TypedDict): - items: List[OAuth2ClientTypedDict] - pagination: PaginationTypedDict - - -class ListResourceOAuth2Client(BaseModel): - items: List[OAuth2Client] - - pagination: Pagination diff --git a/src/polar_sdk/models/metrics_getop.py b/src/polar_sdk/models/metrics_getop.py index 5eb0e38e..0306726c 100644 --- a/src/polar_sdk/models/metrics_getop.py +++ b/src/polar_sdk/models/metrics_getop.py @@ -7,7 +7,7 @@ from polar_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL from polar_sdk.utils import FieldMetadata, QueryParamMetadata from pydantic import model_serializer -from typing import List, Union +from typing import List, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -68,6 +68,8 @@ class MetricsGetRequestTypedDict(TypedDict): r"""End date.""" interval: TimeInterval r"""Interval between two timestamps.""" + timezone: NotRequired[str] + r"""Timezone to use for the timestamps. Default is UTC.""" organization_id: NotRequired[ Nullable[MetricsGetQueryParamOrganizationIDFilterTypedDict] ] @@ -97,6 +99,12 @@ class MetricsGetRequest(BaseModel): ] r"""Interval between two timestamps.""" + timezone: Annotated[ + Optional[str], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = "UTC" + r"""Timezone to use for the timestamps. Default is UTC.""" + organization_id: Annotated[ OptionalNullable[MetricsGetQueryParamOrganizationIDFilter], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), @@ -124,6 +132,7 @@ class MetricsGetRequest(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ + "timezone", "organization_id", "product_id", "billing_type", diff --git a/src/polar_sdk/models/missinginvoicebillingdetails.py b/src/polar_sdk/models/missinginvoicebillingdetails.py index fb81c3b4..81907546 100644 --- a/src/polar_sdk/models/missinginvoicebillingdetails.py +++ b/src/polar_sdk/models/missinginvoicebillingdetails.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class MissingInvoiceBillingDetailsData(BaseModel): ] = "MissingInvoiceBillingDetails" -class MissingInvoiceBillingDetails(Exception): +class MissingInvoiceBillingDetails(PolarError): data: MissingInvoiceBillingDetailsData - def __init__(self, data: MissingInvoiceBillingDetailsData): + def __init__( + self, + data: MissingInvoiceBillingDetailsData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, MissingInvoiceBillingDetailsData) diff --git a/src/polar_sdk/models/no_response_error.py b/src/polar_sdk/models/no_response_error.py new file mode 100644 index 00000000..f98beea2 --- /dev/null +++ b/src/polar_sdk/models/no_response_error.py @@ -0,0 +1,13 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +class NoResponseError(Exception): + """Error raised when no HTTP response is received from the server.""" + + message: str + + def __init__(self, message: str = "No response received"): + self.message = message + super().__init__(message) + + def __str__(self): + return self.message diff --git a/src/polar_sdk/models/notopencheckout.py b/src/polar_sdk/models/notopencheckout.py index dbd99036..74024810 100644 --- a/src/polar_sdk/models/notopencheckout.py +++ b/src/polar_sdk/models/notopencheckout.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class NotOpenCheckoutData(BaseModel): ] = "NotOpenCheckout" -class NotOpenCheckout(Exception): +class NotOpenCheckout(PolarError): data: NotOpenCheckoutData - def __init__(self, data: NotOpenCheckoutData): + def __init__( + self, + data: NotOpenCheckoutData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, NotOpenCheckoutData) diff --git a/src/polar_sdk/models/notpaidorder.py b/src/polar_sdk/models/notpaidorder.py index e779dc21..98ce6ac5 100644 --- a/src/polar_sdk/models/notpaidorder.py +++ b/src/polar_sdk/models/notpaidorder.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -21,11 +22,15 @@ class NotPaidOrderData(BaseModel): ] = "NotPaidOrder" -class NotPaidOrder(Exception): +class NotPaidOrder(PolarError): data: NotPaidOrderData - def __init__(self, data: NotPaidOrderData): + def __init__( + self, + data: NotPaidOrderData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, NotPaidOrderData) diff --git a/src/polar_sdk/models/notpermitted.py b/src/polar_sdk/models/notpermitted.py index 76c18113..61710cc8 100644 --- a/src/polar_sdk/models/notpermitted.py +++ b/src/polar_sdk/models/notpermitted.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -21,11 +22,15 @@ class NotPermittedData(BaseModel): ] = "NotPermitted" -class NotPermitted(Exception): +class NotPermitted(PolarError): data: NotPermittedData - def __init__(self, data: NotPermittedData): + def __init__( + self, + data: NotPermittedData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, NotPermittedData) diff --git a/src/polar_sdk/models/oauth2_clients_listop.py b/src/polar_sdk/models/oauth2_clients_listop.py deleted file mode 100644 index 343164ff..00000000 --- a/src/polar_sdk/models/oauth2_clients_listop.py +++ /dev/null @@ -1,42 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .listresource_oauth2client_ import ( - ListResourceOAuth2Client, - ListResourceOAuth2ClientTypedDict, -) -from polar_sdk.types import BaseModel -from polar_sdk.utils import FieldMetadata, QueryParamMetadata -from typing import Callable, Optional -from typing_extensions import Annotated, NotRequired, TypedDict - - -class Oauth2ClientsListRequestTypedDict(TypedDict): - page: NotRequired[int] - r"""Page number, defaults to 1.""" - limit: NotRequired[int] - r"""Size of a page, defaults to 10. Maximum is 100.""" - - -class Oauth2ClientsListRequest(BaseModel): - page: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = 1 - r"""Page number, defaults to 1.""" - - limit: Annotated[ - Optional[int], - FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), - ] = 10 - r"""Size of a page, defaults to 10. Maximum is 100.""" - - -class Oauth2ClientsListResponseTypedDict(TypedDict): - result: ListResourceOAuth2ClientTypedDict - - -class Oauth2ClientsListResponse(BaseModel): - next: Callable[[], Optional[Oauth2ClientsListResponse]] - - result: ListResourceOAuth2Client diff --git a/src/polar_sdk/models/oauth2_clients_oauth2_delete_clientop.py b/src/polar_sdk/models/oauth2_clients_oauth2_delete_clientop.py deleted file mode 100644 index 6238d634..00000000 --- a/src/polar_sdk/models/oauth2_clients_oauth2_delete_clientop.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from polar_sdk.types import BaseModel -from polar_sdk.utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict - - -class Oauth2ClientsOauth2DeleteClientRequestTypedDict(TypedDict): - client_id: str - - -class Oauth2ClientsOauth2DeleteClientRequest(BaseModel): - client_id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] diff --git a/src/polar_sdk/models/oauth2_clients_oauth2_get_clientop.py b/src/polar_sdk/models/oauth2_clients_oauth2_get_clientop.py deleted file mode 100644 index 8b153330..00000000 --- a/src/polar_sdk/models/oauth2_clients_oauth2_get_clientop.py +++ /dev/null @@ -1,16 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from polar_sdk.types import BaseModel -from polar_sdk.utils import FieldMetadata, PathParamMetadata -from typing_extensions import Annotated, TypedDict - - -class Oauth2ClientsOauth2GetClientRequestTypedDict(TypedDict): - client_id: str - - -class Oauth2ClientsOauth2GetClientRequest(BaseModel): - client_id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] diff --git a/src/polar_sdk/models/oauth2_clients_oauth2_update_clientop.py b/src/polar_sdk/models/oauth2_clients_oauth2_update_clientop.py deleted file mode 100644 index 5acdb027..00000000 --- a/src/polar_sdk/models/oauth2_clients_oauth2_update_clientop.py +++ /dev/null @@ -1,26 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from .oauth2clientconfigurationupdate import ( - OAuth2ClientConfigurationUpdate, - OAuth2ClientConfigurationUpdateTypedDict, -) -from polar_sdk.types import BaseModel -from polar_sdk.utils import FieldMetadata, PathParamMetadata, RequestMetadata -from typing_extensions import Annotated, TypedDict - - -class Oauth2ClientsOauth2UpdateClientRequestTypedDict(TypedDict): - client_id: str - o_auth2_client_configuration_update: OAuth2ClientConfigurationUpdateTypedDict - - -class Oauth2ClientsOauth2UpdateClientRequest(BaseModel): - client_id: Annotated[ - str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) - ] - - o_auth2_client_configuration_update: Annotated[ - OAuth2ClientConfigurationUpdate, - FieldMetadata(request=RequestMetadata(media_type="application/json")), - ] diff --git a/src/polar_sdk/models/oauth2client.py b/src/polar_sdk/models/oauth2client.py deleted file mode 100644 index acaa36fc..00000000 --- a/src/polar_sdk/models/oauth2client.py +++ /dev/null @@ -1,126 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from datetime import datetime -from enum import Enum -from polar_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class TokenEndpointAuthMethod(str, Enum): - CLIENT_SECRET_BASIC = "client_secret_basic" - CLIENT_SECRET_POST = "client_secret_post" - NONE = "none" - - -class GrantTypes(str, Enum): - AUTHORIZATION_CODE = "authorization_code" - REFRESH_TOKEN = "refresh_token" - - -class OAuth2ClientTypedDict(TypedDict): - redirect_uris: List[str] - client_name: str - created_at: datetime - r"""Creation timestamp of the object.""" - modified_at: Nullable[datetime] - r"""Last modification timestamp of the object.""" - client_id: str - client_secret: str - client_id_issued_at: int - client_secret_expires_at: int - token_endpoint_auth_method: NotRequired[TokenEndpointAuthMethod] - grant_types: NotRequired[List[GrantTypes]] - response_types: NotRequired[List[str]] - scope: NotRequired[str] - client_uri: NotRequired[Nullable[str]] - logo_uri: NotRequired[Nullable[str]] - tos_uri: NotRequired[Nullable[str]] - policy_uri: NotRequired[Nullable[str]] - - -class OAuth2Client(BaseModel): - redirect_uris: List[str] - - client_name: str - - created_at: datetime - r"""Creation timestamp of the object.""" - - modified_at: Nullable[datetime] - r"""Last modification timestamp of the object.""" - - client_id: str - - client_secret: str - - client_id_issued_at: int - - client_secret_expires_at: int - - token_endpoint_auth_method: Optional[TokenEndpointAuthMethod] = ( - TokenEndpointAuthMethod.CLIENT_SECRET_POST - ) - - grant_types: Optional[List[GrantTypes]] = None - - response_types: Optional[List[str]] = None - - scope: Optional[str] = ( - "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_meters:read customer_sessions:write orders:read orders:write refunds:read refunds:write payments:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write" - ) - - client_uri: OptionalNullable[str] = UNSET - - logo_uri: OptionalNullable[str] = UNSET - - tos_uri: OptionalNullable[str] = UNSET - - policy_uri: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [ - "token_endpoint_auth_method", - "grant_types", - "response_types", - "scope", - "client_uri", - "logo_uri", - "tos_uri", - "policy_uri", - ] - nullable_fields = [ - "client_uri", - "logo_uri", - "tos_uri", - "policy_uri", - "modified_at", - ] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/polar_sdk/models/oauth2clientconfiguration.py b/src/polar_sdk/models/oauth2clientconfiguration.py deleted file mode 100644 index c2520d2e..00000000 --- a/src/polar_sdk/models/oauth2clientconfiguration.py +++ /dev/null @@ -1,99 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from enum import Enum -from polar_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class OAuth2ClientConfigurationTokenEndpointAuthMethod(str, Enum): - CLIENT_SECRET_BASIC = "client_secret_basic" - CLIENT_SECRET_POST = "client_secret_post" - NONE = "none" - - -class OAuth2ClientConfigurationGrantTypes(str, Enum): - AUTHORIZATION_CODE = "authorization_code" - REFRESH_TOKEN = "refresh_token" - - -class OAuth2ClientConfigurationTypedDict(TypedDict): - redirect_uris: List[str] - client_name: str - token_endpoint_auth_method: NotRequired[ - OAuth2ClientConfigurationTokenEndpointAuthMethod - ] - grant_types: NotRequired[List[OAuth2ClientConfigurationGrantTypes]] - response_types: NotRequired[List[str]] - scope: NotRequired[str] - client_uri: NotRequired[Nullable[str]] - logo_uri: NotRequired[Nullable[str]] - tos_uri: NotRequired[Nullable[str]] - policy_uri: NotRequired[Nullable[str]] - - -class OAuth2ClientConfiguration(BaseModel): - redirect_uris: List[str] - - client_name: str - - token_endpoint_auth_method: Optional[ - OAuth2ClientConfigurationTokenEndpointAuthMethod - ] = OAuth2ClientConfigurationTokenEndpointAuthMethod.CLIENT_SECRET_POST - - grant_types: Optional[List[OAuth2ClientConfigurationGrantTypes]] = None - - response_types: Optional[List[str]] = None - - scope: Optional[str] = ( - "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_meters:read customer_sessions:write orders:read orders:write refunds:read refunds:write payments:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write" - ) - - client_uri: OptionalNullable[str] = UNSET - - logo_uri: OptionalNullable[str] = UNSET - - tos_uri: OptionalNullable[str] = UNSET - - policy_uri: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [ - "token_endpoint_auth_method", - "grant_types", - "response_types", - "scope", - "client_uri", - "logo_uri", - "tos_uri", - "policy_uri", - ] - nullable_fields = ["client_uri", "logo_uri", "tos_uri", "policy_uri"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/polar_sdk/models/oauth2clientconfigurationupdate.py b/src/polar_sdk/models/oauth2clientconfigurationupdate.py deleted file mode 100644 index 962dac6f..00000000 --- a/src/polar_sdk/models/oauth2clientconfigurationupdate.py +++ /dev/null @@ -1,102 +0,0 @@ -"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" - -from __future__ import annotations -from enum import Enum -from polar_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL -from pydantic import model_serializer -from typing import List, Optional -from typing_extensions import NotRequired, TypedDict - - -class OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod(str, Enum): - CLIENT_SECRET_BASIC = "client_secret_basic" - CLIENT_SECRET_POST = "client_secret_post" - NONE = "none" - - -class OAuth2ClientConfigurationUpdateGrantTypes(str, Enum): - AUTHORIZATION_CODE = "authorization_code" - REFRESH_TOKEN = "refresh_token" - - -class OAuth2ClientConfigurationUpdateTypedDict(TypedDict): - redirect_uris: List[str] - client_name: str - client_id: str - token_endpoint_auth_method: NotRequired[ - OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod - ] - grant_types: NotRequired[List[OAuth2ClientConfigurationUpdateGrantTypes]] - response_types: NotRequired[List[str]] - scope: NotRequired[str] - client_uri: NotRequired[Nullable[str]] - logo_uri: NotRequired[Nullable[str]] - tos_uri: NotRequired[Nullable[str]] - policy_uri: NotRequired[Nullable[str]] - - -class OAuth2ClientConfigurationUpdate(BaseModel): - redirect_uris: List[str] - - client_name: str - - client_id: str - - token_endpoint_auth_method: Optional[ - OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod - ] = OAuth2ClientConfigurationUpdateTokenEndpointAuthMethod.CLIENT_SECRET_POST - - grant_types: Optional[List[OAuth2ClientConfigurationUpdateGrantTypes]] = None - - response_types: Optional[List[str]] = None - - scope: Optional[str] = ( - "openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_meters:read customer_sessions:write orders:read orders:write refunds:read refunds:write payments:read metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write" - ) - - client_uri: OptionalNullable[str] = UNSET - - logo_uri: OptionalNullable[str] = UNSET - - tos_uri: OptionalNullable[str] = UNSET - - policy_uri: OptionalNullable[str] = UNSET - - @model_serializer(mode="wrap") - def serialize_model(self, handler): - optional_fields = [ - "token_endpoint_auth_method", - "grant_types", - "response_types", - "scope", - "client_uri", - "logo_uri", - "tos_uri", - "policy_uri", - ] - nullable_fields = ["client_uri", "logo_uri", "tos_uri", "policy_uri"] - null_default_fields = [] - - serialized = handler(self) - - m = {} - - for n, f in type(self).model_fields.items(): - k = f.alias or n - val = serialized.get(k) - serialized.pop(k, None) - - optional_nullable = k in optional_fields and k in nullable_fields - is_set = ( - self.__pydantic_fields_set__.intersection({n}) - or k in null_default_fields - ) # pylint: disable=no-member - - if val is not None and val != UNSET_SENTINEL: - m[k] = val - elif val != UNSET_SENTINEL and ( - not k in optional_fields or (optional_nullable and is_set) - ): - m[k] = val - - return m diff --git a/src/polar_sdk/models/orders_generate_invoiceop.py b/src/polar_sdk/models/orders_generate_invoiceop.py index 97b63609..4fd008e6 100644 --- a/src/polar_sdk/models/orders_generate_invoiceop.py +++ b/src/polar_sdk/models/orders_generate_invoiceop.py @@ -3,10 +3,11 @@ from __future__ import annotations from .missinginvoicebillingdetails import MissingInvoiceBillingDetailsData from .notpaidorder import NotPaidOrderData -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import FieldMetadata, PathParamMetadata -from typing import Union +from typing import Optional, Union from typing_extensions import Annotated, TypeAliasType, TypedDict @@ -29,17 +30,17 @@ class OrdersGenerateInvoiceRequest(BaseModel): r"""Order is not paid or is missing billing name or address.""" -class OrdersGenerateInvoiceResponse422OrdersGenerateInvoice(Exception): +class OrdersGenerateInvoiceResponse422OrdersGenerateInvoice(PolarError): r"""Order is not paid or is missing billing name or address.""" data: OrdersGenerateInvoiceResponse422OrdersGenerateInvoiceUnion def __init__( - self, data: OrdersGenerateInvoiceResponse422OrdersGenerateInvoiceUnion + self, + data: OrdersGenerateInvoiceResponse422OrdersGenerateInvoiceUnion, + raw_response: httpx.Response, + body: Optional[str] = None, ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json( - self.data, OrdersGenerateInvoiceResponse422OrdersGenerateInvoiceUnion - ) diff --git a/src/polar_sdk/models/organization.py b/src/polar_sdk/models/organization.py index 1e4a3968..c03ada8d 100644 --- a/src/polar_sdk/models/organization.py +++ b/src/polar_sdk/models/organization.py @@ -5,6 +5,10 @@ OrganizationFeatureSettings, OrganizationFeatureSettingsTypedDict, ) +from .organizationnotificationsettings import ( + OrganizationNotificationSettings, + OrganizationNotificationSettingsTypedDict, +) from .organizationsociallink import ( OrganizationSocialLink, OrganizationSocialLinkTypedDict, @@ -44,6 +48,7 @@ class OrganizationTypedDict(TypedDict): feature_settings: Nullable[OrganizationFeatureSettingsTypedDict] r"""Organization feature settings""" subscription_settings: OrganizationSubscriptionSettingsTypedDict + notification_settings: OrganizationNotificationSettingsTypedDict class Organization(BaseModel): @@ -82,6 +87,8 @@ class Organization(BaseModel): subscription_settings: OrganizationSubscriptionSettings + notification_settings: OrganizationNotificationSettings + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [] diff --git a/src/polar_sdk/models/organizationcreate.py b/src/polar_sdk/models/organizationcreate.py index 43d661f2..904ac99f 100644 --- a/src/polar_sdk/models/organizationcreate.py +++ b/src/polar_sdk/models/organizationcreate.py @@ -6,6 +6,10 @@ OrganizationFeatureSettings, OrganizationFeatureSettingsTypedDict, ) +from .organizationnotificationsettings import ( + OrganizationNotificationSettings, + OrganizationNotificationSettingsTypedDict, +) from .organizationsociallink import ( OrganizationSocialLink, OrganizationSocialLinkTypedDict, @@ -36,6 +40,9 @@ class OrganizationCreateTypedDict(TypedDict): subscription_settings: NotRequired[ Nullable[OrganizationSubscriptionSettingsTypedDict] ] + notification_settings: NotRequired[ + Nullable[OrganizationNotificationSettingsTypedDict] + ] class OrganizationCreate(BaseModel): @@ -61,6 +68,8 @@ class OrganizationCreate(BaseModel): subscription_settings: OptionalNullable[OrganizationSubscriptionSettings] = UNSET + notification_settings: OptionalNullable[OrganizationNotificationSettings] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -71,6 +80,7 @@ def serialize_model(self, handler): "details", "feature_settings", "subscription_settings", + "notification_settings", ] nullable_fields = [ "avatar_url", @@ -80,6 +90,7 @@ def serialize_model(self, handler): "details", "feature_settings", "subscription_settings", + "notification_settings", ] null_default_fields = [] diff --git a/src/polar_sdk/models/organizationfeaturesettings.py b/src/polar_sdk/models/organizationfeaturesettings.py index 36c437ce..61bed445 100644 --- a/src/polar_sdk/models/organizationfeaturesettings.py +++ b/src/polar_sdk/models/organizationfeaturesettings.py @@ -9,13 +9,8 @@ class OrganizationFeatureSettingsTypedDict(TypedDict): issue_funding_enabled: NotRequired[bool] r"""If this organization has issue funding enabled""" - usage_based_billing_enabled: NotRequired[bool] - r"""If this organization has usage-based billing enabled""" class OrganizationFeatureSettings(BaseModel): issue_funding_enabled: Optional[bool] = False r"""If this organization has issue funding enabled""" - - usage_based_billing_enabled: Optional[bool] = False - r"""If this organization has usage-based billing enabled""" diff --git a/src/polar_sdk/models/organizationnotificationsettings.py b/src/polar_sdk/models/organizationnotificationsettings.py new file mode 100644 index 00000000..a347944f --- /dev/null +++ b/src/polar_sdk/models/organizationnotificationsettings.py @@ -0,0 +1,16 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from polar_sdk.types import BaseModel +from typing_extensions import TypedDict + + +class OrganizationNotificationSettingsTypedDict(TypedDict): + new_order: bool + new_subscription: bool + + +class OrganizationNotificationSettings(BaseModel): + new_order: bool + + new_subscription: bool diff --git a/src/polar_sdk/models/organizationupdate.py b/src/polar_sdk/models/organizationupdate.py index 7f226e26..3a8d80ea 100644 --- a/src/polar_sdk/models/organizationupdate.py +++ b/src/polar_sdk/models/organizationupdate.py @@ -6,6 +6,10 @@ OrganizationFeatureSettings, OrganizationFeatureSettingsTypedDict, ) +from .organizationnotificationsettings import ( + OrganizationNotificationSettings, + OrganizationNotificationSettingsTypedDict, +) from .organizationsociallink import ( OrganizationSocialLink, OrganizationSocialLinkTypedDict, @@ -35,6 +39,9 @@ class OrganizationUpdateTypedDict(TypedDict): subscription_settings: NotRequired[ Nullable[OrganizationSubscriptionSettingsTypedDict] ] + notification_settings: NotRequired[ + Nullable[OrganizationNotificationSettingsTypedDict] + ] class OrganizationUpdate(BaseModel): @@ -58,6 +65,8 @@ class OrganizationUpdate(BaseModel): subscription_settings: OptionalNullable[OrganizationSubscriptionSettings] = UNSET + notification_settings: OptionalNullable[OrganizationNotificationSettings] = UNSET + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = [ @@ -69,6 +78,7 @@ def serialize_model(self, handler): "details", "feature_settings", "subscription_settings", + "notification_settings", ] nullable_fields = [ "name", @@ -79,6 +89,7 @@ def serialize_model(self, handler): "details", "feature_settings", "subscription_settings", + "notification_settings", ] null_default_fields = [] diff --git a/src/polar_sdk/models/paymenterror.py b/src/polar_sdk/models/paymenterror.py index 624b873f..cd9cce42 100644 --- a/src/polar_sdk/models/paymenterror.py +++ b/src/polar_sdk/models/paymenterror.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -21,11 +22,15 @@ class PaymentErrorData(BaseModel): ] = "PaymentError" -class PaymentError(Exception): +class PaymentError(PolarError): data: PaymentErrorData - def __init__(self, data: PaymentErrorData): + def __init__( + self, + data: PaymentErrorData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, PaymentErrorData) diff --git a/src/polar_sdk/models/paymentmethodcard.py b/src/polar_sdk/models/paymentmethodcard.py index eb269b5b..a38ab2a3 100644 --- a/src/polar_sdk/models/paymentmethodcard.py +++ b/src/polar_sdk/models/paymentmethodcard.py @@ -1,11 +1,16 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from .paymentmethodcarddata import PaymentMethodCardData, PaymentMethodCardDataTypedDict +from .paymentmethodcardmetadata import ( + PaymentMethodCardMetadata, + PaymentMethodCardMetadataTypedDict, +) +from .paymentprocessor import PaymentProcessor from datetime import datetime -from polar_sdk.types import BaseModel +from polar_sdk.types import BaseModel, Nullable, UNSET_SENTINEL from polar_sdk.utils import validate_const import pydantic +from pydantic import model_serializer from pydantic.functional_validators import AfterValidator from typing import Literal from typing_extensions import Annotated, TypedDict @@ -13,22 +18,64 @@ class PaymentMethodCardTypedDict(TypedDict): id: str + r"""The ID of the object.""" created_at: datetime - default: bool - card: PaymentMethodCardDataTypedDict + r"""Creation timestamp of the object.""" + modified_at: Nullable[datetime] + r"""Last modification timestamp of the object.""" + processor: PaymentProcessor + customer_id: str + method_metadata: PaymentMethodCardMetadataTypedDict type: Literal["card"] class PaymentMethodCard(BaseModel): id: str + r"""The ID of the object.""" created_at: datetime + r"""Creation timestamp of the object.""" - default: bool + modified_at: Nullable[datetime] + r"""Last modification timestamp of the object.""" - card: PaymentMethodCardData + processor: PaymentProcessor + + customer_id: str + + method_metadata: PaymentMethodCardMetadata TYPE: Annotated[ Annotated[Literal["card"], AfterValidator(validate_const("card"))], pydantic.Field(alias="type"), ] = "card" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["modified_at"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val + + return m diff --git a/src/polar_sdk/models/paymentmethodcarddata.py b/src/polar_sdk/models/paymentmethodcardmetadata.py similarity index 93% rename from src/polar_sdk/models/paymentmethodcarddata.py rename to src/polar_sdk/models/paymentmethodcardmetadata.py index 8f03c9a0..f3d2bbf4 100644 --- a/src/polar_sdk/models/paymentmethodcarddata.py +++ b/src/polar_sdk/models/paymentmethodcardmetadata.py @@ -6,7 +6,7 @@ from typing_extensions import NotRequired, TypedDict -class PaymentMethodCardDataTypedDict(TypedDict): +class PaymentMethodCardMetadataTypedDict(TypedDict): brand: str last4: str exp_month: int @@ -14,7 +14,7 @@ class PaymentMethodCardDataTypedDict(TypedDict): wallet: NotRequired[Nullable[str]] -class PaymentMethodCardData(BaseModel): +class PaymentMethodCardMetadata(BaseModel): brand: str last4: str diff --git a/src/polar_sdk/models/paymentmethodgeneric.py b/src/polar_sdk/models/paymentmethodgeneric.py index 68614961..ab3bbf91 100644 --- a/src/polar_sdk/models/paymentmethodgeneric.py +++ b/src/polar_sdk/models/paymentmethodgeneric.py @@ -1,23 +1,67 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations +from .paymentprocessor import PaymentProcessor from datetime import datetime -from polar_sdk.types import BaseModel +from polar_sdk.types import BaseModel, Nullable, UNSET_SENTINEL +from pydantic import model_serializer from typing_extensions import TypedDict class PaymentMethodGenericTypedDict(TypedDict): id: str - type: str + r"""The ID of the object.""" created_at: datetime - default: bool + r"""Creation timestamp of the object.""" + modified_at: Nullable[datetime] + r"""Last modification timestamp of the object.""" + processor: PaymentProcessor + customer_id: str + type: str class PaymentMethodGeneric(BaseModel): id: str + r"""The ID of the object.""" + + created_at: datetime + r"""Creation timestamp of the object.""" + + modified_at: Nullable[datetime] + r"""Last modification timestamp of the object.""" + + processor: PaymentProcessor + + customer_id: str type: str - created_at: datetime + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = [] + nullable_fields = ["modified_at"] + null_default_fields = [] + + serialized = handler(self) + + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + serialized.pop(k, None) + + optional_nullable = k in optional_fields and k in nullable_fields + is_set = ( + self.__pydantic_fields_set__.intersection({n}) + or k in null_default_fields + ) # pylint: disable=no-member + + if val is not None and val != UNSET_SENTINEL: + m[k] = val + elif val != UNSET_SENTINEL and ( + not k in optional_fields or (optional_nullable and is_set) + ): + m[k] = val - default: bool + return m diff --git a/src/polar_sdk/models/polarerror.py b/src/polar_sdk/models/polarerror.py new file mode 100644 index 00000000..9dbc08ac --- /dev/null +++ b/src/polar_sdk/models/polarerror.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import httpx +from typing import Optional + + +class PolarError(Exception): + """The base class for all HTTP error responses.""" + + message: str + status_code: int + body: str + headers: httpx.Headers + raw_response: httpx.Response + + def __init__( + self, message: str, raw_response: httpx.Response, body: Optional[str] = None + ): + self.message = message + self.status_code = raw_response.status_code + self.body = body if body is not None else raw_response.text + self.headers = raw_response.headers + self.raw_response = raw_response + + def __str__(self): + return self.message diff --git a/src/polar_sdk/models/refundamounttoohigh.py b/src/polar_sdk/models/refundamounttoohigh.py index 43b90fe5..a52e034a 100644 --- a/src/polar_sdk/models/refundamounttoohigh.py +++ b/src/polar_sdk/models/refundamounttoohigh.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class RefundAmountTooHighData(BaseModel): ] = "RefundAmountTooHigh" -class RefundAmountTooHigh(Exception): +class RefundAmountTooHigh(PolarError): data: RefundAmountTooHighData - def __init__(self, data: RefundAmountTooHighData): + def __init__( + self, + data: RefundAmountTooHighData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, RefundAmountTooHighData) diff --git a/src/polar_sdk/models/refundedalready.py b/src/polar_sdk/models/refundedalready.py index bdd0a165..955d78ab 100644 --- a/src/polar_sdk/models/refundedalready.py +++ b/src/polar_sdk/models/refundedalready.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class RefundedAlreadyData(BaseModel): ] = "RefundedAlready" -class RefundedAlready(Exception): +class RefundedAlready(PolarError): data: RefundedAlreadyData - def __init__(self, data: RefundedAlreadyData): + def __init__( + self, + data: RefundedAlreadyData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, RefundedAlreadyData) diff --git a/src/polar_sdk/models/resourcenotfound.py b/src/polar_sdk/models/resourcenotfound.py index 71f07600..276fd5be 100644 --- a/src/polar_sdk/models/resourcenotfound.py +++ b/src/polar_sdk/models/resourcenotfound.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -22,11 +23,15 @@ class ResourceNotFoundData(BaseModel): ] = "ResourceNotFound" -class ResourceNotFound(Exception): +class ResourceNotFound(PolarError): data: ResourceNotFoundData - def __init__(self, data: ResourceNotFoundData): + def __init__( + self, + data: ResourceNotFoundData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, ResourceNotFoundData) diff --git a/src/polar_sdk/models/responsevalidationerror.py b/src/polar_sdk/models/responsevalidationerror.py new file mode 100644 index 00000000..10021c95 --- /dev/null +++ b/src/polar_sdk/models/responsevalidationerror.py @@ -0,0 +1,25 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +import httpx +from typing import Optional + +from polar_sdk.models import PolarError + + +class ResponseValidationError(PolarError): + """Error raised when there is a type mismatch between the response data and the expected Pydantic model.""" + + def __init__( + self, + message: str, + raw_response: httpx.Response, + cause: Exception, + body: Optional[str] = None, + ): + message = f"{message}: {cause}" + super().__init__(message, raw_response, body) + + @property + def cause(self): + """Normally the Pydantic ValidationError""" + return self.__cause__ diff --git a/src/polar_sdk/models/sdkerror.py b/src/polar_sdk/models/sdkerror.py index 03216cbf..0912749b 100644 --- a/src/polar_sdk/models/sdkerror.py +++ b/src/polar_sdk/models/sdkerror.py @@ -1,22 +1,38 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from dataclasses import dataclass -from typing import Optional import httpx +from typing import Optional + +from polar_sdk.models import PolarError + +MAX_MESSAGE_LEN = 10_000 + + +class SDKError(PolarError): + """The fallback error class if no more specific error class is matched.""" + + def __init__( + self, message: str, raw_response: httpx.Response, body: Optional[str] = None + ): + body_display = body or raw_response.text or '""' + if message: + message += ": " + message += f"Status {raw_response.status_code}" -@dataclass -class SDKError(Exception): - """Represents an error returned by the API.""" + headers = raw_response.headers + content_type = headers.get("content-type", '""') + if content_type != "application/json": + if " " in content_type: + content_type = f'"{content_type}"' + message += f" Content-Type {content_type}" - message: str - status_code: int = -1 - body: str = "" - raw_response: Optional[httpx.Response] = None + if len(body_display) > MAX_MESSAGE_LEN: + truncated = body_display[:MAX_MESSAGE_LEN] + remaining = len(body_display) - MAX_MESSAGE_LEN + body_display = f"{truncated}...and {remaining} more chars" - def __str__(self): - body = "" - if len(self.body) > 0: - body = f"\n{self.body}" + message += f". Body: {body_display}" + message = message.strip() - return f"{self.message}: Status {self.status_code}{body}" + super().__init__(message, raw_response, body) diff --git a/src/polar_sdk/models/subscriptions_listop.py b/src/polar_sdk/models/subscriptions_listop.py index 48a678cf..19d34899 100644 --- a/src/polar_sdk/models/subscriptions_listop.py +++ b/src/polar_sdk/models/subscriptions_listop.py @@ -61,6 +61,18 @@ r"""Filter by customer ID.""" +ExternalCustomerIDFilterTypedDict = TypeAliasType( + "ExternalCustomerIDFilterTypedDict", Union[str, List[str]] +) +r"""Filter by customer external ID.""" + + +ExternalCustomerIDFilter = TypeAliasType( + "ExternalCustomerIDFilter", Union[str, List[str]] +) +r"""Filter by customer external ID.""" + + DiscountIDFilterTypedDict = TypeAliasType( "DiscountIDFilterTypedDict", Union[str, List[str]] ) @@ -88,6 +100,8 @@ class SubscriptionsListRequestTypedDict(TypedDict): r"""Filter by product ID.""" customer_id: NotRequired[Nullable[CustomerIDFilterTypedDict]] r"""Filter by customer ID.""" + external_customer_id: NotRequired[Nullable[ExternalCustomerIDFilterTypedDict]] + r"""Filter by customer external ID.""" discount_id: NotRequired[Nullable[DiscountIDFilterTypedDict]] r"""Filter by discount ID.""" active: NotRequired[Nullable[bool]] @@ -121,6 +135,12 @@ class SubscriptionsListRequest(BaseModel): ] = UNSET r"""Filter by customer ID.""" + external_customer_id: Annotated[ + OptionalNullable[ExternalCustomerIDFilter], + FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), + ] = UNSET + r"""Filter by customer external ID.""" + discount_id: Annotated[ OptionalNullable[DiscountIDFilter], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), @@ -163,6 +183,7 @@ def serialize_model(self, handler): "organization_id", "product_id", "customer_id", + "external_customer_id", "discount_id", "active", "page", @@ -174,6 +195,7 @@ def serialize_model(self, handler): "organization_id", "product_id", "customer_id", + "external_customer_id", "discount_id", "active", "sorting", @@ -902,14 +924,14 @@ class CustomersListResponse(BaseModel): r"""Filter by customer ID.""" -ExternalCustomerIDFilterTypedDict = TypeAliasType( - "ExternalCustomerIDFilterTypedDict", Union[str, List[str]] +QueryParamExternalCustomerIDFilterTypedDict = TypeAliasType( + "QueryParamExternalCustomerIDFilterTypedDict", Union[str, List[str]] ) r"""Filter by external customer ID.""" -ExternalCustomerIDFilter = TypeAliasType( - "ExternalCustomerIDFilter", Union[str, List[str]] +QueryParamExternalCustomerIDFilter = TypeAliasType( + "QueryParamExternalCustomerIDFilter", Union[str, List[str]] ) r"""Filter by external customer ID.""" @@ -945,7 +967,9 @@ class EventsListRequestTypedDict(TypedDict): r"""Filter by organization ID.""" customer_id: NotRequired[Nullable[EventsListQueryParamCustomerIDFilterTypedDict]] r"""Filter by customer ID.""" - external_customer_id: NotRequired[Nullable[ExternalCustomerIDFilterTypedDict]] + external_customer_id: NotRequired[ + Nullable[QueryParamExternalCustomerIDFilterTypedDict] + ] r"""Filter by external customer ID.""" meter_id: NotRequired[Nullable[str]] r"""Filter by a meter filter clause.""" @@ -996,7 +1020,7 @@ class EventsListRequest(BaseModel): r"""Filter by customer ID.""" external_customer_id: Annotated[ - OptionalNullable[ExternalCustomerIDFilter], + OptionalNullable[QueryParamExternalCustomerIDFilter], FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), ] = UNSET r"""Filter by external customer ID.""" diff --git a/src/polar_sdk/models/unauthorized.py b/src/polar_sdk/models/unauthorized.py index 15eaa4da..05b5ab39 100644 --- a/src/polar_sdk/models/unauthorized.py +++ b/src/polar_sdk/models/unauthorized.py @@ -1,12 +1,13 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from polar_sdk import utils +import httpx +from polar_sdk.models import PolarError from polar_sdk.types import BaseModel from polar_sdk.utils import validate_const import pydantic from pydantic.functional_validators import AfterValidator -from typing import Literal +from typing import Literal, Optional from typing_extensions import Annotated @@ -21,11 +22,15 @@ class UnauthorizedData(BaseModel): ] = "Unauthorized" -class Unauthorized(Exception): +class Unauthorized(PolarError): data: UnauthorizedData - def __init__(self, data: UnauthorizedData): + def __init__( + self, + data: UnauthorizedData, + raw_response: httpx.Response, + body: Optional[str] = None, + ): + message = body or raw_response.text + super().__init__(message, raw_response, body) self.data = data - - def __str__(self) -> str: - return utils.marshal_json(self.data, UnauthorizedData) diff --git a/src/polar_sdk/oauth2.py b/src/polar_sdk/oauth2.py index 8d169666..29a254d6 100644 --- a/src/polar_sdk/oauth2.py +++ b/src/polar_sdk/oauth2.py @@ -1,25 +1,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from .basesdk import BaseSDK -from .sdkconfiguration import SDKConfiguration from polar_sdk import models, utils from polar_sdk._hooks import HookContext -from polar_sdk.clients import Clients from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Mapping, Optional, Union, cast class Oauth2(BaseSDK): - clients: Clients - - def __init__(self, sdk_config: SDKConfiguration) -> None: - BaseSDK.__init__(self, sdk_config) - self.sdk_configuration = sdk_config - self._init_sdks() - - def _init_sdks(self): - self.clients = Clients(self.sdk_configuration) - def authorize( self, *, @@ -82,28 +71,17 @@ def authorize( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.Oauth2AuthorizeResponseOauth2Authorize + return unmarshal_json_response( + models.Oauth2AuthorizeResponseOauth2Authorize, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def authorize_async( self, @@ -167,28 +145,17 @@ async def authorize_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.Oauth2AuthorizeResponseOauth2Authorize + return unmarshal_json_response( + models.Oauth2AuthorizeResponseOauth2Authorize, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def token( self, @@ -234,10 +201,11 @@ def token( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "form", models.Oauth2RequestTokenRequestBody ), @@ -258,7 +226,7 @@ def token( base_url=base_url or "", operation_id="oauth2:request_token", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["4XX", "5XX"], @@ -266,26 +234,15 @@ def token( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.TokenResponse) + return unmarshal_json_response(models.TokenResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def token_async( self, @@ -331,10 +288,11 @@ async def token_async( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "form", models.Oauth2RequestTokenRequestBody ), @@ -355,7 +313,7 @@ async def token_async( base_url=base_url or "", operation_id="oauth2:request_token", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["4XX", "5XX"], @@ -363,26 +321,15 @@ async def token_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.TokenResponse) + return unmarshal_json_response(models.TokenResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def revoke( self, @@ -425,10 +372,11 @@ def revoke( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "form", models.RevokeTokenRequest ), @@ -449,7 +397,7 @@ def revoke( base_url=base_url or "", operation_id="oauth2:revoke_token", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["4XX", "5XX"], @@ -457,26 +405,15 @@ def revoke( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.RevokeTokenResponse) + return unmarshal_json_response(models.RevokeTokenResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def revoke_async( self, @@ -519,10 +456,11 @@ async def revoke_async( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "form", models.RevokeTokenRequest ), @@ -543,7 +481,7 @@ async def revoke_async( base_url=base_url or "", operation_id="oauth2:revoke_token", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["4XX", "5XX"], @@ -551,26 +489,15 @@ async def revoke_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.RevokeTokenResponse) + return unmarshal_json_response(models.RevokeTokenResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def introspect( self, @@ -615,10 +542,11 @@ def introspect( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "form", models.IntrospectTokenRequest ), @@ -639,7 +567,7 @@ def introspect( base_url=base_url or "", operation_id="oauth2:introspect_token", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["4XX", "5XX"], @@ -647,26 +575,15 @@ def introspect( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.IntrospectTokenResponse) + return unmarshal_json_response(models.IntrospectTokenResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def introspect_async( self, @@ -711,10 +628,11 @@ async def introspect_async( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "form", models.IntrospectTokenRequest ), @@ -735,7 +653,7 @@ async def introspect_async( base_url=base_url or "", operation_id="oauth2:introspect_token", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["4XX", "5XX"], @@ -743,26 +661,15 @@ async def introspect_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.IntrospectTokenResponse) + return unmarshal_json_response(models.IntrospectTokenResponse, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def userinfo( self, @@ -828,28 +735,17 @@ def userinfo( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.Oauth2UserinfoResponseOauth2Userinfo + return unmarshal_json_response( + models.Oauth2UserinfoResponseOauth2Userinfo, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def userinfo_async( self, @@ -915,25 +811,14 @@ async def userinfo_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json( - http_res.text, models.Oauth2UserinfoResponseOauth2Userinfo + return unmarshal_json_response( + models.Oauth2UserinfoResponseOauth2Userinfo, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/orders.py b/src/polar_sdk/orders.py index b69b8278..ced30198 100644 --- a/src/polar_sdk/orders.py +++ b/src/polar_sdk/orders.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -175,33 +176,22 @@ def next_func() -> Optional[models.OrdersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.OrdersListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceOrder), + result=unmarshal_json_response(models.ListResourceOrder, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -369,33 +359,22 @@ def next_func() -> Optional[models.OrdersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.OrdersListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceOrder), + result=unmarshal_json_response(models.ListResourceOrder, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -471,36 +450,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Order) + return unmarshal_json_response(models.Order, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -576,36 +544,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Order) + return unmarshal_json_response(models.Order, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -687,36 +644,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Order) + return unmarshal_json_response(models.Order, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -798,36 +744,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Order) + return unmarshal_json_response(models.Order, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def generate_invoice( self, @@ -903,39 +838,28 @@ def generate_invoice( response_data: Any = None if utils.match_response(http_res, "202", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "409", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.InvoiceAlreadyExistsData + response_data = unmarshal_json_response( + models.InvoiceAlreadyExistsData, http_res ) - raise models.InvoiceAlreadyExists(data=response_data) + raise models.InvoiceAlreadyExists(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, + response_data = unmarshal_json_response( models.OrdersGenerateInvoiceResponse422OrdersGenerateInvoiceUnion, + http_res, ) raise models.OrdersGenerateInvoiceResponse422OrdersGenerateInvoice( - data=response_data + response_data, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def generate_invoice_async( self, @@ -1011,39 +935,28 @@ async def generate_invoice_async( response_data: Any = None if utils.match_response(http_res, "202", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "409", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.InvoiceAlreadyExistsData + response_data = unmarshal_json_response( + models.InvoiceAlreadyExistsData, http_res ) - raise models.InvoiceAlreadyExists(data=response_data) + raise models.InvoiceAlreadyExists(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, + response_data = unmarshal_json_response( models.OrdersGenerateInvoiceResponse422OrdersGenerateInvoiceUnion, + http_res, ) raise models.OrdersGenerateInvoiceResponse422OrdersGenerateInvoice( - data=response_data + response_data, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def invoice( self, @@ -1119,36 +1032,25 @@ def invoice( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.OrderInvoice) + return unmarshal_json_response(models.OrderInvoice, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def invoice_async( self, @@ -1224,33 +1126,22 @@ async def invoice_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.OrderInvoice) + return unmarshal_json_response(models.OrderInvoice, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/organizations.py b/src/polar_sdk/organizations.py index f7246bb2..0195d403 100644 --- a/src/polar_sdk/organizations.py +++ b/src/polar_sdk/organizations.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -119,35 +120,24 @@ def next_func() -> Optional[models.OrganizationsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.OrganizationsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceOrganization + result=unmarshal_json_response( + models.ListResourceOrganization, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -259,35 +249,24 @@ def next_func() -> Optional[models.OrganizationsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.OrganizationsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceOrganization + result=unmarshal_json_response( + models.ListResourceOrganization, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -366,31 +345,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Organization) + return unmarshal_json_response(models.Organization, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -469,31 +437,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Organization) + return unmarshal_json_response(models.Organization, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -569,36 +526,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Organization) + return unmarshal_json_response(models.Organization, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -674,36 +620,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Organization) + return unmarshal_json_response(models.Organization, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -793,39 +728,28 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Organization) + return unmarshal_json_response(models.Organization, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -915,36 +839,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Organization) + return unmarshal_json_response(models.Organization, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/payments.py b/src/polar_sdk/payments.py index b2a51d65..43d38d19 100644 --- a/src/polar_sdk/payments.py +++ b/src/polar_sdk/payments.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -160,33 +161,22 @@ def next_func() -> Optional[models.PaymentsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.PaymentsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResource), + result=unmarshal_json_response(models.ListResource, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -339,33 +329,22 @@ def next_func() -> Optional[models.PaymentsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.PaymentsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResource), + result=unmarshal_json_response(models.ListResource, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -441,36 +420,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Payment) + return unmarshal_json_response(models.Payment, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -546,33 +514,22 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Payment) + return unmarshal_json_response(models.Payment, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/polar_customer_meters.py b/src/polar_sdk/polar_customer_meters.py index 33772dcd..d5da82f1 100644 --- a/src/polar_sdk/polar_customer_meters.py +++ b/src/polar_sdk/polar_customer_meters.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -135,35 +136,24 @@ def next_func() -> Optional[models.CustomerPortalCustomerMetersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalCustomerMetersListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerCustomerMeter + result=unmarshal_json_response( + models.ListResourceCustomerCustomerMeter, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -291,35 +281,24 @@ def next_func() -> Optional[models.CustomerPortalCustomerMetersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalCustomerMetersListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerCustomerMeter + result=unmarshal_json_response( + models.ListResourceCustomerCustomerMeter, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -402,36 +381,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerCustomerMeter) + return unmarshal_json_response(models.CustomerCustomerMeter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -514,33 +482,22 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerCustomerMeter) + return unmarshal_json_response(models.CustomerCustomerMeter, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/polar_customers.py b/src/polar_sdk/polar_customers.py index f7d49bbb..502248e2 100644 --- a/src/polar_sdk/polar_customers.py +++ b/src/polar_sdk/polar_customers.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -82,26 +83,15 @@ def get( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerPortalCustomer) + return unmarshal_json_response(models.CustomerPortalCustomer, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -176,26 +166,15 @@ async def get_async( ) if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerPortalCustomer) + return unmarshal_json_response(models.CustomerPortalCustomer, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -284,31 +263,20 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerPortalCustomer) + return unmarshal_json_response(models.CustomerPortalCustomer, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -397,38 +365,27 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerPortalCustomer) + return unmarshal_json_response(models.CustomerPortalCustomer, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) - def get_payment_methods( + def list_payment_methods( self, *, security: Union[ - models.CustomerPortalCustomersGetPaymentMethodsSecurity, - models.CustomerPortalCustomersGetPaymentMethodsSecurityTypedDict, + models.CustomerPortalCustomersListPaymentMethodsSecurity, + models.CustomerPortalCustomersListPaymentMethodsSecurityTypedDict, ], page: Optional[int] = 1, limit: Optional[int] = 10, @@ -436,8 +393,8 @@ def get_payment_methods( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[models.CustomerPortalCustomersGetPaymentMethodsResponse]: - r"""Get Customer Payment Methods + ) -> Optional[models.CustomerPortalCustomersListPaymentMethodsResponse]: + r"""List Customer Payment Methods Get saved payment methods of the authenticated customer. @@ -461,7 +418,7 @@ def get_payment_methods( else: base_url = self._get_url(base_url, url_variables) - request = models.CustomerPortalCustomersGetPaymentMethodsRequest( + request = models.CustomerPortalCustomersListPaymentMethodsRequest( page=page, limit=limit, ) @@ -479,7 +436,7 @@ def get_payment_methods( accept_header_value="application/json", http_headers=http_headers, security=utils.get_pydantic_model( - security, models.CustomerPortalCustomersGetPaymentMethodsSecurity + security, models.CustomerPortalCustomersListPaymentMethodsSecurity ), timeout_ms=timeout_ms, ) @@ -496,7 +453,7 @@ def get_payment_methods( hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="customer_portal:customers:get_payment_methods", + operation_id="customer_portal:customers:list_payment_methods", oauth2_scopes=None, security_source=security, ), @@ -506,7 +463,7 @@ def get_payment_methods( ) def next_func() -> ( - Optional[models.CustomerPortalCustomersGetPaymentMethodsResponse] + Optional[models.CustomerPortalCustomersListPaymentMethodsResponse] ): body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) page = request.page if not request.page is None else 1 @@ -525,7 +482,7 @@ def next_func() -> ( if len(results[0]) < limit: return None - return self.get_payment_methods( + return self.list_payment_methods( security=security, page=next_page, limit=limit, @@ -534,44 +491,33 @@ def next_func() -> ( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return models.CustomerPortalCustomersGetPaymentMethodsResponse( - result=utils.unmarshal_json( - http_res.text, + return models.CustomerPortalCustomersListPaymentMethodsResponse( + result=unmarshal_json_response( models.ListResourceUnionPaymentMethodCardPaymentMethodGeneric, + http_res, ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) - async def get_payment_methods_async( + async def list_payment_methods_async( self, *, security: Union[ - models.CustomerPortalCustomersGetPaymentMethodsSecurity, - models.CustomerPortalCustomersGetPaymentMethodsSecurityTypedDict, + models.CustomerPortalCustomersListPaymentMethodsSecurity, + models.CustomerPortalCustomersListPaymentMethodsSecurityTypedDict, ], page: Optional[int] = 1, limit: Optional[int] = 10, @@ -579,8 +525,8 @@ async def get_payment_methods_async( server_url: Optional[str] = None, timeout_ms: Optional[int] = None, http_headers: Optional[Mapping[str, str]] = None, - ) -> Optional[models.CustomerPortalCustomersGetPaymentMethodsResponse]: - r"""Get Customer Payment Methods + ) -> Optional[models.CustomerPortalCustomersListPaymentMethodsResponse]: + r"""List Customer Payment Methods Get saved payment methods of the authenticated customer. @@ -604,7 +550,7 @@ async def get_payment_methods_async( else: base_url = self._get_url(base_url, url_variables) - request = models.CustomerPortalCustomersGetPaymentMethodsRequest( + request = models.CustomerPortalCustomersListPaymentMethodsRequest( page=page, limit=limit, ) @@ -622,7 +568,7 @@ async def get_payment_methods_async( accept_header_value="application/json", http_headers=http_headers, security=utils.get_pydantic_model( - security, models.CustomerPortalCustomersGetPaymentMethodsSecurity + security, models.CustomerPortalCustomersListPaymentMethodsSecurity ), timeout_ms=timeout_ms, ) @@ -639,7 +585,7 @@ async def get_payment_methods_async( hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="customer_portal:customers:get_payment_methods", + operation_id="customer_portal:customers:list_payment_methods", oauth2_scopes=None, security_source=security, ), @@ -649,7 +595,7 @@ async def get_payment_methods_async( ) def next_func() -> ( - Optional[models.CustomerPortalCustomersGetPaymentMethodsResponse] + Optional[models.CustomerPortalCustomersListPaymentMethodsResponse] ): body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]]) page = request.page if not request.page is None else 1 @@ -668,7 +614,7 @@ def next_func() -> ( if len(results[0]) < limit: return None - return self.get_payment_methods( + return self.list_payment_methods( security=security, page=next_page, limit=limit, @@ -677,37 +623,26 @@ def next_func() -> ( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return models.CustomerPortalCustomersGetPaymentMethodsResponse( - result=utils.unmarshal_json( - http_res.text, + return models.CustomerPortalCustomersListPaymentMethodsResponse( + result=unmarshal_json_response( models.ListResourceUnionPaymentMethodCardPaymentMethodGeneric, + http_res, ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def add_payment_method( self, @@ -796,34 +731,23 @@ def add_payment_method( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json( - http_res.text, + return unmarshal_json_response( models.CustomerPortalCustomersAddPaymentMethodResponseCustomerPortalCustomersAddPaymentMethod, + http_res, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def add_payment_method_async( self, @@ -912,34 +836,23 @@ async def add_payment_method_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json( - http_res.text, + return unmarshal_json_response( models.CustomerPortalCustomersAddPaymentMethodResponseCustomerPortalCustomersAddPaymentMethod, + http_res, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete_payment_method( self, @@ -1024,34 +937,23 @@ def delete_payment_method( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_payment_method_async( self, @@ -1136,31 +1038,20 @@ async def delete_payment_method_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/polar_license_keys.py b/src/polar_sdk/polar_license_keys.py index 13e21c59..06ecc767 100644 --- a/src/polar_sdk/polar_license_keys.py +++ b/src/polar_sdk/polar_license_keys.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -130,43 +131,32 @@ def next_func() -> Optional[models.CustomerPortalLicenseKeysListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalLicenseKeysListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceLicenseKeyRead + result=unmarshal_json_response( + models.ListResourceLicenseKeyRead, http_res ), next=next_func, ) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -289,43 +279,32 @@ def next_func() -> Optional[models.CustomerPortalLicenseKeysListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalLicenseKeysListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceLicenseKeyRead + result=unmarshal_json_response( + models.ListResourceLicenseKeyRead, http_res ), next=next_func, ) if utils.match_response(http_res, "401", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.UnauthorizedData) - raise models.Unauthorized(data=response_data) + response_data = unmarshal_json_response(models.UnauthorizedData, http_res) + raise models.Unauthorized(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -408,36 +387,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyWithActivations) + return unmarshal_json_response(models.LicenseKeyWithActivations, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -520,36 +488,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyWithActivations) + return unmarshal_json_response(models.LicenseKeyWithActivations, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def validate( self, @@ -592,10 +549,11 @@ def validate( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LicenseKeyValidate ), @@ -616,7 +574,7 @@ def validate( base_url=base_url or "", operation_id="customer_portal:license_keys:validate", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["404", "422", "4XX", "5XX"], @@ -625,36 +583,25 @@ def validate( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.ValidatedLicenseKey) + return unmarshal_json_response(models.ValidatedLicenseKey, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def validate_async( self, @@ -697,10 +644,11 @@ async def validate_async( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LicenseKeyValidate ), @@ -721,7 +669,7 @@ async def validate_async( base_url=base_url or "", operation_id="customer_portal:license_keys:validate", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["404", "422", "4XX", "5XX"], @@ -730,36 +678,25 @@ async def validate_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.ValidatedLicenseKey) + return unmarshal_json_response(models.ValidatedLicenseKey, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def activate( self, @@ -802,10 +739,11 @@ def activate( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LicenseKeyActivate ), @@ -826,7 +764,7 @@ def activate( base_url=base_url or "", operation_id="customer_portal:license_keys:activate", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["403", "404", "422", "4XX", "5XX"], @@ -835,39 +773,28 @@ def activate( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyActivationRead) + return unmarshal_json_response(models.LicenseKeyActivationRead, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def activate_async( self, @@ -910,10 +837,11 @@ async def activate_async( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LicenseKeyActivate ), @@ -934,7 +862,7 @@ async def activate_async( base_url=base_url or "", operation_id="customer_portal:license_keys:activate", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["403", "404", "422", "4XX", "5XX"], @@ -943,39 +871,28 @@ async def activate_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.LicenseKeyActivationRead) + return unmarshal_json_response(models.LicenseKeyActivationRead, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def deactivate( self, @@ -1020,10 +937,11 @@ def deactivate( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LicenseKeyDeactivate ), @@ -1044,7 +962,7 @@ def deactivate( base_url=base_url or "", operation_id="customer_portal:license_keys:deactivate", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["404", "422", "4XX", "5XX"], @@ -1055,34 +973,23 @@ def deactivate( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def deactivate_async( self, @@ -1127,10 +1034,11 @@ async def deactivate_async( request=request, request_body_required=True, request_has_path_params=False, - request_has_query_params=False, + request_has_query_params=True, user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, + security=self.sdk_configuration.security, get_serialized_body=lambda: utils.serialize_request_body( request, False, False, "json", models.LicenseKeyDeactivate ), @@ -1151,7 +1059,7 @@ async def deactivate_async( base_url=base_url or "", operation_id="customer_portal:license_keys:deactivate", oauth2_scopes=[], - security_source=None, + security_source=self.sdk_configuration.security, ), request=req, error_status_codes=["404", "422", "4XX", "5XX"], @@ -1162,31 +1070,20 @@ async def deactivate_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/polar_orders.py b/src/polar_sdk/polar_orders.py index 502d26cb..0189c945 100644 --- a/src/polar_sdk/polar_orders.py +++ b/src/polar_sdk/polar_orders.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -163,35 +164,24 @@ def next_func() -> Optional[models.CustomerPortalOrdersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalOrdersListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerOrder + result=unmarshal_json_response( + models.ListResourceCustomerOrder, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -347,35 +337,24 @@ def next_func() -> Optional[models.CustomerPortalOrdersListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalOrdersListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerOrder + result=unmarshal_json_response( + models.ListResourceCustomerOrder, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -458,36 +437,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrder) + return unmarshal_json_response(models.CustomerOrder, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -570,36 +538,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrder) + return unmarshal_json_response(models.CustomerOrder, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -696,36 +653,25 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrder) + return unmarshal_json_response(models.CustomerOrder, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -822,36 +768,25 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrder) + return unmarshal_json_response(models.CustomerOrder, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def generate_invoice( self, @@ -934,39 +869,28 @@ def generate_invoice( response_data: Any = None if utils.match_response(http_res, "202", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "409", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.InvoiceAlreadyExistsData + response_data = unmarshal_json_response( + models.InvoiceAlreadyExistsData, http_res ) - raise models.InvoiceAlreadyExists(data=response_data) + raise models.InvoiceAlreadyExists(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, + response_data = unmarshal_json_response( models.CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoiceUnion, + http_res, ) raise models.CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoice( - data=response_data + response_data, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def generate_invoice_async( self, @@ -1049,39 +973,28 @@ async def generate_invoice_async( response_data: Any = None if utils.match_response(http_res, "202", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "409", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.InvoiceAlreadyExistsData + response_data = unmarshal_json_response( + models.InvoiceAlreadyExistsData, http_res ) - raise models.InvoiceAlreadyExists(data=response_data) + raise models.InvoiceAlreadyExists(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, + response_data = unmarshal_json_response( models.CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoiceUnion, + http_res, ) raise models.CustomerPortalOrdersGenerateInvoiceResponse422CustomerPortalOrdersGenerateInvoice( - data=response_data + response_data, http_res ) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def invoice( self, @@ -1164,36 +1077,25 @@ def invoice( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrderInvoice) + return unmarshal_json_response(models.CustomerOrderInvoice, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def invoice_async( self, @@ -1276,33 +1178,22 @@ async def invoice_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrderInvoice) + return unmarshal_json_response(models.CustomerOrderInvoice, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/polar_organizations.py b/src/polar_sdk/polar_organizations.py index 340b893f..7026dbcb 100644 --- a/src/polar_sdk/polar_organizations.py +++ b/src/polar_sdk/polar_organizations.py @@ -4,6 +4,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Mapping, Optional @@ -80,36 +81,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrganization) + return unmarshal_json_response(models.CustomerOrganization, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -183,33 +173,22 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerOrganization) + return unmarshal_json_response(models.CustomerOrganization, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/polar_subscriptions.py b/src/polar_sdk/polar_subscriptions.py index 4a1a6e3b..8604b28c 100644 --- a/src/polar_sdk/polar_subscriptions.py +++ b/src/polar_sdk/polar_subscriptions.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -151,35 +152,24 @@ def next_func() -> Optional[models.CustomerPortalSubscriptionsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalSubscriptionsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerSubscription + result=unmarshal_json_response( + models.ListResourceCustomerSubscription, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -323,35 +313,24 @@ def next_func() -> Optional[models.CustomerPortalSubscriptionsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.CustomerPortalSubscriptionsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceCustomerSubscription + result=unmarshal_json_response( + models.ListResourceCustomerSubscription, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -434,36 +413,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSubscription) + return unmarshal_json_response(models.CustomerSubscription, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -546,36 +514,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSubscription) + return unmarshal_json_response(models.CustomerSubscription, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -673,41 +630,30 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSubscription) + return unmarshal_json_response(models.CustomerSubscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -805,41 +751,30 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSubscription) + return unmarshal_json_response(models.CustomerSubscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def cancel( self, @@ -922,41 +857,30 @@ def cancel( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSubscription) + return unmarshal_json_response(models.CustomerSubscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def cancel_async( self, @@ -1039,38 +963,27 @@ async def cancel_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.CustomerSubscription) + return unmarshal_json_response(models.CustomerSubscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/products.py b/src/polar_sdk/products.py index 56ff4299..5b63cd73 100644 --- a/src/polar_sdk/products.py +++ b/src/polar_sdk/products.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -160,33 +161,22 @@ def next_func() -> Optional[models.ProductsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ProductsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceProduct), + result=unmarshal_json_response(models.ListResourceProduct, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -339,33 +329,22 @@ def next_func() -> Optional[models.ProductsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.ProductsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceProduct), + result=unmarshal_json_response(models.ListResourceProduct, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -444,31 +423,20 @@ def create( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -547,31 +515,20 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -647,36 +604,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -752,36 +698,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -865,39 +800,28 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -981,39 +905,28 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update_benefits( self, @@ -1103,39 +1016,28 @@ def update_benefits( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_benefits_async( self, @@ -1225,36 +1127,25 @@ async def update_benefits_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Product) + return unmarshal_json_response(models.Product, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json(http_res.text, models.NotPermittedData) - raise models.NotPermitted(data=response_data) + response_data = unmarshal_json_response(models.NotPermittedData, http_res) + raise models.NotPermitted(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/refunds.py b/src/polar_sdk/refunds.py index b334f94f..081994ac 100644 --- a/src/polar_sdk/refunds.py +++ b/src/polar_sdk/refunds.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast @@ -155,33 +156,22 @@ def next_func() -> Optional[models.RefundsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.RefundsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceRefund), + result=unmarshal_json_response(models.ListResourceRefund, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -329,33 +319,22 @@ def next_func() -> Optional[models.RefundsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.RefundsListResponse( - result=utils.unmarshal_json(http_res.text, models.ListResourceRefund), + result=unmarshal_json_response(models.ListResourceRefund, http_res), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create( self, @@ -434,43 +413,32 @@ def create( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Refund) + return unmarshal_json_response(models.Refund, http_res) if utils.match_response(http_res, "201", "*"): return None if utils.match_response(http_res, "400", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.RefundAmountTooHighData + response_data = unmarshal_json_response( + models.RefundAmountTooHighData, http_res ) - raise models.RefundAmountTooHigh(data=response_data) + raise models.RefundAmountTooHigh(response_data, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.RefundedAlreadyData + response_data = unmarshal_json_response( + models.RefundedAlreadyData, http_res ) - raise models.RefundedAlready(data=response_data) + raise models.RefundedAlready(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_async( self, @@ -549,40 +517,29 @@ async def create_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Refund) + return unmarshal_json_response(models.Refund, http_res) if utils.match_response(http_res, "201", "*"): return None if utils.match_response(http_res, "400", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.RefundAmountTooHighData + response_data = unmarshal_json_response( + models.RefundAmountTooHighData, http_res ) - raise models.RefundAmountTooHigh(data=response_data) + raise models.RefundAmountTooHigh(response_data, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.RefundedAlreadyData + response_data = unmarshal_json_response( + models.RefundedAlreadyData, http_res ) - raise models.RefundedAlready(data=response_data) + raise models.RefundedAlready(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/subscriptions.py b/src/polar_sdk/subscriptions.py index 859f761e..bf9b02e7 100644 --- a/src/polar_sdk/subscriptions.py +++ b/src/polar_sdk/subscriptions.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union @@ -21,6 +22,12 @@ def list( customer_id: OptionalNullable[ Union[models.CustomerIDFilter, models.CustomerIDFilterTypedDict] ] = UNSET, + external_customer_id: OptionalNullable[ + Union[ + models.ExternalCustomerIDFilter, + models.ExternalCustomerIDFilterTypedDict, + ] + ] = UNSET, discount_id: OptionalNullable[ Union[models.DiscountIDFilter, models.DiscountIDFilterTypedDict] ] = UNSET, @@ -48,6 +55,7 @@ def list( :param organization_id: Filter by organization ID. :param product_id: Filter by product ID. :param customer_id: Filter by customer ID. + :param external_customer_id: Filter by customer external ID. :param discount_id: Filter by discount ID. :param active: Filter by active or inactive subscription. :param page: Page number, defaults to 1. @@ -73,6 +81,7 @@ def list( organization_id=organization_id, product_id=product_id, customer_id=customer_id, + external_customer_id=external_customer_id, discount_id=discount_id, active=active, page=page, @@ -140,6 +149,7 @@ def next_func() -> Optional[models.SubscriptionsListResponse]: organization_id=organization_id, product_id=product_id, customer_id=customer_id, + external_customer_id=external_customer_id, discount_id=discount_id, active=active, page=next_page, @@ -152,35 +162,24 @@ def next_func() -> Optional[models.SubscriptionsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.SubscriptionsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceSubscription + result=unmarshal_json_response( + models.ListResourceSubscription, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_async( self, @@ -194,6 +193,12 @@ async def list_async( customer_id: OptionalNullable[ Union[models.CustomerIDFilter, models.CustomerIDFilterTypedDict] ] = UNSET, + external_customer_id: OptionalNullable[ + Union[ + models.ExternalCustomerIDFilter, + models.ExternalCustomerIDFilterTypedDict, + ] + ] = UNSET, discount_id: OptionalNullable[ Union[models.DiscountIDFilter, models.DiscountIDFilterTypedDict] ] = UNSET, @@ -221,6 +226,7 @@ async def list_async( :param organization_id: Filter by organization ID. :param product_id: Filter by product ID. :param customer_id: Filter by customer ID. + :param external_customer_id: Filter by customer external ID. :param discount_id: Filter by discount ID. :param active: Filter by active or inactive subscription. :param page: Page number, defaults to 1. @@ -246,6 +252,7 @@ async def list_async( organization_id=organization_id, product_id=product_id, customer_id=customer_id, + external_customer_id=external_customer_id, discount_id=discount_id, active=active, page=page, @@ -313,6 +320,7 @@ def next_func() -> Optional[models.SubscriptionsListResponse]: organization_id=organization_id, product_id=product_id, customer_id=customer_id, + external_customer_id=external_customer_id, discount_id=discount_id, active=active, page=next_page, @@ -325,35 +333,24 @@ def next_func() -> Optional[models.SubscriptionsListResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.SubscriptionsListResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceSubscription + result=unmarshal_json_response( + models.ListResourceSubscription, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def export( self, @@ -431,31 +428,20 @@ def export( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def export_async( self, @@ -533,31 +519,20 @@ async def export_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get( self, @@ -633,36 +608,25 @@ def get( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Subscription) + return unmarshal_json_response(models.Subscription, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_async( self, @@ -738,36 +702,25 @@ async def get_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Subscription) + return unmarshal_json_response(models.Subscription, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update( self, @@ -857,41 +810,30 @@ def update( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Subscription) + return unmarshal_json_response(models.Subscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_async( self, @@ -981,41 +923,30 @@ async def update_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Subscription) + return unmarshal_json_response(models.Subscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def revoke( self, @@ -1091,41 +1022,30 @@ def revoke( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Subscription) + return unmarshal_json_response(models.Subscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def revoke_async( self, @@ -1201,38 +1121,27 @@ async def revoke_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.Subscription) + return unmarshal_json_response(models.Subscription, http_res) if utils.match_response(http_res, "403", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.AlreadyCanceledSubscriptionData + response_data = unmarshal_json_response( + models.AlreadyCanceledSubscriptionData, http_res ) - raise models.AlreadyCanceledSubscription(data=response_data) + raise models.AlreadyCanceledSubscription(response_data, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) diff --git a/src/polar_sdk/utils/serializers.py b/src/polar_sdk/utils/serializers.py index 76e44d71..378a14c0 100644 --- a/src/polar_sdk/utils/serializers.py +++ b/src/polar_sdk/utils/serializers.py @@ -192,7 +192,9 @@ def is_union(obj: object) -> bool: """ Returns True if the given object is a typing.Union or typing_extensions.Union. """ - return any(obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union")) + return any( + obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union") + ) def stream_to_text(stream: httpx.Response) -> str: @@ -245,4 +247,3 @@ def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]: f"Neither typing nor typing_extensions has an object called {name!r}" ) return result - diff --git a/src/polar_sdk/utils/unmarshal_json_response.py b/src/polar_sdk/utils/unmarshal_json_response.py new file mode 100644 index 00000000..fb0bff23 --- /dev/null +++ b/src/polar_sdk/utils/unmarshal_json_response.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from typing import Any, Optional + +import httpx + +from .serializers import unmarshal_json +from polar_sdk import models + + +def unmarshal_json_response( + typ: Any, http_res: httpx.Response, body: Optional[str] = None +) -> Any: + if body is None: + body = http_res.text + try: + return unmarshal_json(body, typ) + except Exception as e: + raise models.ResponseValidationError( + "Response validation failed", + http_res, + e, + body, + ) from e diff --git a/src/polar_sdk/webhooks.py b/src/polar_sdk/webhooks.py index 55208887..907efda4 100644 --- a/src/polar_sdk/webhooks.py +++ b/src/polar_sdk/webhooks.py @@ -5,6 +5,7 @@ from polar_sdk import models, utils from polar_sdk._hooks import HookContext from polar_sdk.types import BaseModel, OptionalNullable, UNSET +from polar_sdk.utils.unmarshal_json_response import unmarshal_json_response from typing import Any, Dict, List, Mapping, Optional, Union, cast # region imports @@ -124,35 +125,24 @@ def next_func() -> Optional[models.WebhooksListWebhookEndpointsResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.WebhooksListWebhookEndpointsResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceWebhookEndpoint + result=unmarshal_json_response( + models.ListResourceWebhookEndpoint, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_webhook_endpoints_async( self, @@ -265,35 +255,24 @@ def next_func() -> Optional[models.WebhooksListWebhookEndpointsResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.WebhooksListWebhookEndpointsResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceWebhookEndpoint + result=unmarshal_json_response( + models.ListResourceWebhookEndpoint, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def create_webhook_endpoint( self, @@ -374,31 +353,20 @@ def create_webhook_endpoint( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.WebhookEndpoint) + return unmarshal_json_response(models.WebhookEndpoint, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def create_webhook_endpoint_async( self, @@ -479,31 +447,20 @@ async def create_webhook_endpoint_async( response_data: Any = None if utils.match_response(http_res, "201", "application/json"): - return utils.unmarshal_json(http_res.text, models.WebhookEndpoint) + return unmarshal_json_response(models.WebhookEndpoint, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def get_webhook_endpoint( self, @@ -579,36 +536,25 @@ def get_webhook_endpoint( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.WebhookEndpoint) + return unmarshal_json_response(models.WebhookEndpoint, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def get_webhook_endpoint_async( self, @@ -684,36 +630,25 @@ async def get_webhook_endpoint_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.WebhookEndpoint) + return unmarshal_json_response(models.WebhookEndpoint, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def update_webhook_endpoint( self, @@ -803,36 +738,25 @@ def update_webhook_endpoint( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.WebhookEndpoint) + return unmarshal_json_response(models.WebhookEndpoint, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def update_webhook_endpoint_async( self, @@ -922,36 +846,25 @@ async def update_webhook_endpoint_async( response_data: Any = None if utils.match_response(http_res, "200", "application/json"): - return utils.unmarshal_json(http_res.text, models.WebhookEndpoint) + return unmarshal_json_response(models.WebhookEndpoint, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def delete_webhook_endpoint( self, @@ -1029,34 +942,23 @@ def delete_webhook_endpoint( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def delete_webhook_endpoint_async( self, @@ -1134,34 +1036,23 @@ async def delete_webhook_endpoint_async( if utils.match_response(http_res, "204", "*"): return if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def list_webhook_deliveries( self, @@ -1273,35 +1164,24 @@ def next_func() -> Optional[models.WebhooksListWebhookDeliveriesResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.WebhooksListWebhookDeliveriesResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceWebhookDelivery + result=unmarshal_json_response( + models.ListResourceWebhookDelivery, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def list_webhook_deliveries_async( self, @@ -1413,35 +1293,24 @@ def next_func() -> Optional[models.WebhooksListWebhookDeliveriesResponse]: response_data: Any = None if utils.match_response(http_res, "200", "application/json"): return models.WebhooksListWebhookDeliveriesResponse( - result=utils.unmarshal_json( - http_res.text, models.ListResourceWebhookDelivery + result=unmarshal_json_response( + models.ListResourceWebhookDelivery, http_res ), next=next_func, ) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) def redeliver_webhook_event( self, @@ -1517,36 +1386,25 @@ def redeliver_webhook_event( response_data: Any = None if utils.match_response(http_res, "202", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = utils.stream_to_text(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res) async def redeliver_webhook_event_async( self, @@ -1622,33 +1480,22 @@ async def redeliver_webhook_event_async( response_data: Any = None if utils.match_response(http_res, "202", "application/json"): - return utils.unmarshal_json(http_res.text, Any) + return unmarshal_json_response(Any, http_res) if utils.match_response(http_res, "404", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.ResourceNotFoundData + response_data = unmarshal_json_response( + models.ResourceNotFoundData, http_res ) - raise models.ResourceNotFound(data=response_data) + raise models.ResourceNotFound(response_data, http_res) if utils.match_response(http_res, "422", "application/json"): - response_data = utils.unmarshal_json( - http_res.text, models.HTTPValidationErrorData + response_data = unmarshal_json_response( + models.HTTPValidationErrorData, http_res ) - raise models.HTTPValidationError(data=response_data) + raise models.HTTPValidationError(response_data, http_res) if utils.match_response(http_res, "4XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) if utils.match_response(http_res, "5XX", "*"): http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - "API error occurred", http_res.status_code, http_res_text, http_res - ) + raise models.SDKError("API error occurred", http_res, http_res_text) - content_type = http_res.headers.get("Content-Type") - http_res_text = await utils.stream_to_text_async(http_res) - raise models.SDKError( - f"Unexpected response received (code: {http_res.status_code}, type: {content_type})", - http_res.status_code, - http_res_text, - http_res, - ) + raise models.SDKError("Unexpected response received", http_res)