diff --git a/apps/docs/api-reference-generator/customers/getOrCreate.mdx b/apps/docs/api-reference-generator/customers/getOrCreateCustomer.mdx similarity index 100% rename from apps/docs/api-reference-generator/customers/getOrCreate.mdx rename to apps/docs/api-reference-generator/customers/getOrCreateCustomer.mdx diff --git a/apps/docs/mintlify/api-reference/billing/attach.mdx b/apps/docs/mintlify/api-reference/billing/attach.mdx index ad8a1238f..77253549c 100644 --- a/apps/docs/mintlify/api-reference/billing/attach.mdx +++ b/apps/docs/mintlify/api-reference/billing/attach.mdx @@ -3,10 +3,26 @@ title: "Attach" openapi: "openapi POST /v1/attach" --- -import { DynamicParamField } from "/snippets/dynamic-param-field.jsx"; -import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; -## Body Parameters +### Body Parameters + + + + + + + The feature ID that this entity is associated with + + + + Name of the entity + + + + @@ -34,25 +50,44 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; - + + The type of the product item. + - + + The feature ID of the product item. Should be null for fixed price items. + - + + The amount of usage included for this feature (per interval). + - + + The reset or billing interval of the product item. If null, feature will have no reset date, and if there's a price, it will be billed one-off. + - + + Interval count of the feature. + - + + The feature ID of the entity (like seats) to track sub-balances for. + - + + Whether the feature should be prepaid upfront or billed for how much they use end of billing period. + - + + The price of the product item. Should be null if tiered pricing is set. + + Tiered pricing for the product item. Not applicable for fixed price items. - + + The maximum amount of usage for this tier. + The price of the product item for this tier. @@ -61,9 +96,13 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; - + + The billing units of the product item (eg $1 for 30 credits). + - + + Whether the usage should be reset when the product is enabled. + @@ -89,10 +128,12 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; -## Response +### Response + + diff --git a/apps/docs/mintlify/api-reference/customers/delete-customer.mdx b/apps/docs/mintlify/api-reference/customers/delete-customer.mdx deleted file mode 100644 index c574fbbd5..000000000 --- a/apps/docs/mintlify/api-reference/customers/delete-customer.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Delete Customer" -openapi: "openapi-1.2.0 DELETE /customers/{customer_id}" ---- diff --git a/apps/docs/mintlify/api-reference/customers/deleteCustomer.mdx b/apps/docs/mintlify/api-reference/customers/deleteCustomer.mdx new file mode 100644 index 000000000..b3eb84faf --- /dev/null +++ b/apps/docs/mintlify/api-reference/customers/deleteCustomer.mdx @@ -0,0 +1,23 @@ +--- +title: "Delete Customer" +openapi: "openapi POST /v1/customers.delete" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + ID of the customer to delete + + + + Whether to also delete the customer in Stripe + + + +### Response + + diff --git a/apps/docs/mintlify/api-reference/customers/get-customer.mdx b/apps/docs/mintlify/api-reference/customers/get-customer.mdx deleted file mode 100644 index 8951848b9..000000000 --- a/apps/docs/mintlify/api-reference/customers/get-customer.mdx +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: "Get Customer" -openapi: "openapi-1.2.0 GET /customers/{customer_id}" ---- - - - To get additional data in the customer object, you can use the `expand` parameter to fetch data like invoices, entities, rewards, and more. - diff --git a/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx new file mode 100644 index 000000000..fdb83fc9f --- /dev/null +++ b/apps/docs/mintlify/api-reference/customers/getOrCreateCustomer.mdx @@ -0,0 +1,710 @@ +--- +title: "Get or Create Customer" +openapi: "openapi POST /v1/customers.getOrCreate" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + + + If the customer already exists and you try to create it again, you will simply be returned the customer object (rather than an error being thrown). + + +### Body Parameters + + + Your unique identifier for the customer + + + + Customer's name + + + + Customer's email address + + + + Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + + + + Additional metadata for the customer + + + + Stripe customer ID if you already have one + + + + Whether to create the customer in Stripe + + + + The ID of the free plan to auto-enable for the customer + + + + Whether to send email receipts to this customer + + + + Customer expand options + + + +### Response + + + Your unique identifier for the customer. + + + + The name of the customer. + + + + The email address of the customer. + + + + Timestamp of customer creation in milliseconds since epoch. + + + + A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + + + + Stripe customer ID. + + + + The environment this customer was created in. + + + + The metadata for the customer. + + + + Whether to send email receipts to the customer. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Array of plan IDs included in this invoice + + + + The Stripe invoice ID + + + + The status of the invoice + + + + The total amount of the invoice + + + + The currency code for the invoice + + + + Timestamp when the invoice was created + + + + URL to the Stripe-hosted invoice page + + + + + + + + + + + The unique identifier of the entity + + + + The name of the entity + + + + The customer ID this entity belongs to + + + + The feature ID this entity belongs to + + + + Unix timestamp when the entity was created + + + + The environment (sandbox/live) + + + + + + + + + + + + + + + + + + + + Array of active discounts applied to the customer + + + The unique identifier for this discount + + + + The name of the discount or coupon + + + + The type of reward + + + + The discount value (percentage or fixed amount) + + + + How long the discount lasts + + + + Number of billing periods the discount applies for repeating durations + + + + The currency code for fixed amount discounts + + + + Timestamp when the discount becomes active + + + + Timestamp when the discount expires + + + + The Stripe subscription ID this discount is applied to + + + + Total amount saved from this discount + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +```json 200 +{ + "id": "cus_123", + "created_at": 1717000000, + "name": "John Doe", + "email": "john@example.com", + "fingerprint": "1234567890", + "stripe_id": "cus_123", + "env": "sandbox", + "metadata": {}, + "subscriptions": [ + { + "id": "sub_123", + "created_at": 1717000000, + "plan_id": "plan_123", + "status": "active", + "quantity": 1, + "interval": "month", + "interval_count": 1 + } + ], + "purchases": [], + "balances": { + "balance_1": { + "id": "balance_1", + "amount": 100, + "currency": "USD", + "created_at": 1717000000, + "updated_at": 1717000000 + } + } +} +``` + diff --git a/apps/docs/mintlify/api-reference/customers/list-customers.mdx b/apps/docs/mintlify/api-reference/customers/list-customers.mdx deleted file mode 100644 index 5d8c8f217..000000000 --- a/apps/docs/mintlify/api-reference/customers/list-customers.mdx +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "List Customers" -openapi: "openapi-1.2.0 GET /customers" ---- - - diff --git a/apps/docs/mintlify/api-reference/customers/listCustomers.mdx b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx new file mode 100644 index 000000000..4602764cd --- /dev/null +++ b/apps/docs/mintlify/api-reference/customers/listCustomers.mdx @@ -0,0 +1,523 @@ +--- +title: "List Customers" +openapi: "openapi POST /v1/customers.list" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + Number of items to skip + + + + Number of items to return. Default 10, max 1000. + + + + Filter by plan ID and version. Returns customers with active subscriptions to this plan. + + + + + + + + + + Filter by customer product status. Defaults to active and scheduled + + + + Search customers by id, name, or email + + + +### Response + + + Array of items for current page + + + Your unique identifier for the customer. + + + + The name of the customer. + + + + The email address of the customer. + + + + Timestamp of customer creation in milliseconds since epoch. + + + + A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + + + + Stripe customer ID. + + + + The environment this customer was created in. + + + + The metadata for the customer. + + + + Whether to send email receipts to the customer. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Whether more results exist after this page + + + + Current offset position + + + + Limit passed in the request + + + + Total number of items returned in the current page + diff --git a/apps/docs/mintlify/api-reference/customers/update-customer.mdx b/apps/docs/mintlify/api-reference/customers/update-customer.mdx deleted file mode 100644 index bc28003ea..000000000 --- a/apps/docs/mintlify/api-reference/customers/update-customer.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Update Customer" -openapi: "openapi-1.2.0 POST /customers/{customer_id}" ---- diff --git a/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx new file mode 100644 index 000000000..e4125b295 --- /dev/null +++ b/apps/docs/mintlify/api-reference/customers/updateCustomer.mdx @@ -0,0 +1,507 @@ +--- +title: "Update Customer" +openapi: "openapi POST /v1/customers.update" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + ID of the customer to update + + + + Customer's name + + + + Customer's email address + + + + Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + + + + Additional metadata for the customer + + + + Stripe customer ID if you already have one + + + + Whether to send email receipts to this customer + + + + New ID for the customer + + + +### Response + + + Your unique identifier for the customer. + + + + The name of the customer. + + + + The email address of the customer. + + + + Timestamp of customer creation in milliseconds since epoch. + + + + A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + + + + Stripe customer ID. + + + + The environment this customer was created in. + + + + The metadata for the customer. + + + + Whether to send email receipts to the customer. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/docs/mintlify/api-reference/plans/list.mdx b/apps/docs/mintlify/api-reference/plans/list.mdx index e7cd90b0e..ded0969be 100644 --- a/apps/docs/mintlify/api-reference/plans/list.mdx +++ b/apps/docs/mintlify/api-reference/plans/list.mdx @@ -3,14 +3,17 @@ title: "List Plans" openapi: "openapi GET /v1/products" --- -import { DynamicParamField } from "/snippets/dynamic-param-field.jsx"; -import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; -## Response +### Response + + @@ -27,10 +30,19 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; - + + + + + + + + + + @@ -38,13 +50,62 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + - + @@ -64,7 +125,7 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; - + @@ -77,6 +138,15 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; + + + + + + + + + @@ -111,6 +181,8 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; + + @@ -121,7 +193,7 @@ import { DynamicResponseField } from "/snippets/dynamic-response-field.jsx"; - + diff --git a/apps/docs/mintlify/api/api-reference/billing/attach.mdx b/apps/docs/mintlify/api/api-reference/billing/attach.mdx index b1dc066ca..f7ac9d97d 100644 --- a/apps/docs/mintlify/api/api-reference/billing/attach.mdx +++ b/apps/docs/mintlify/api/api-reference/billing/attach.mdx @@ -9,6 +9,21 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ### Body Parameters + + + + + + The feature ID that this entity is associated with + + + + Name of the entity + + + + + @@ -117,6 +132,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + diff --git a/apps/docs/mintlify/api/api-reference/customers/deleteCustomer.mdx b/apps/docs/mintlify/api/api-reference/customers/deleteCustomer.mdx new file mode 100644 index 000000000..b3eb84faf --- /dev/null +++ b/apps/docs/mintlify/api/api-reference/customers/deleteCustomer.mdx @@ -0,0 +1,23 @@ +--- +title: "Delete Customer" +openapi: "openapi POST /v1/customers.delete" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + ID of the customer to delete + + + + Whether to also delete the customer in Stripe + + + +### Response + + diff --git a/apps/docs/mintlify/api-reference/customers/getOrCreate.mdx b/apps/docs/mintlify/api/api-reference/customers/getOrCreateCustomer.mdx similarity index 71% rename from apps/docs/mintlify/api-reference/customers/getOrCreate.mdx rename to apps/docs/mintlify/api/api-reference/customers/getOrCreateCustomer.mdx index 0c6253dbb..5d43e0ebb 100644 --- a/apps/docs/mintlify/api-reference/customers/getOrCreate.mdx +++ b/apps/docs/mintlify/api/api-reference/customers/getOrCreateCustomer.mdx @@ -1,5 +1,5 @@ --- -title: "Get or Create Customer" +title: "Get Or Create Customer" openapi: "openapi POST /v1/customers.getOrCreate" --- @@ -7,10 +7,6 @@ import { DynamicParamField } from "/components/dynamic-param-field.jsx"; import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; - - If the customer already exists and you try to create it again, you will simply be returned the customer object (rather than an error being thrown). - - ### Body Parameters @@ -56,6 +52,12 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx ### Response + + + + Your unique identifier for the customer. + + The name of the customer. @@ -64,6 +66,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The email address of the customer. + + Timestamp of customer creation in milliseconds since epoch. + + A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. @@ -88,6 +94,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + @@ -108,6 +116,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + + + + + + @@ -115,6 +132,55 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + @@ -154,6 +220,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + + + + + + @@ -188,6 +263,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + @@ -237,6 +314,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + @@ -257,6 +336,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + + + + + + @@ -264,6 +352,55 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + @@ -303,6 +440,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + + + + + + @@ -337,6 +483,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + @@ -390,6 +538,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The currency code for the invoice + + Timestamp when the invoice was created + + URL to the Stripe-hosted invoice page @@ -399,6 +551,12 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + The unique identifier of the entity + + The name of the entity @@ -411,6 +569,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx The feature ID this entity belongs to + + Unix timestamp when the entity was created + + The environment (sandbox/live) @@ -434,6 +596,10 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx Array of active discounts applied to the customer + + The unique identifier for this discount + + The name of the discount or coupon @@ -486,6 +652,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + @@ -495,6 +663,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + diff --git a/apps/docs/mintlify/api/api-reference/customers/listCustomers.mdx b/apps/docs/mintlify/api/api-reference/customers/listCustomers.mdx new file mode 100644 index 000000000..291017293 --- /dev/null +++ b/apps/docs/mintlify/api/api-reference/customers/listCustomers.mdx @@ -0,0 +1,99 @@ +--- +title: "List Customers" +openapi: "openapi POST /v1/customers.list" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + Number of items to skip + + + + Number of items to return. Default 10, max 1000. + + + + Filter by plan ID and version. Returns customers with active subscriptions to this plan. + + + + + + + + + + Filter by customer product status. Defaults to active and scheduled + + + + Search customers by id, name, or email + + + +### Response + + + Array of items for current page + + + + + Your unique identifier for the customer. + + + + The name of the customer. + + + + The email address of the customer. + + + + Timestamp of customer creation in milliseconds since epoch. + + + + A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + + + + Stripe customer ID. + + + + The environment this customer was created in. + + + + The metadata for the customer. + + + + Whether to send email receipts to the customer. + + + + + + + Whether more results exist after this page + + + + Current offset position + + + + Limit passed in the request + + + + Total number of items returned in the current page + diff --git a/apps/docs/mintlify/api/api-reference/customers/updateCustomer.mdx b/apps/docs/mintlify/api/api-reference/customers/updateCustomer.mdx new file mode 100644 index 000000000..4c40ee783 --- /dev/null +++ b/apps/docs/mintlify/api/api-reference/customers/updateCustomer.mdx @@ -0,0 +1,712 @@ +--- +title: "Update Customer" +openapi: "openapi POST /v1/customers.update" +--- + +import { DynamicParamField } from "/components/dynamic-param-field.jsx"; +import { DynamicResponseField } from "/components/dynamic-response-field.jsx"; +import { DynamicResponseExample } from "/components/dynamic-response-example.jsx"; + +### Body Parameters + + + ID of the customer to update + + + + New ID for the customer + + + + Customer expand options + + + + Customer's name + + + + Customer's email address + + + + Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + + + + Additional metadata for the customer + + + + Stripe customer ID if you already have one + + + + Whether to create the customer in Stripe + + + + The ID of the free plan to auto-enable for the customer + + + + Whether to send email receipts to this customer + + + +### Response + + + + + Your unique identifier for the customer. + + + + The name of the customer. + + + + The email address of the customer. + + + + Timestamp of customer creation in milliseconds since epoch. + + + + A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + + + + Stripe customer ID. + + + + The environment this customer was created in. + + + + The metadata for the customer. + + + + Whether to send email receipts to the customer. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Array of plan IDs included in this invoice + + + + The Stripe invoice ID + + + + The status of the invoice + + + + The total amount of the invoice + + + + The currency code for the invoice + + + + Timestamp when the invoice was created + + + + URL to the Stripe-hosted invoice page + + + + + + + + + + + The unique identifier of the entity + + + + The name of the entity + + + + The customer ID this entity belongs to + + + + The feature ID this entity belongs to + + + + Unix timestamp when the entity was created + + + + The environment (sandbox/live) + + + + + + + + + + + + + + + + + + + + Array of active discounts applied to the customer + + + The unique identifier for this discount + + + + The name of the discount or coupon + + + + The type of reward + + + + The discount value (percentage or fixed amount) + + + + How long the discount lasts + + + + Number of billing periods the discount applies for repeating durations + + + + The currency code for fixed amount discounts + + + + Timestamp when the discount becomes active + + + + Timestamp when the discount expires + + + + The Stripe subscription ID this discount is applied to + + + + Total amount saved from this discount + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +```json 200 +{ + "id": "cus_123", + "created_at": 1717000000, + "name": "John Doe", + "email": "john@example.com", + "fingerprint": "1234567890", + "stripe_id": "cus_123", + "env": "sandbox", + "metadata": {}, + "subscriptions": [ + { + "id": "sub_123", + "created_at": 1717000000, + "plan_id": "plan_123", + "status": "active", + "quantity": 1, + "interval": "month", + "interval_count": 1 + } + ], + "purchases": [], + "balances": { + "balance_1": { + "id": "balance_1", + "amount": 100, + "currency": "USD", + "created_at": 1717000000, + "updated_at": 1717000000 + } + } +} +``` + diff --git a/apps/docs/mintlify/api/api-reference/plans/list.mdx b/apps/docs/mintlify/api/api-reference/plans/list.mdx index bf12c32f7..2a80d4604 100644 --- a/apps/docs/mintlify/api/api-reference/plans/list.mdx +++ b/apps/docs/mintlify/api/api-reference/plans/list.mdx @@ -12,6 +12,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + @@ -32,6 +34,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + + + + + + @@ -39,6 +50,55 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + The ID of the feature, used to refer to it in other API calls like /track or /check. + + + + The name of the feature. + + + + The type of the feature + + + + Singular and plural display names for the feature. + + + The singular display name for the feature. + + + + The plural display name for the feature. + + + + + + + Credit cost schema for credit system features. + + + The ID of the metered feature (should be a single_use feature). + + + + The credit cost of the metered feature. + + + + + + + Whether or not the feature is archived. + + + + + @@ -78,6 +138,15 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + + + + + + + + @@ -112,6 +181,8 @@ import { DynamicResponseExample } from "/components/dynamic-response-example.jsx + + diff --git a/apps/docs/mintlify/api/openapi.yml b/apps/docs/mintlify/api/openapi.yml index b2fb933fb..9b4e6c829 100644 --- a/apps/docs/mintlify/api/openapi.yml +++ b/apps/docs/mintlify/api/openapi.yml @@ -26,6 +26,11 @@ components: Customer: type: object properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. name: anyOf: - type: string @@ -36,6 +41,9 @@ components: - type: string - type: "null" description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. fingerprint: anyOf: - type: string @@ -148,6 +156,55 @@ components: properties: feature_id: type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived granted: type: number remaining: @@ -172,6 +229,9 @@ components: items: type: object properties: + id: + type: string + default: "" plan_id: anyOf: - type: string @@ -305,6 +365,9 @@ components: currency: type: string description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created hosted_invoice_url: anyOf: - type: string @@ -316,11 +379,19 @@ components: - status - total - currency + - created_at entities: type: array items: type: object properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity name: anyOf: - type: string @@ -336,13 +407,18 @@ components: - type: string - type: "null" description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created env: enum: - sandbox - live description: The environment (sandbox/live) required: + - id - name + - created_at - env trials_used: type: array @@ -369,6 +445,9 @@ components: items: type: object properties: + id: + type: string + description: The unique identifier for this discount name: type: string description: The name of the discount or coupon @@ -420,6 +499,7 @@ components: - type: "null" description: Total amount saved from this discount required: + - id - name - type - discount_value @@ -438,6 +518,8 @@ components: customer: type: object properties: + id: + type: string name: anyOf: - type: string @@ -446,20 +528,26 @@ components: anyOf: - type: string - type: "null" - required: [] + required: + - id reward_applied: type: boolean + created_at: + type: number required: - program_id - customer - reward_applied + - created_at payment_method: anyOf: - {} - type: "null" required: + - id - name - email + - created_at - fingerprint - stripe_id - env @@ -497,6 +585,8 @@ components: Plan: type: object properties: + id: + type: string name: type: string description: @@ -529,6 +619,15 @@ components: - year interval_count: type: number + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text required: - amount - interval @@ -540,6 +639,66 @@ components: properties: feature_id: type: string + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type included: type: number unlimited: @@ -610,6 +769,15 @@ components: - billing_method - max_purchase - type: "null" + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text rollover: type: object properties: @@ -664,6 +832,8 @@ components: - duration_length - duration_type - card_required + created_at: + type: number env: enum: - sandbox @@ -693,6 +863,7 @@ components: required: - scenario required: + - id - name - description - group @@ -701,6 +872,7 @@ components: - auto_enable - price - items + - created_at - env - archived - base_variant_id @@ -712,14 +884,9 @@ components: paths: /v1/customers.getOrCreate: post: - operationId: getOrCreate - description: >- - Creates a customer if they do not exist, or returns the existing + operationId: getOrCreateCustomer + description: Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - - - Use this as the primary entrypoint before billing operations so the - customer record is always present and up to date. tags: - customers requestBody: @@ -794,6 +961,7 @@ paths: schema: $ref: "#/components/schemas/Customer" example: *a2 + x-speakeasy-name-override: getOrCreate parameters: - name: x-api-version in: header @@ -822,11 +990,959 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.customers.get_or_create( + res = autumn.customers.get_or_create( customer_id="cus_123", name="John Doe", email="john@example.com", ) + /v1/customers.list: + post: + operationId: listCustomers + description: Lists customers with pagination and optional filters. + tags: + - customers + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 10 + description: Number of items to return. Default 10, max 1000. + plans: + type: array + items: + type: object + properties: + id: + type: string + versions: + type: array + items: + type: number + required: + - id + description: Filter by plan ID and version. Returns customers with active + subscriptions to this plan. + subscription_status: + enum: + - active + - scheduled + description: Filter by customer product status. Defaults to active and scheduled + search: + type: string + description: Search customers by id, name, or email + title: ListCustomersParams + examples: + - &a3 + limit: 10 + offset: 0 + example: *a3 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. + name: + anyOf: + - type: string + - type: "null" + description: The name of the customer. + email: + anyOf: + - type: string + - type: "null" + description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. + fingerprint: + anyOf: + - type: string + - type: "null" + description: "A unique identifier (eg. serial number) to de-duplicate customers + across devices or browsers. For example: apple + device ID." + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID. + env: + enum: + - sandbox + - live + description: The environment this customer was created in. + metadata: + type: object + propertyNames: {} + additionalProperties: {} + description: The metadata for the customer. + send_email_receipts: + type: boolean + description: Whether to send email receipts to the customer. + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - {} + - {} + amount: + type: number + required: + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + x-speakeasy-name-override: list + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.customers.list({}); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.customers.list(request={}) + /v1/customers.update: + post: + operationId: updateCustomer + description: Updates an existing customer by ID. + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + title: CustomerId + description: ID of the customer to update + name: + anyOf: + - type: string + - type: "null" + description: Customer's name + email: + anyOf: + - type: string + format: email + - type: "null" + description: Customer's email address + fingerprint: + anyOf: + - type: string + - type: "null" + description: Unique identifier (eg, serial number) to detect duplicate customers + and prevent free trial abuse + metadata: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: {} + - type: "null" + description: Additional metadata for the customer + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID if you already have one + send_email_receipts: + type: boolean + description: Whether to send email receipts to this customer + new_customer_id: + $ref: "#/components/schemas/CustomerId" + description: New ID for the customer + required: + - customer_id + title: UpdateCustomerParams + examples: + - &a4 + customer_id: cus_123 + name: Jane Doe + email: jane@example.com + example: *a4 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. + name: + anyOf: + - type: string + - type: "null" + description: The name of the customer. + email: + anyOf: + - type: string + - type: "null" + description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. + fingerprint: + anyOf: + - type: string + - type: "null" + description: "A unique identifier (eg. serial number) to de-duplicate customers + across devices or browsers. For example: apple device ID." + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID. + env: + enum: + - sandbox + - live + description: The environment this customer was created in. + metadata: + type: object + propertyNames: {} + additionalProperties: {} + description: The metadata for the customer. + send_email_receipts: + type: boolean + description: Whether to send email receipts to the customer. + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + x-speakeasy-name-override: update + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.customers.update({ + customerId: "cus_123", + name: "Jane Doe", + email: "jane@example.com", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.customers.update( + customer_id="cus_123", + name="Jane Doe", + email="jane@example.com", + ) + /v1/customers.delete: + post: + operationId: deleteCustomer + description: Deletes a customer by ID. + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + title: CustomerId + description: ID of the customer to delete + delete_in_stripe: + type: boolean + default: false + description: Whether to also delete the customer in Stripe + required: + - customer_id + title: DeleteCustomerParams + examples: + - &a5 + customer_id: cus_123 + delete_in_stripe: false + example: *a5 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - name: x-api-version + in: header + required: true + schema: + type: string + default: "2.1" + x-speakeasy-globals-hidden: true + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from 'autumn-js' + + const autumn = new Autumn() + + const result = await autumn.customers.delete({ + customerId: "cus_123", + }); + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + autumn = Autumn(secret_key="am_sk_test...") + + res = autumn.customers.delete( + customer_id="cus_123", + delete_in_stripe=False, + ) /v1/products: get: operationId: list @@ -871,7 +1987,7 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.plans.list() + res = autumn.plans.list() /v1/attach: post: operationId: attach @@ -884,6 +2000,21 @@ paths: schema: type: object properties: + entity_id: + anyOf: + - type: string + - type: "null" + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id options: anyOf: - type: array @@ -1056,6 +2187,8 @@ paths: properties: customer_id: type: string + entity_id: + type: string invoice: type: object properties: @@ -1125,7 +2258,7 @@ paths: autumn = Autumn(secret_key="am_sk_test...") - res = autumn.billing.attach( + res = autumn.billing.attach( product_id="", redirect_mode="always", ) diff --git a/apps/docs/mintlify/docs.json b/apps/docs/mintlify/docs.json index 3e707d7ef..5478680e2 100644 --- a/apps/docs/mintlify/docs.json +++ b/apps/docs/mintlify/docs.json @@ -129,6 +129,7 @@ { "tab": "API Reference", "icon": "rectangle-terminal", + "openapi": "api/openapi.yml", "groups": [ { "group": "Core", @@ -143,10 +144,10 @@ { "group": "Customers", "pages": [ - "api-reference/customers/getOrCreate", - "api-reference/customers/list-customers", - "api-reference/customers/update-customer", - "api-reference/customers/delete-customer", + "api-reference/customers/getOrCreateCustomer", + "api-reference/customers/listCustomers", + "api-reference/customers/updateCustomer", + "api-reference/customers/deleteCustomer", "api-reference/customers/open-billing-portal" ] }, diff --git a/apps/sdk-test/sdk.ts b/apps/sdk-test/sdk.ts index 62cbaf6b3..901a30304 100644 --- a/apps/sdk-test/sdk.ts +++ b/apps/sdk-test/sdk.ts @@ -9,8 +9,6 @@ const autumn = new Autumn({ secretKey: process.env.AUTUMN_SECRET_KEY, }); -const customer = await autumn.customers.getOrCreate({ - customerId: "john", -}); +const customer = await autumn.customers.list(); console.log("Customer:", customer); diff --git a/bun.lock b/bun.lock index f93b12f04..455845913 100644 --- a/bun.lock +++ b/bun.lock @@ -155,7 +155,7 @@ }, "packages/sdk": { "name": "@useautumn/sdk", - "version": "0.7.29", + "version": "0.8.11", "dependencies": { "zod": "^3.25.65 || ^4.0.0", }, diff --git a/others/python-sdk/.speakeasy/code-samples.overlay.yaml b/others/python-sdk/.speakeasy/code-samples.overlay.yaml index 1ab69baef..6f933c039 100644 --- a/others/python-sdk/.speakeasy/code-samples.overlay.yaml +++ b/others/python-sdk/.speakeasy/code-samples.overlay.yaml @@ -19,6 +19,24 @@ actions: res = autumn.billing.attach(product_id="", redirect_mode="always") + # Handle response + print(res) + - target: $["paths"]["/v1/customers.delete"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.customers.delete(customer_id="cus_123", delete_in_stripe=False) + # Handle response print(res) - target: $["paths"]["/v1/customers.getOrCreate"]["post"] @@ -37,6 +55,42 @@ actions: res = autumn.customers.get_or_create(customer_id="cus_123", name="John Doe", email="john@example.com") + # Handle response + print(res) + - target: $["paths"]["/v1/customers.list"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.customers.list(request={}) + + # Handle response + print(res) + - target: $["paths"]["/v1/customers.update"]["post"] + update: + x-codeSamples: + - lang: python + label: Python (SDK) + source: |- + from autumn_sdk import Autumn + + + with Autumn( + x_api_version="2.1", + secret_key="", + ) as autumn: + + res = autumn.customers.update(customer_id="cus_123", name="Jane Doe", email="jane@example.com") + # Handle response print(res) - target: $["paths"]["/v1/products"]["get"] diff --git a/others/python-sdk/.speakeasy/gen.lock b/others/python-sdk/.speakeasy/gen.lock index 9619b075b..a29ffdfcf 100644 --- a/others/python-sdk/.speakeasy/gen.lock +++ b/others/python-sdk/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 05940b80-1ef8-40f4-9878-822fb2792070 management: - docChecksum: b65ff198c2a9d322f115152bb4da709a + docChecksum: 3fea67c2d1978eb098ab3724598f1f73 docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 - releaseVersion: 0.1.7 - configChecksum: 2ca0e0ba07824d6779e7d841b9a2ee6d + releaseVersion: 0.2.10 + configChecksum: c7e30bcaf65c4e1b67210f19ebd72b3a persistentEdits: - generation_id: 784a6b3b-2a97-4806-9c16-587b46852288 - pristine_commit_hash: 930b7289d78f6d611338929e7b8f95b00015be23 - pristine_tree_hash: 0a4bdce125e410db52980e1ad137f42b1f774545 + generation_id: 0c0463ea-9eaa-4fb8-a90e-18f8bbe693a5 + pristine_commit_hash: 515d064f9b91ee72d7102199f28f3991497ac018 + pristine_tree_hash: 8935259a07d1bb4952d9af445a0c0276f9ffac20 features: python: additionalDependencies: 1.0.0 @@ -28,6 +28,7 @@ features: globals: 3.0.0 hiddenGlobals: 1.0.0 methodArguments: 1.0.2 + nameOverrides: 3.0.1 nullables: 1.0.2 responseFormat: 1.1.0 retries: 3.0.3 @@ -68,12 +69,12 @@ trackedFiles: pristine_git_object: 2f105e6faf21c499bf71666846a0a8a654c76999 docs/models/attachrequest.md: id: 87d11495db02 - last_write_checksum: sha1:a351084a815fe0639ebe450a21bf423d74407c9a - pristine_git_object: 5c70043e68e383500f83497612c9e11469fbbcd3 + last_write_checksum: sha1:3af58ba7bd95cfdc6fd502848b00f5215b521fb7 + pristine_git_object: e87b55d57686ec931530fd35315680b3b7a793ba docs/models/attachresponse.md: id: 8badce83e7c2 - last_write_checksum: sha1:3bd1c1294e4a1d580c4f6f02c8bd4458f78bc680 - pristine_git_object: 4bb1f22643dcfe7137622ef7440d8d569b9c04e9 + last_write_checksum: sha1:84fe957724ed2c0a4ca38b97788fac339b978f2f + pristine_git_object: 3f097944c0574c95af60ce6fad23becce0ac038f docs/models/attachto.md: id: 1b02aab4ff64 last_write_checksum: sha1:7769aa8b474ca8b6a0da7616022c4374accbd8be @@ -84,28 +85,40 @@ trackedFiles: pristine_git_object: a6d9d9a218c907c01d5786f0a5b430c939038a93 docs/models/balances.md: id: 2f042cf3d0aa - last_write_checksum: sha1:aa56f8208372a5108a4114a2da289a440006a26f - pristine_git_object: bf12416b00703fba55d846d3d609d62a58455177 + last_write_checksum: sha1:5a7d31f7d88c3d6ca511e0ddd363a00aafd64921 + pristine_git_object: dc522d990cda516e7fc7baa3cb5b6deffb27d23a docs/models/billingbehavior.md: id: 9c13c728c39d last_write_checksum: sha1:091c29eab3328e460e5c7807af617042c59a56c3 pristine_git_object: 0e877024644cd075f8bb62873f0a009767b138b9 docs/models/breakdown.md: id: 786823ab8ff0 - last_write_checksum: sha1:ec73aad7b26b34e1e6e899221b411f44904e627d - pristine_git_object: 1a69f2b543b3732e1c44a7aa28113d3f9c2a3f89 + last_write_checksum: sha1:401b60b08fad424e843346063c2b66bcea20b64e + pristine_git_object: 849ebfe99854b2a88f8bf16004af1b22fcaf665f docs/models/code.md: id: 2fcb3964c9c0 last_write_checksum: sha1:a8d5228992892af7137ee43f2bf01cb82ade6ed6 pristine_git_object: 29bc326de035ad5501f9ebac471464ca7b996646 docs/models/customer.md: id: 42ac97d31359 - last_write_checksum: sha1:bfde5042f593ec1186c9166ce0cd8ac19a4d4533 - pristine_git_object: 3cd444dd5f1e02de685a0917c05a88612cf672da + last_write_checksum: sha1:d94186c1228cf23b24a693ec905b45ab5712d07d + pristine_git_object: 778515408b43c10667aca7ceace7799396c598c7 + docs/models/customerbalancestype.md: + id: 936c2d1dae10 + last_write_checksum: sha1:7484e0dc274edc9fa5ab86d5c4e3d4556005c481 + pristine_git_object: 3a9f632084b8f0992adb1ac80384abd1204f0a23 docs/models/customerbillingmethod.md: id: 6c89219094a5 last_write_checksum: sha1:794150f51d1174c921a5ad7208c2f30792b38acd pristine_git_object: 0f5a43b73cc95444baa7a6111ad99750a0517c38 + docs/models/customercreditschema.md: + id: 5d9998b21933 + last_write_checksum: sha1:a65580621d87c3d9094319522e2922354199caa8 + pristine_git_object: 75a9cb56c56870094fbe5c137c484cd4b0cbd799 + docs/models/customerdisplay.md: + id: 0afec61f7fd1 + last_write_checksum: sha1:03bbc8355b7f1bc1adc7100f4c70e9c7d695b0f5 + pristine_git_object: 57b4acb9c02cf7b18a14b015142d9d0ebe3941dc docs/models/customerdurationtype.md: id: dc88db3adc93 last_write_checksum: sha1:42f7f4090ec893457e1f58865a7499a419dfcf4c @@ -122,18 +135,26 @@ trackedFiles: id: e85805d3c1d6 last_write_checksum: sha1:499466ca32127bb204c44df01f958d11d6e5c753 pristine_git_object: 59e884824c96f6bd19141d7db0fcf71b8a707d50 + docs/models/customerfeature.md: + id: e11a0acefe5f + last_write_checksum: sha1:12cba32177f0d938a4f6d2e7bfdd4e36f38c443b + pristine_git_object: 076eb6dc3637ad2ece8d43a083fa50682dee0717 docs/models/customerintervalenum.md: id: d28f10412e40 last_write_checksum: sha1:1aaf2650bc5bda39177e2dfe610910446000d3e9 pristine_git_object: 712415b49ff39f41707cbc2ccf31fb21c0069114 + docs/models/customerintervalunion.md: + id: a768da6bdb1a + last_write_checksum: sha1:ce8ae7573b3c4cbba7bdb45af75b651543fe51ea + pristine_git_object: 7e9dd6d8a0f7ec211ffe4ead73a958aceb0b9e1c docs/models/customerprice.md: id: 14e62b292a06 last_write_checksum: sha1:17aa0c3e56fbb0f98a1e285a3f76dbc4fb5b56ea pristine_git_object: 88630fbeae2a7d8f4f71202bd941fde03a1a1f7b docs/models/customerreset.md: id: 78338a885803 - last_write_checksum: sha1:1b5d82bc6391adae16dd1ac689d3e300d31bbea2 - pristine_git_object: c789011c5fc6339908e580eb1925ee5ed96b97f4 + last_write_checksum: sha1:0b5ac62bee2af5b1a46f2f6e052bbef53f7b7a37 + pristine_git_object: 49409b4c0990178e7c33dea86d8950338015e4e2 docs/models/customerrollover.md: id: 9c4ad3a98d86 last_write_checksum: sha1:a44ed6945bc97ee12a289bd286d4a76aa23935b0 @@ -146,18 +167,34 @@ trackedFiles: id: 9008a8e5a903 last_write_checksum: sha1:7d92a838adfa2d707b56d735eb29618fd10d9803 pristine_git_object: 9cee863933300366095f209c8a27042cff7cfc4c + docs/models/deletecustomerglobals.md: + id: 18185861afe0 + last_write_checksum: sha1:4f2518043823f5e9d157ac0a46c2fd050dfc489a + pristine_git_object: 109883690f7f3fa02f937b643f6a9907fbecc85f + docs/models/deletecustomerparams.md: + id: 6600c955095a + last_write_checksum: sha1:5bced7c30e1867bdc4fa118b77e2cb918482e023 + pristine_git_object: 98072f7da1e6d93daa23514b305293e4e7706e19 + docs/models/deletecustomerresponse.md: + id: 5fed3824cc2e + last_write_checksum: sha1:bece33e132360565546ca58d64e61793106a35cb + pristine_git_object: 7ab2e8a024c5f4d2f8a00c4247adc14e1cbd0e41 docs/models/discount.md: id: 003b28f6c8a6 - last_write_checksum: sha1:ce1cdb8a7e931687a18c213147d9d34fb94abc82 - pristine_git_object: 58e1eafe60442a088fdbf5b3fe6bab638b298ed1 + last_write_checksum: sha1:b9dae9fc7bc9cfb592d5d6679d65739d15b65fb5 + pristine_git_object: 73273a9dc0cc58d0d6ff61fba0bdc32754d1e264 docs/models/duration.md: id: e63d42c932a8 last_write_checksum: sha1:375f7bb11bf8e8242c4354ee9d543a8625bb1b30 pristine_git_object: d3686dc5a288ae0becca372f5c106da540e2ccef docs/models/entity.md: id: 903c73579a5c - last_write_checksum: sha1:21d53cd4ec4b6f5c87308a0767cbf121490add1b - pristine_git_object: 68e0ec50e5ec1fa51706c5e81133b4973a7a14a7 + last_write_checksum: sha1:a4a1fcd1da126af4e2a8da105fd4dff427857258 + pristine_git_object: 034cdb77abd8d6e14bd78aae0d6b2df7760a785c + docs/models/entitydata.md: + id: bf2e9a65b55a + last_write_checksum: sha1:337d799b523ff22e200af87e99c20baa569cf49f + pristine_git_object: 4d61fd061217222f7c2d2b292e03908d37788728 docs/models/entityenv.md: id: 5c026cde1184 last_write_checksum: sha1:8a7e9be1424504f599c97ab269154498bc9c498a @@ -170,14 +207,14 @@ trackedFiles: id: dc73eb37daef last_write_checksum: sha1:c1789ef30367ada63ea75c3d2ccff9a6da3a8c3c pristine_git_object: 8a319330306ea2ec52d9c5fd937d256a98c8a1d6 + docs/models/getorcreatecustomerglobals.md: + id: 1cab932654ad + last_write_checksum: sha1:a98b6f0751961493a875cad885360ca4ab817955 + pristine_git_object: 4e9384d4fa1e76e5f7072105ad37bd960b3aedfc docs/models/getorcreatecustomerparams.md: id: 6bb57e046821 last_write_checksum: sha1:53a4bc89541b3de7bfd893b894c386deee187129 pristine_git_object: 438b3c3d032a0b57e9c72778ba797375ab8898b4 - docs/models/getorcreateglobals.md: - id: 6d11cd2282d2 - last_write_checksum: sha1:44b3280ac5034199bf71a6870cf122c35dbdb6fe - pristine_git_object: 39abbf6e66b908cf05a7369c951c9b1bb562dda0 docs/models/includedusage.md: id: e844c6f90fe1 last_write_checksum: sha1:f45eadc2eb0f9f2543fcfd3b0d671c8fc9e1c5a8 @@ -186,22 +223,110 @@ trackedFiles: id: 9c173b87f41f last_write_checksum: sha1:f1b8e7ce642026cd3ca1df79e67c7a011f487fca pristine_git_object: b2f8dc32fc72edb1b050a6ff282c1498eaf928f4 - docs/models/interval.md: - id: 11a74d2c19c0 - last_write_checksum: sha1:c8e451ae26d40c202d6964d07232be112b7ac271 - pristine_git_object: e07865e4eb6089a16c91ade3acfb97671d1e5071 docs/models/invoice.md: id: 18e2034f11ad - last_write_checksum: sha1:f800c00cb9011e4badeb748a0f4a4b016e69b597 - pristine_git_object: a50ac046213c5be53fa31c669dc57f485612ed6d + last_write_checksum: sha1:359475ecee43870f2eb2421cf1243cfbc38e45e7 + pristine_git_object: 89d5fc51af2af3c3ac46c8b30c6daddf2748c444 docs/models/item.md: id: 40dd7473ab87 - last_write_checksum: sha1:89b5e6126d327480462fe902c1ada54999abc817 - pristine_git_object: 64761c2e934541b06250b4f14d6800ce120dfbfa + last_write_checksum: sha1:1abb5a59d73c082a28e17b2806960ecd802c39fb + pristine_git_object: d35ac85096b4b0eb006240d3a249c1cc4fee9b5d + docs/models/itemdisplay.md: + id: dab753a057ae + last_write_checksum: sha1:4025c1f785a6e8f636959fafdf058cf7fce29f6e + pristine_git_object: c6130de32c28441bb7555e595caf731a1a8c0f25 + docs/models/itemfeaturedisplay.md: + id: 6056553603b7 + last_write_checksum: sha1:d92e203fd7bf63d91a3b6eede5fc921f459c7560 + pristine_git_object: 3cdc943a7d7f60a420e9bd277ea5a1ae4d8bcd72 docs/models/itemprice.md: id: f3e047ed55d5 last_write_checksum: sha1:e23355cd6dfed9bb07806b03dbd80afe8cd9f20a pristine_git_object: 13197bfccebe058e0dde400ba4e947559b1979c1 + docs/models/listcustomersbalances.md: + id: 03c5aa088096 + last_write_checksum: sha1:3da2493ee865dcc582bde8a3400fe381ab66d67d + pristine_git_object: 47ea1470231462f55c8236110fe1ccb66fe17fcb + docs/models/listcustomersbillingmethod.md: + id: d21be11d928d + last_write_checksum: sha1:8dd920c7dfc528a02a386676e20da2f476fdc354 + pristine_git_object: d394f3fcb0d5f139d5ab0060b077fa005ee4a13b + docs/models/listcustomersbreakdown.md: + id: 93bc1cdb1e37 + last_write_checksum: sha1:a25602ec22af2f2938b78a50bb00ef0dcd9b9a7d + pristine_git_object: b41b3d4339e2a75a0ec8058b0aa9ab06d74bbc1c + docs/models/listcustomerscreditschema.md: + id: 233b13b5c3ec + last_write_checksum: sha1:df3fc7455a099da412abdc9ff85f021b1de749ec + pristine_git_object: d886d2a65ed9dc513e0ee1fd643e42c6bb6714d9 + docs/models/listcustomersdisplay.md: + id: fe943dbb43ef + last_write_checksum: sha1:6c66b0fb245afa4de2ff81ff815b38be29dab899 + pristine_git_object: ded4ae9ad04c1bd72dfd1936c7f35dd9ccabf935 + docs/models/listcustomersenv.md: + id: 4a356fa1f33b + last_write_checksum: sha1:e883c9c38a73b9910ff2cbdd6adef00b226ff214 + pristine_git_object: 750e1fe57b24381eafec336a5d7d1a97980447b8 + docs/models/listcustomersfeature.md: + id: 0d1d6a29245e + last_write_checksum: sha1:cd517ede0cff21b702bd8a5235627ed2f6987309 + pristine_git_object: 7b61528e5fbf4db0951347f940b9ec1eca8d3f20 + docs/models/listcustomersglobals.md: + id: be7050e3cb0c + last_write_checksum: sha1:89763ac589ae615c58d37153e80a6b5bd0d703a3 + pristine_git_object: 0c99ff068e87c00c04403bafdb526327c872e28d + docs/models/listcustomersintervalenum.md: + id: 6a6de53813db + last_write_checksum: sha1:0fb0cf94885bffca7120439ce26b0a97fa88c984 + pristine_git_object: 29ccd27c9ae8bdf671fa48899bbd7ff1f6717759 + docs/models/listcustomersintervalunion.md: + id: 69f4d6d8b38a + last_write_checksum: sha1:a619d6256a362c45d3a3b0047a352d75c8f26f80 + pristine_git_object: b2c4f91d3712a684a51013e6f60355f6452f7467 + docs/models/listcustomersparams.md: + id: 8ac823390bd3 + last_write_checksum: sha1:df17db59b8245a4f9e9a952a659035219a40798f + pristine_git_object: 905ccc5f08706d6cff1b8277515ca0d198bd7e19 + docs/models/listcustomersplan.md: + id: 676e48e73f55 + last_write_checksum: sha1:d7d03d3d56264e691c90389b4ea7d94d66b90963 + pristine_git_object: f2d4ab71e9ca08cd4f36405c0fe420be387947bb + docs/models/listcustomersprice.md: + id: 73b0691740ec + last_write_checksum: sha1:8b6b04a16ace81c7e6a6aac6aba342b8eb6891f3 + pristine_git_object: 11660aa4e54064f493084a0d15bc69e98fbb3444 + docs/models/listcustomerspurchase.md: + id: b7fa1c1d2bae + last_write_checksum: sha1:ae695b6ce08eb0d24e7870ead438bdcbecd30739 + pristine_git_object: ba47d94a11c462f631ce7663ed93ad44fa50b885 + docs/models/listcustomersreset.md: + id: 2706e5f5752f + last_write_checksum: sha1:7aa06844aedb12ef6d2a543fd61b18be01923eff + pristine_git_object: 032f8c8d4670b69d1978b8a2d0f5fb6d2fe3e510 + docs/models/listcustomersresponse.md: + id: 8bcc0ece3648 + last_write_checksum: sha1:835ab42514fc904434f1442a812b381dc224480d + pristine_git_object: 4d7bbf3ef462d86a78a673d863fcc9097a8fd11e + docs/models/listcustomersrollover.md: + id: 61a4472ee4a5 + last_write_checksum: sha1:996ae8fc5ceffa27e7bd3bd54fe9d2ef3e330ba1 + pristine_git_object: 01463f0ef7542838aa629469a6047bb59cf57039 + docs/models/listcustomersstatus.md: + id: ef9a6bf44535 + last_write_checksum: sha1:0ebc78b5551470c5da47f9cfd779bb41c5d37d56 + pristine_git_object: 06b87554d48b5879195e4269b9e7749e8205fd04 + docs/models/listcustomerssubscription.md: + id: 563487abda41 + last_write_checksum: sha1:9edec9ebde2dbc4ec4aab348fbbe784e94ffec69 + pristine_git_object: 40294b3c65085310c201d48905a28c77fcbf473e + docs/models/listcustomerstier.md: + id: 366b5fd771c3 + last_write_checksum: sha1:8e19d7b783ea39be2309bf2000da951cce5ea1f1 + pristine_git_object: 870585501e53f06f9885b6cf0fc3424223759d26 + docs/models/listcustomerstype.md: + id: 431485f373da + last_write_checksum: sha1:caf95398f6f9899c01bd2d347ef077e09155245a + pristine_git_object: 7d759dbd6668f77587a13cf5f292c1fe96986d04 docs/models/listglobals.md: id: 9fec4ac692ff last_write_checksum: sha1:ca9059d3b31cd4f7677cd3fe645fa51aad005fe4 @@ -214,6 +339,10 @@ trackedFiles: id: 9f5b5153301d last_write_checksum: sha1:d7f2028cd85e8b03f6028305063f96c9afcf9284 pristine_git_object: dca8216bcfba25191e8f3cc82406db7046b9fb10 + docs/models/listt.md: + id: c8af7ba36d41 + last_write_checksum: sha1:6464db5f78a17f16cd9edadc39cefd35cc04d383 + pristine_git_object: f9761f7589159e8ae61526b7b090daa9208c7467 docs/models/ondecrease.md: id: 64eee91e295e last_write_checksum: sha1:999ea60fe26a7b5c4e4156ec56df078b883168a1 @@ -228,12 +357,16 @@ trackedFiles: pristine_git_object: 261c7d6183f2ff6b64aeb97f507b9475e7e14ab8 docs/models/plan.md: id: 900c4149ef4b - last_write_checksum: sha1:a310e074b9c469c0ebd761e55bdc590258103961 - pristine_git_object: 2ca3f0581334b68677614ab5a0d7019dc1cfcc58 + last_write_checksum: sha1:be5c12df8e68ea9d232716b1b2ee5010830f0051 + pristine_git_object: e57ad90418971bb25b6166c84d74cac8c66cc9b6 docs/models/planbillingmethod.md: id: ac90cee4f6c5 last_write_checksum: sha1:09b695044d92084978297b9e878857938bda8366 pristine_git_object: 94bdd58e5622f19d29267d15f91f96ab6a9679dc + docs/models/plancreditschema.md: + id: 510cd9d4f287 + last_write_checksum: sha1:3929c72df37848348916c755926dd1de7c252b3e + pristine_git_object: bcf7cd000ef324a7eccf32e58c7195627bf19a29 docs/models/plandurationtype.md: id: 7eb9a5f1eacb last_write_checksum: sha1:a0b5b8d9066dd79472e2abf269e73c8b4a7f3e06 @@ -242,10 +375,14 @@ trackedFiles: id: 0e584adaa5a5 last_write_checksum: sha1:62f06d32c624064b18ee6ebd2fe1fe909cecf237 pristine_git_object: da89cacf400e948cbfcc677c541918736473b531 + docs/models/planfeature.md: + id: 81977f66cb0b + last_write_checksum: sha1:15fdce0432d62982fc87488399d55853142b0ffe + pristine_git_object: 15051964620b2a88b51023ea151331f37fa4c224 docs/models/planprice.md: id: 70699ad0c942 - last_write_checksum: sha1:8d7fc0762a0873c87e8f565b194336d60013f034 - pristine_git_object: ad2a83713f9d06a4aefcfb921cccca7b5de25bed + last_write_checksum: sha1:daa4e001e23dda58c8e901996a291fa168ae719c + pristine_git_object: c1df139405bc1dc620f78ffd8be0e89567cd014a docs/models/planreset.md: id: 08cb2753f6e6 last_write_checksum: sha1:6f73e545b179866a81ad746b2bf1b5f1039da727 @@ -270,6 +407,14 @@ trackedFiles: id: 642e67b335e5 last_write_checksum: sha1:699b39d870e41c1926ca1f043c3273b00c8b80c0 pristine_git_object: 5c73883ba8a35a3b1c168ea4f8b6b66cdfdd0a86 + docs/models/plantype.md: + id: 4c86df78e60a + last_write_checksum: sha1:f78cd88fb5996e96029ce1c66c8b76f80a83a05e + pristine_git_object: cf233509e8cc1599a589dba1e68dda9e2d16400b + docs/models/pricedisplay.md: + id: 3434a0ab11db + last_write_checksum: sha1:589317957949aa94497a1aa6a3e3a557f6337973 + pristine_git_object: 5af13ee5d38a23052ae3599b12021bccdedc9ef8 docs/models/priceinterval.md: id: 55c918da8ebf last_write_checksum: sha1:5e27d187a022e69060afb4783b5694b03f757297 @@ -292,12 +437,12 @@ trackedFiles: pristine_git_object: 402014e08c38d09a97d5e4be12e032f2f66b4f5a docs/models/referral.md: id: b58def2d8bbe - last_write_checksum: sha1:e3db145687c24e759f4abc69a1ab113372b56dff - pristine_git_object: 8a192f999932ad1af99c971a70a094c9534ecc33 + last_write_checksum: sha1:530cc33b44fb8bca73dd423110f205a48e0e565e + pristine_git_object: f9a88e2c250053ef96dceb7d1f3b1f17c727f08c docs/models/referralcustomer.md: id: 7a0bc0d8989b - last_write_checksum: sha1:792e8d834522ab2166ef7f9b92226624e9b7a83a - pristine_git_object: da8b2e17f7a1a9be041072354741037d687e9a47 + last_write_checksum: sha1:d9f5922703066a3a4cf275d71b75330909c267ac + pristine_git_object: 8cad0f99cc3791479d89b3d78829e851094f11f0 docs/models/requiredaction.md: id: cd2da198d086 last_write_checksum: sha1:3f20a7d2d5c5b428e46c85cf3f0943a9a6f95b3d @@ -306,6 +451,10 @@ trackedFiles: id: 4551c882db3e last_write_checksum: sha1:49d41902a34cb66859df2528ed2fe8597e8eae84 pristine_git_object: fcbd3790d73d6a7157b9665d8221be09af8822bf + docs/models/rewardstype.md: + id: 338992fe95d5 + last_write_checksum: sha1:7eb06abf43f702403e324aeab931a3affd4a37ab + pristine_git_object: e3e5b0cff2939b70dd449114ac63bd2787ff8732 docs/models/scenario.md: id: e3aad8ab5efa last_write_checksum: sha1:10d2ef18c8acb243a1519493cea42c958126ec92 @@ -322,6 +471,10 @@ trackedFiles: id: 4a200793e0f4 last_write_checksum: sha1:985d78373197de378488e772fbcf7a62bdda47ae pristine_git_object: e7c4060bc95b77c9df7f9f5f9bce7d0f4a3364c9 + docs/models/subscriptionstatus.md: + id: 5f08d32c769a + last_write_checksum: sha1:3cfa48d8a7dff1b56bd411ce40c4286ca788de54 + pristine_git_object: 6751a76861dda8aafb85e42820a94f0f302c4dcc docs/models/tiers.md: id: 06571cdb201f last_write_checksum: sha1:7cd0da02298206ef858f44a44768fde5a3166bab @@ -330,10 +483,90 @@ trackedFiles: id: d3a87e402a87 last_write_checksum: sha1:e94b335fde33fa867d83a085af54e56e003b468d pristine_git_object: 8eba6942218e21e379f0886cbcba182ceffed7b1 - docs/models/type.md: - id: 98c32f09b2c8 - last_write_checksum: sha1:b504008378bf5b29ea853cf1d0f9cf4d8ff71495 - pristine_git_object: 7af50db5c4bd28b5005c5648c6550b6f0af0c132 + docs/models/updatecustomerbalances.md: + id: 7f44136e5175 + last_write_checksum: sha1:696b17d9bcd4d1d65d8f41f2561ec021cfb8a4bf + pristine_git_object: 273486f9eb4b226358403ffb268329d5fbc4e490 + docs/models/updatecustomerbillingmethod.md: + id: b251b4090471 + last_write_checksum: sha1:70e36e639090894ce5504b8c055b2962eaae9cef + pristine_git_object: 175ceae8f0d83ab07d5bae5ac485566024ad8dc9 + docs/models/updatecustomerbreakdown.md: + id: 2f3a2d8f745a + last_write_checksum: sha1:c2627d2fcfe7de7de50035c345212162658c9331 + pristine_git_object: 0a5f6661217832605789fa1f1011f3eab80a1631 + docs/models/updatecustomercreditschema.md: + id: 9ed2810c66f9 + last_write_checksum: sha1:874cea697b072edd41ebe61d3435422261c5025c + pristine_git_object: 67fcfec84071e9bd9720fa226fcc771a8798998c + docs/models/updatecustomerdisplay.md: + id: 3294ba741022 + last_write_checksum: sha1:4f6f5caf4d9989373977411c8fd0d4648048a10e + pristine_git_object: 0fee459c9f2ccab9720253ce7f826f4cd9d2f7fb + docs/models/updatecustomerenv.md: + id: ee8d2224eeb3 + last_write_checksum: sha1:2d3ebb5ec7bd7948a7a9b1aa12505b5e725fe3c6 + pristine_git_object: 93eb528d888c1d94f2f243e20d732466bff2d175 + docs/models/updatecustomerfeature.md: + id: fea7c9019bce + last_write_checksum: sha1:0dc46a132b2f50b90de3dd54f71136982ca82c3f + pristine_git_object: 773fbeb9e5aaf9c663855b7231d074f2dc45a0cd + docs/models/updatecustomerglobals.md: + id: f8ba9d61dfdf + last_write_checksum: sha1:188bd01790d033d4f2d2613242e1261d79e064db + pristine_git_object: 5010263b034bbc3eaddad96700c1088373e6b6d5 + docs/models/updatecustomerintervalenum.md: + id: 1295ebad89a5 + last_write_checksum: sha1:5463b72b55c7b038e7009b3cae64368714652a3e + pristine_git_object: 691fcd18ccc76ad1f43e5f8fd4c2ec9dae0a862b + docs/models/updatecustomerintervalunion.md: + id: 3fe83fda021e + last_write_checksum: sha1:d269abd012fb2b6a036b9521ddfe7b5910e80b68 + pristine_git_object: c47a47e06bc6f99871ea264c6882610c66c23a5a + docs/models/updatecustomerparams.md: + id: 4015e931c04e + last_write_checksum: sha1:3af6fa7dd0bbd7ba38bc5d74f938f812c5ce1301 + pristine_git_object: 9f4d5f96ff6ca1038a911b0b0e7574b1cf418b2c + docs/models/updatecustomerprice.md: + id: 513c804d07a1 + last_write_checksum: sha1:96a9383f2f0bd922065dc4bc9526724b9c860b5a + pristine_git_object: 073a0ccc1dda80a6e0fbb2f2bef0bf85efa2294a + docs/models/updatecustomerpurchase.md: + id: 392cb675471e + last_write_checksum: sha1:fd7e3007aa279068b3930d25018f6b520208feb5 + pristine_git_object: 0e7ac3b22c74ee248b8d62ae6341b10a435bf8bc + docs/models/updatecustomerreset.md: + id: 595cf5edf31c + last_write_checksum: sha1:2438fff669e242b1509f0e3098be4c6f686b5ee4 + pristine_git_object: ff27d3a15e5f9c11427d9c5e5c477b7ab9464f39 + docs/models/updatecustomerresponse.md: + id: b8e414267f76 + last_write_checksum: sha1:b67b8e3a982dee5b7c7228dd1131ce1616038909 + pristine_git_object: 655453dd0873183ba39647c3d4814fa128a57018 + docs/models/updatecustomerrollover.md: + id: 7045f542beda + last_write_checksum: sha1:e083870d58c92ea86c7a13159d12ba8bed720b25 + pristine_git_object: af07f81be4a9e35d5908d47b7a72353094698a3f + docs/models/updatecustomerstatus.md: + id: 12e6ef4fbad5 + last_write_checksum: sha1:d227dc20a02ff503cb02e5182646bd2251b8b257 + pristine_git_object: 09097d659bb8d9800dc7c24702909638d49930ea + docs/models/updatecustomersubscription.md: + id: 23620d1508c4 + last_write_checksum: sha1:aa7783238dd7ad6a442d28a9fc1fc221110d460b + pristine_git_object: a09e306f9d4ac8a9902a8dec21d2f2b09be8dc9a + docs/models/updatecustomertier.md: + id: cc94a2a8f513 + last_write_checksum: sha1:cabb8309cb750260b5d55c59296b603e05662260 + pristine_git_object: a66e4f5184e87245d6556003c777cb4de1858f0f + docs/models/updatecustomerto.md: + id: b677fb19acc5 + last_write_checksum: sha1:cc02d15d93210bb1ea45159bd133db8a01354d8c + pristine_git_object: 41f21715023a3b77abb050624f61d0c5a4f66bf4 + docs/models/updatecustomertype.md: + id: ade4d76bc6b0 + last_write_checksum: sha1:e3f073958b22e5da59bd2e5bca8c6c0244ea4cdd + pristine_git_object: 67da276b5945364b84454143074dffd3fc5a067c docs/models/usagemodel.md: id: 1e12a2a8fc52 last_write_checksum: sha1:6e6803b39c0b8d88be49568c7a1bbcf8b4dba4c1 @@ -344,12 +577,12 @@ trackedFiles: pristine_git_object: 69dd549ec7f5f885101d08dd502e25748183aebf docs/sdks/billing/README.md: id: dc915331dd9d - last_write_checksum: sha1:612ebd1ad87568e101b964755d32dd954650ad4a - pristine_git_object: f9f02df10fb1df3fa3ecb7b388a5bd2f7cfb7c49 + last_write_checksum: sha1:aef7e94bcbf07fa0f3474ac8ff7b610ea0b0fb21 + pristine_git_object: 3c06cfed8fade17d4d03feb6d4e7d4aab3fd7e16 docs/sdks/customers/README.md: id: 9332759cffc2 - last_write_checksum: sha1:3ecf4d415c7d8472c66b347946c99134d5e3697e - pristine_git_object: 0a3f98c0ffc05d7fb1f17ce978dbcbaa63906d99 + last_write_checksum: sha1:e1171cfe2608efd206368369bcb619a9d2ebf0af + pristine_git_object: c158c181f1d41ebd65f458aac07440595482236b docs/sdks/plans/README.md: id: 2d8c741fff57 last_write_checksum: sha1:6e2eaf4d124140cee1d24cf09cc5bfdc16b50eb5 @@ -360,12 +593,12 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 pylintrc: id: 7ce8b9f946e6 - last_write_checksum: sha1:ff065e1d3d6054c876fd6cf0ebd710ce14491221 - pristine_git_object: 58d705283949cf00d6776293f493c8b937fad995 + last_write_checksum: sha1:5f1685061a0bb3b651795382827dea4d988f8522 + pristine_git_object: f13c2fb5532a06cfe87f594097bfbf72e8fc04a1 pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:6f22321d9ae998b27d4b15a939ad40b9e1f39b81 - pristine_git_object: a05c06c14c54a1f0d733d2f8f3054a66e7c5f967 + last_write_checksum: sha1:74fafd6e15d89146fd160e0dc0b53edf3298bbb3 + pristine_git_object: 65746bfc87c69ecde572b7c5394e26de7610694a scripts/publish.sh: id: fe273b08f514 last_write_checksum: sha1:adc9b741c12ad1591ab4870eabe20f0d0a86cd1a @@ -388,20 +621,20 @@ trackedFiles: pristine_git_object: 3e604651c1eae73d815b276806e73b2f1334bb79 src/autumn_sdk/_version.py: id: a98babfdf4fc - last_write_checksum: sha1:e0b31129f0ea0d8fe9033dfd9a20d389b7216e28 - pristine_git_object: 1491b5fb6df1f030f8187d959a3a90ad19b45295 + last_write_checksum: sha1:bbd86adbf1b47d46d2aebbdbae33b1e78fc41876 + pristine_git_object: 02aea602cc0fea7e89883d2bff2c8843fda7ba19 src/autumn_sdk/basesdk.py: id: 8c9c35fe744d last_write_checksum: sha1:5d6abacbd251bd806538b19ab9662994bbfc6e24 pristine_git_object: b8da96bd89ddafaedb32f4ecac64c27027fcca79 src/autumn_sdk/billing.py: id: e6cffdbf2221 - last_write_checksum: sha1:46dfd5fd8c9b0423e831a196131751162bdc5cd5 - pristine_git_object: 09ec0b7c21dc808420b61719fdc91de131cba206 + last_write_checksum: sha1:f93defeda0ad866ae40d00fe22867fd9f297b2ad + pristine_git_object: 6b2b9d3fe11f30e301e1679d0cc44b758518fdf8 src/autumn_sdk/customers.py: id: 5c5a0a07a433 - last_write_checksum: sha1:3c228451abfc1f8fcb6d1183b90aa4193410aa55 - pristine_git_object: eae96197bd8150c542ded362580d5d639a381f7c + last_write_checksum: sha1:9cdb9e321f84a947ca410ad75d4f8255cbfdc10c + pristine_git_object: 88e2f9151b6ef6ce225d17800f742ca5b3f67a46 src/autumn_sdk/errors/__init__.py: id: 242853123cf2 last_write_checksum: sha1:3185fbf12ed61a9845f94127cb110bce8f7f8f66 @@ -428,24 +661,28 @@ trackedFiles: pristine_git_object: 89560b566073785535643e694c112bedbd3db13d src/autumn_sdk/models/__init__.py: id: bcf3802243ff - last_write_checksum: sha1:b9457640216dbfb69d65ad6350adc964870c3959 - pristine_git_object: a392d40e36275bb393258a01757cb4fb9f113274 + last_write_checksum: sha1:263c37b1b87b2d0e4dadf398272a6c58f2d3541c + pristine_git_object: fe1d47a7c1822a8a456e74893c8431ec7d79c1bb src/autumn_sdk/models/attachop.py: id: ebb59e06476c - last_write_checksum: sha1:014995810b7c10548f80cf690771105234934454 - pristine_git_object: 3aefdfdb33ce47ca84f60d30ff8368a6c734b1e3 + last_write_checksum: sha1:1c0c825570da089bf834dc1599e07159888c3859 + pristine_git_object: c9341b3c59049d2d717710c9be89b9386182e8a1 src/autumn_sdk/models/customer.py: id: 8ed0174f7272 - last_write_checksum: sha1:0d634e5ad085f76ed5fe6f0af4d346d325984bd3 - pristine_git_object: d891471aace0d8451a48529f3607b34ad0ec07b6 + last_write_checksum: sha1:cd7f48270a61401129aae29732d82a9756ca577e + pristine_git_object: 91ead7f8055ef16c5ab02c2af75812a29c791747 src/autumn_sdk/models/customerexpand.py: id: 9d337d480baa last_write_checksum: sha1:27c32a524c500e8f9a03258ffab34a7ac1605ed3 pristine_git_object: 1220188fafa06dc42573c1ce7f98e84b13bde31d - src/autumn_sdk/models/getorcreateop.py: - id: 55a4c0cf5ac8 - last_write_checksum: sha1:07d15f96dbfb559688619c057b700f6260a0031d - pristine_git_object: 4609818c2d80df2abe23857841135a5af9242da7 + src/autumn_sdk/models/deletecustomerop.py: + id: dc7a1e2cc90b + last_write_checksum: sha1:0eb2e63afaa85cc828468d6359883eeeecde9f31 + pristine_git_object: 71f6b0b765026846da6f55ab567eb2f085991947 + src/autumn_sdk/models/getorcreatecustomerop.py: + id: acfac0d7be14 + last_write_checksum: sha1:033c7bd619e40b85d9f5823c78021bec66206c6e + pristine_git_object: 6f59baae0a062bf5955a4501af2381b3ffad5857 src/autumn_sdk/models/internal/__init__.py: id: 2906fe7f2cde last_write_checksum: sha1:5beaf7e5a713d3eead465c6edcfdeb7f8076175c @@ -454,18 +691,26 @@ trackedFiles: id: 4e33eb99f463 last_write_checksum: sha1:d93338d6e5fddf8e022ddc96aaa7033832c17aa7 pristine_git_object: e6ef4341edccbf10916d0f08d7f2717c65c5f8ee + src/autumn_sdk/models/listcustomersop.py: + id: d7074740b8b0 + last_write_checksum: sha1:c160f55fb72cad9b7aee32728dff44f9184ebd94 + pristine_git_object: 7be0ab37eb525c710505120585dc57199a164277 src/autumn_sdk/models/listop.py: id: 1a5423b9677e last_write_checksum: sha1:a2c38ba2e204e58e62aef307defcc684b3b591ef pristine_git_object: 7fa36b65893ebb4f8924e8589f9b401c22a5021b src/autumn_sdk/models/plan.py: id: f85c4e07540d - last_write_checksum: sha1:e0a7d4dda7f7995e64ffacee2c8d5d686e5cfeb1 - pristine_git_object: 17efb1b3dc348d1525e96441eca47be09ed21251 + last_write_checksum: sha1:10b8749a38acd8776c1e07ee2ca821882c8f81b1 + pristine_git_object: c7f0feb2ae01148229ca957f9d4180dc48c9f9cf src/autumn_sdk/models/security.py: id: 27d01b755fbe last_write_checksum: sha1:e5ac2e52ed9c2db46d4989c4744c230dd12bdf01 pristine_git_object: aa686dd6f85ae1e27450392fcfe02527adfe8e61 + src/autumn_sdk/models/updatecustomerop.py: + id: 28b9d5b59bae + last_write_checksum: sha1:022834e9c5108ba7d729b458f0ac20f8101e784e + pristine_git_object: b501c3f8b48871b8ff4206911abb63d720704656 src/autumn_sdk/plans.py: id: cf1ebabb687c last_write_checksum: sha1:0ed87aa09c1b67b27ea580d408985205389152cd @@ -476,8 +721,8 @@ trackedFiles: pristine_git_object: 3e38f1a929f7d6b1d6de74604aa87e3d8f010544 src/autumn_sdk/sdk.py: id: 9e733b372628 - last_write_checksum: sha1:02a411e53a0b3131df887c3e9ce5edd791469a73 - pristine_git_object: 44c47a2a89e707dd143020effd0a6917a2db6c7a + last_write_checksum: sha1:ec6191980da2ba83a2aaee55a5510c2e2c810289 + pristine_git_object: 9f3919f507d707dad91427429ba3128d414902f2 src/autumn_sdk/sdkconfiguration.py: id: e65df2e44fc0 last_write_checksum: sha1:9cd4e2b7d75cbc01d6c7d1c9e676a48ea85c5c22 @@ -576,7 +821,7 @@ examples: x-api-version: "2.1" responses: "200": - application/json: {"list": [{"name": "", "description": "distant recompense trick", "group": "", "version": 9615.63, "add_on": true, "auto_enable": false, "price": {"amount": 2384.12, "interval": "week"}, "items": [{"feature_id": "", "included": 4974.83, "unlimited": false, "reset": {"interval": "day"}, "price": {"interval": "month", "billing_units": 5281.09, "billing_method": "prepaid", "max_purchase": 8873.17}}], "env": "live", "archived": false, "base_variant_id": ""}]} + application/json: {"list": [{"id": "", "name": "", "description": "distant recompense trick", "group": "", "version": 9615.63, "add_on": true, "auto_enable": false, "price": {"amount": 2384.12, "interval": "week"}, "items": [{"feature_id": "", "included": 4974.83, "unlimited": false, "reset": {"interval": "day"}, "price": {"interval": "month", "billing_units": 5281.09, "billing_method": "prepaid", "max_purchase": 8873.17}}], "created_at": 9820.05, "env": "live", "archived": false, "base_variant_id": ""}]} attach: speakeasy-default-attach: parameters: @@ -587,4 +832,44 @@ examples: responses: "200": application/json: {"customer_id": "", "payment_url": null} + getOrCreateCustomer: + speakeasy-default-get-or-create-customer: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "name": "John Doe", "email": "john@example.com"} + responses: + "200": + application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": false, "subscriptions": [{"plan_id": "plan_123", "auto_enable": false, "add_on": false, "status": "active", "past_due": false, "canceled_at": 1395.23, "expires_at": 455.92, "trial_ends_at": 875.56, "started_at": 3418.9, "current_period_start": 8321.34, "current_period_end": null, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 8589.77, "remaining": 2642.5, "usage": 145.7, "unlimited": true, "overage_allowed": false, "max_purchase": 8214.93, "next_reset_at": 5618.81}}} + listCustomers: + speakeasy-default-list-customers: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"offset": 0, "limit": 10} + responses: + "200": + application/json: {"list": [], "has_more": true, "offset": 5136.21, "limit": 2534.27, "total": 7618.77} + updateCustomer: + speakeasy-default-update-customer: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "name": "Jane Doe", "email": "jane@example.com"} + responses: + "200": + application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": true, "add_on": true, "status": "active", "past_due": true, "canceled_at": 8303.59, "expires_at": 2755.88, "trial_ends_at": 1461.02, "started_at": 1649.05, "current_period_start": 8034.1, "current_period_end": 8058.66, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 7559.37, "remaining": 952.25, "usage": 7029.24, "unlimited": true, "overage_allowed": true, "max_purchase": 7619.46, "next_reset_at": 411.76}}} + deleteCustomer: + speakeasy-default-delete-customer: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "delete_in_stripe": false} + responses: + "200": + application/json: {"success": true} examplesVersion: 1.0.2 diff --git a/others/python-sdk/.speakeasy/gen.yaml b/others/python-sdk/.speakeasy/gen.yaml index 377ad92a6..eb4dd2cdc 100644 --- a/others/python-sdk/.speakeasy/gen.yaml +++ b/others/python-sdk/.speakeasy/gen.yaml @@ -30,7 +30,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false python: - version: 0.1.7 + version: 0.2.10 additionalDependencies: dev: {} main: {} diff --git a/others/python-sdk/README.md b/others/python-sdk/README.md index 8821dfd5c..41c2cb35c 100644 --- a/others/python-sdk/README.md +++ b/others/python-sdk/README.md @@ -205,20 +205,9 @@ with Autumn( ### [Customers](docs/sdks/customers/README.md) * [get_or_create](docs/sdks/customers/README.md#get_or_create) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` +* [list](docs/sdks/customers/README.md#list) - Lists customers with pagination and optional filters. +* [update](docs/sdks/customers/README.md#update) - Updates an existing customer by ID. +* [delete](docs/sdks/customers/README.md#delete) - Deletes a customer by ID. ### [Plans](docs/sdks/plans/README.md) diff --git a/others/python-sdk/docs/models/attachrequest.md b/others/python-sdk/docs/models/attachrequest.md index 5c70043e6..e87b55d57 100644 --- a/others/python-sdk/docs/models/attachrequest.md +++ b/others/python-sdk/docs/models/attachrequest.md @@ -5,6 +5,8 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `entity_data` | [Optional[models.EntityData]](../models/entitydata.md) | :heavy_minus_sign: | N/A | | `options` | List[[models.Options](../models/options.md)] | :heavy_minus_sign: | N/A | | `version` | *Optional[float]* | :heavy_minus_sign: | N/A | | `free_trial` | [OptionalNullable[models.AttachFreeTrial]](../models/attachfreetrial.md) | :heavy_minus_sign: | N/A | diff --git a/others/python-sdk/docs/models/attachresponse.md b/others/python-sdk/docs/models/attachresponse.md index 4bb1f2264..3f097944c 100644 --- a/others/python-sdk/docs/models/attachresponse.md +++ b/others/python-sdk/docs/models/attachresponse.md @@ -8,6 +8,7 @@ OK | Field | Type | Required | Description | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | | `customer_id` | *str* | :heavy_check_mark: | N/A | +| `entity_id` | *Optional[str]* | :heavy_minus_sign: | N/A | | `invoice` | [Optional[models.AttachInvoice]](../models/attachinvoice.md) | :heavy_minus_sign: | N/A | | `payment_url` | *Nullable[str]* | :heavy_check_mark: | N/A | | `required_action` | [Optional[models.RequiredAction]](../models/requiredaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/balances.md b/others/python-sdk/docs/models/balances.md index bf12416b0..dc522d990 100644 --- a/others/python-sdk/docs/models/balances.md +++ b/others/python-sdk/docs/models/balances.md @@ -3,15 +3,16 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -| `feature_id` | *str* | :heavy_check_mark: | N/A | -| `granted` | *float* | :heavy_check_mark: | N/A | -| `remaining` | *float* | :heavy_check_mark: | N/A | -| `usage` | *float* | :heavy_check_mark: | N/A | -| `unlimited` | *bool* | :heavy_check_mark: | N/A | -| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | -| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | -| `breakdown` | List[[models.Breakdown](../models/breakdown.md)] | :heavy_minus_sign: | N/A | -| `rollovers` | List[[models.CustomerRollover](../models/customerrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | N/A | +| `feature` | [Optional[models.CustomerFeature]](../models/customerfeature.md) | :heavy_minus_sign: | N/A | +| `granted` | *float* | :heavy_check_mark: | N/A | +| `remaining` | *float* | :heavy_check_mark: | N/A | +| `usage` | *float* | :heavy_check_mark: | N/A | +| `unlimited` | *bool* | :heavy_check_mark: | N/A | +| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `breakdown` | List[[models.Breakdown](../models/breakdown.md)] | :heavy_minus_sign: | N/A | +| `rollovers` | List[[models.CustomerRollover](../models/customerrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/breakdown.md b/others/python-sdk/docs/models/breakdown.md index 1a69f2b54..849ebfe99 100644 --- a/others/python-sdk/docs/models/breakdown.md +++ b/others/python-sdk/docs/models/breakdown.md @@ -5,6 +5,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | | `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | | `included_grant` | *float* | :heavy_check_mark: | N/A | | `prepaid_grant` | *float* | :heavy_check_mark: | N/A | diff --git a/others/python-sdk/docs/models/customer.md b/others/python-sdk/docs/models/customer.md index 3cd444dd5..778515408 100644 --- a/others/python-sdk/docs/models/customer.md +++ b/others/python-sdk/docs/models/customer.md @@ -5,8 +5,10 @@ | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Nullable[str]* | :heavy_check_mark: | Your unique identifier for the customer. | | `name` | *Nullable[str]* | :heavy_check_mark: | The name of the customer. | | `email` | *Nullable[str]* | :heavy_check_mark: | The email address of the customer. | +| `created_at` | *float* | :heavy_check_mark: | Timestamp of customer creation in milliseconds since epoch. | | `fingerprint` | *Nullable[str]* | :heavy_check_mark: | A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. | | `stripe_id` | *Nullable[str]* | :heavy_check_mark: | Stripe customer ID. | | `env` | [models.CustomerEnv](../models/customerenv.md) | :heavy_check_mark: | The environment this customer was created in. | diff --git a/others/python-sdk/docs/models/customerbalancestype.md b/others/python-sdk/docs/models/customerbalancestype.md new file mode 100644 index 000000000..3a9f63208 --- /dev/null +++ b/others/python-sdk/docs/models/customerbalancestype.md @@ -0,0 +1,10 @@ +# CustomerBalancesType + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `BOOLEAN` | boolean | +| `METERED` | metered | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customercreditschema.md b/others/python-sdk/docs/models/customercreditschema.md new file mode 100644 index 000000000..75a9cb56c --- /dev/null +++ b/others/python-sdk/docs/models/customercreditschema.md @@ -0,0 +1,9 @@ +# CustomerCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | N/A | +| `credit_cost` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customerdisplay.md b/others/python-sdk/docs/models/customerdisplay.md new file mode 100644 index 000000000..57b4acb9c --- /dev/null +++ b/others/python-sdk/docs/models/customerdisplay.md @@ -0,0 +1,9 @@ +# CustomerDisplay + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/customerfeature.md b/others/python-sdk/docs/models/customerfeature.md new file mode 100644 index 000000000..076eb6dc3 --- /dev/null +++ b/others/python-sdk/docs/models/customerfeature.md @@ -0,0 +1,15 @@ +# CustomerFeature + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | N/A | +| `name` | *str* | :heavy_check_mark: | N/A | +| `type` | [models.CustomerBalancesType](../models/customerbalancestype.md) | :heavy_check_mark: | N/A | +| `consumable` | *bool* | :heavy_check_mark: | N/A | +| `event_names` | List[*str*] | :heavy_minus_sign: | N/A | +| `credit_schema` | List[[models.CustomerCreditSchema](../models/customercreditschema.md)] | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.CustomerDisplay]](../models/customerdisplay.md) | :heavy_minus_sign: | N/A | +| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/interval.md b/others/python-sdk/docs/models/customerintervalunion.md similarity index 88% rename from others/python-sdk/docs/models/interval.md rename to others/python-sdk/docs/models/customerintervalunion.md index e07865e4e..7e9dd6d8a 100644 --- a/others/python-sdk/docs/models/interval.md +++ b/others/python-sdk/docs/models/customerintervalunion.md @@ -1,4 +1,4 @@ -# Interval +# CustomerIntervalUnion ## Supported Types diff --git a/others/python-sdk/docs/models/customerreset.md b/others/python-sdk/docs/models/customerreset.md index c789011c5..49409b4c0 100644 --- a/others/python-sdk/docs/models/customerreset.md +++ b/others/python-sdk/docs/models/customerreset.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| `interval` | [models.Interval](../models/interval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | -| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `interval` | [models.CustomerIntervalUnion](../models/customerintervalunion.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/deletecustomerglobals.md b/others/python-sdk/docs/models/deletecustomerglobals.md new file mode 100644 index 000000000..109883690 --- /dev/null +++ b/others/python-sdk/docs/models/deletecustomerglobals.md @@ -0,0 +1,8 @@ +# DeleteCustomerGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/deletecustomerparams.md b/others/python-sdk/docs/models/deletecustomerparams.md new file mode 100644 index 000000000..98072f7da --- /dev/null +++ b/others/python-sdk/docs/models/deletecustomerparams.md @@ -0,0 +1,9 @@ +# DeleteCustomerParams + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | ID of the customer to delete | +| `delete_in_stripe` | *Optional[bool]* | :heavy_minus_sign: | Whether to also delete the customer in Stripe | \ No newline at end of file diff --git a/others/python-sdk/docs/models/deletecustomerresponse.md b/others/python-sdk/docs/models/deletecustomerresponse.md new file mode 100644 index 000000000..7ab2e8a02 --- /dev/null +++ b/others/python-sdk/docs/models/deletecustomerresponse.md @@ -0,0 +1,10 @@ +# DeleteCustomerResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `success` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/discount.md b/others/python-sdk/docs/models/discount.md index 58e1eafe6..73273a9dc 100644 --- a/others/python-sdk/docs/models/discount.md +++ b/others/python-sdk/docs/models/discount.md @@ -5,8 +5,9 @@ | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | The unique identifier for this discount | | `name` | *str* | :heavy_check_mark: | The name of the discount or coupon | -| `type` | [models.Type](../models/type.md) | :heavy_check_mark: | The type of reward | +| `type` | [models.RewardsType](../models/rewardstype.md) | :heavy_check_mark: | The type of reward | | `discount_value` | *float* | :heavy_check_mark: | The discount value (percentage or fixed amount) | | `duration_type` | [models.CustomerDurationType](../models/customerdurationtype.md) | :heavy_check_mark: | How long the discount lasts | | `duration_value` | *OptionalNullable[float]* | :heavy_minus_sign: | Number of billing periods the discount applies for repeating durations | diff --git a/others/python-sdk/docs/models/entity.md b/others/python-sdk/docs/models/entity.md index 68e0ec50e..034cdb77a 100644 --- a/others/python-sdk/docs/models/entity.md +++ b/others/python-sdk/docs/models/entity.md @@ -5,7 +5,10 @@ | Field | Type | Required | Description | | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `autumn_id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `id` | *Nullable[str]* | :heavy_check_mark: | The unique identifier of the entity | | `name` | *Nullable[str]* | :heavy_check_mark: | The name of the entity | | `customer_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The customer ID this entity belongs to | | `feature_id` | *OptionalNullable[str]* | :heavy_minus_sign: | The feature ID this entity belongs to | +| `created_at` | *float* | :heavy_check_mark: | Unix timestamp when the entity was created | | `env` | [models.EntityEnv](../models/entityenv.md) | :heavy_check_mark: | The environment (sandbox/live) | \ No newline at end of file diff --git a/others/python-sdk/docs/models/entitydata.md b/others/python-sdk/docs/models/entitydata.md new file mode 100644 index 000000000..4d61fd061 --- /dev/null +++ b/others/python-sdk/docs/models/entitydata.md @@ -0,0 +1,9 @@ +# EntityData + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | The feature ID that this entity is associated with | +| `name` | *Optional[str]* | :heavy_minus_sign: | Name of the entity | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getorcreatecustomerglobals.md b/others/python-sdk/docs/models/getorcreatecustomerglobals.md new file mode 100644 index 000000000..4e9384d4f --- /dev/null +++ b/others/python-sdk/docs/models/getorcreatecustomerglobals.md @@ -0,0 +1,8 @@ +# GetOrCreateCustomerGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/invoice.md b/others/python-sdk/docs/models/invoice.md index a50ac0462..89d5fc51a 100644 --- a/others/python-sdk/docs/models/invoice.md +++ b/others/python-sdk/docs/models/invoice.md @@ -10,4 +10,5 @@ | `status` | *str* | :heavy_check_mark: | The status of the invoice | | `total` | *float* | :heavy_check_mark: | The total amount of the invoice | | `currency` | *str* | :heavy_check_mark: | The currency code for the invoice | +| `created_at` | *float* | :heavy_check_mark: | Timestamp when the invoice was created | | `hosted_invoice_url` | *OptionalNullable[str]* | :heavy_minus_sign: | URL to the Stripe-hosted invoice page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/item.md b/others/python-sdk/docs/models/item.md index 64761c2e9..d35ac8509 100644 --- a/others/python-sdk/docs/models/item.md +++ b/others/python-sdk/docs/models/item.md @@ -6,9 +6,11 @@ | Field | Type | Required | Description | | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | | `feature_id` | *str* | :heavy_check_mark: | N/A | +| `feature` | [Optional[models.PlanFeature]](../models/planfeature.md) | :heavy_minus_sign: | N/A | | `included` | *float* | :heavy_check_mark: | N/A | | `unlimited` | *bool* | :heavy_check_mark: | N/A | | `reset` | [Nullable[models.PlanReset]](../models/planreset.md) | :heavy_check_mark: | N/A | | `price` | [Nullable[models.ItemPrice]](../models/itemprice.md) | :heavy_check_mark: | N/A | +| `display` | [Optional[models.ItemDisplay]](../models/itemdisplay.md) | :heavy_minus_sign: | N/A | | `rollover` | [Optional[models.PlanRollover]](../models/planrollover.md) | :heavy_minus_sign: | N/A | | `proration` | [Optional[models.Proration]](../models/proration.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/itemdisplay.md b/others/python-sdk/docs/models/itemdisplay.md new file mode 100644 index 000000000..c6130de32 --- /dev/null +++ b/others/python-sdk/docs/models/itemdisplay.md @@ -0,0 +1,9 @@ +# ItemDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `primary_text` | *str* | :heavy_check_mark: | N/A | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/itemfeaturedisplay.md b/others/python-sdk/docs/models/itemfeaturedisplay.md new file mode 100644 index 000000000..3cdc943a7 --- /dev/null +++ b/others/python-sdk/docs/models/itemfeaturedisplay.md @@ -0,0 +1,9 @@ +# ItemFeatureDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *str* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *str* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersbalances.md b/others/python-sdk/docs/models/listcustomersbalances.md new file mode 100644 index 000000000..47ea14702 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersbalances.md @@ -0,0 +1,18 @@ +# ListCustomersBalances + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | N/A | +| `feature` | [Optional[models.ListCustomersFeature]](../models/listcustomersfeature.md) | :heavy_minus_sign: | N/A | +| `granted` | *float* | :heavy_check_mark: | N/A | +| `remaining` | *float* | :heavy_check_mark: | N/A | +| `usage` | *float* | :heavy_check_mark: | N/A | +| `unlimited` | *bool* | :heavy_check_mark: | N/A | +| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `breakdown` | List[[models.ListCustomersBreakdown](../models/listcustomersbreakdown.md)] | :heavy_minus_sign: | N/A | +| `rollovers` | List[[models.ListCustomersRollover](../models/listcustomersrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersbillingmethod.md b/others/python-sdk/docs/models/listcustomersbillingmethod.md new file mode 100644 index 000000000..d394f3fcb --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersbillingmethod.md @@ -0,0 +1,9 @@ +# ListCustomersBillingMethod + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersbreakdown.md b/others/python-sdk/docs/models/listcustomersbreakdown.md new file mode 100644 index 000000000..b41b3d433 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersbreakdown.md @@ -0,0 +1,17 @@ +# ListCustomersBreakdown + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | +| `included_grant` | *float* | :heavy_check_mark: | N/A | +| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | +| `remaining` | *float* | :heavy_check_mark: | N/A | +| `usage` | *float* | :heavy_check_mark: | N/A | +| `unlimited` | *bool* | :heavy_check_mark: | N/A | +| `reset` | [Nullable[models.ListCustomersReset]](../models/listcustomersreset.md) | :heavy_check_mark: | N/A | +| `price` | [Nullable[models.ListCustomersPrice]](../models/listcustomersprice.md) | :heavy_check_mark: | N/A | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerscreditschema.md b/others/python-sdk/docs/models/listcustomerscreditschema.md new file mode 100644 index 000000000..d886d2a65 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomerscreditschema.md @@ -0,0 +1,9 @@ +# ListCustomersCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | N/A | +| `credit_cost` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersdisplay.md b/others/python-sdk/docs/models/listcustomersdisplay.md new file mode 100644 index 000000000..ded4ae9ad --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersdisplay.md @@ -0,0 +1,9 @@ +# ListCustomersDisplay + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersenv.md b/others/python-sdk/docs/models/listcustomersenv.md new file mode 100644 index 000000000..750e1fe57 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersenv.md @@ -0,0 +1,11 @@ +# ListCustomersEnv + +The environment this customer was created in. + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersfeature.md b/others/python-sdk/docs/models/listcustomersfeature.md new file mode 100644 index 000000000..7b61528e5 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersfeature.md @@ -0,0 +1,15 @@ +# ListCustomersFeature + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | N/A | +| `name` | *str* | :heavy_check_mark: | N/A | +| `type` | [models.ListCustomersType](../models/listcustomerstype.md) | :heavy_check_mark: | N/A | +| `consumable` | *bool* | :heavy_check_mark: | N/A | +| `event_names` | List[*str*] | :heavy_minus_sign: | N/A | +| `credit_schema` | List[[models.ListCustomersCreditSchema](../models/listcustomerscreditschema.md)] | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.ListCustomersDisplay]](../models/listcustomersdisplay.md) | :heavy_minus_sign: | N/A | +| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/getorcreateglobals.md b/others/python-sdk/docs/models/listcustomersglobals.md similarity index 92% rename from others/python-sdk/docs/models/getorcreateglobals.md rename to others/python-sdk/docs/models/listcustomersglobals.md index 39abbf6e6..0c99ff068 100644 --- a/others/python-sdk/docs/models/getorcreateglobals.md +++ b/others/python-sdk/docs/models/listcustomersglobals.md @@ -1,4 +1,4 @@ -# GetOrCreateGlobals +# ListCustomersGlobals ## Fields diff --git a/others/python-sdk/docs/models/listcustomersintervalenum.md b/others/python-sdk/docs/models/listcustomersintervalenum.md new file mode 100644 index 000000000..29ccd27c9 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersintervalenum.md @@ -0,0 +1,16 @@ +# ListCustomersIntervalEnum + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersintervalunion.md b/others/python-sdk/docs/models/listcustomersintervalunion.md new file mode 100644 index 000000000..b2c4f91d3 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersintervalunion.md @@ -0,0 +1,17 @@ +# ListCustomersIntervalUnion + + +## Supported Types + +### `models.ListCustomersIntervalEnum` + +```python +value: models.ListCustomersIntervalEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/listcustomersparams.md b/others/python-sdk/docs/models/listcustomersparams.md new file mode 100644 index 000000000..905ccc5f0 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersparams.md @@ -0,0 +1,12 @@ +# ListCustomersParams + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `offset` | *Optional[int]* | :heavy_minus_sign: | Number of items to skip | +| `limit` | *Optional[int]* | :heavy_minus_sign: | Number of items to return. Default 10, max 1000. | +| `plans` | List[[models.ListCustomersPlan](../models/listcustomersplan.md)] | :heavy_minus_sign: | Filter by plan ID and version. Returns customers with active subscriptions to this plan. | +| `subscription_status` | [Optional[models.SubscriptionStatus]](../models/subscriptionstatus.md) | :heavy_minus_sign: | Filter by customer product status. Defaults to active and scheduled | +| `search` | *Optional[str]* | :heavy_minus_sign: | Search customers by id, name, or email | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersplan.md b/others/python-sdk/docs/models/listcustomersplan.md new file mode 100644 index 000000000..f2d4ab71e --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersplan.md @@ -0,0 +1,9 @@ +# ListCustomersPlan + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *str* | :heavy_check_mark: | N/A | +| `versions` | List[*float*] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersprice.md b/others/python-sdk/docs/models/listcustomersprice.md new file mode 100644 index 000000000..11660aa4e --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersprice.md @@ -0,0 +1,12 @@ +# ListCustomersPrice + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `tiers` | List[[models.ListCustomersTier](../models/listcustomerstier.md)] | :heavy_minus_sign: | N/A | +| `billing_units` | *float* | :heavy_check_mark: | N/A | +| `billing_method` | [models.ListCustomersBillingMethod](../models/listcustomersbillingmethod.md) | :heavy_check_mark: | N/A | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerspurchase.md b/others/python-sdk/docs/models/listcustomerspurchase.md new file mode 100644 index 000000000..ba47d94a1 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomerspurchase.md @@ -0,0 +1,12 @@ +# ListCustomersPurchase + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | N/A | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `started_at` | *float* | :heavy_check_mark: | N/A | +| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersreset.md b/others/python-sdk/docs/models/listcustomersreset.md new file mode 100644 index 000000000..032f8c8d4 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersreset.md @@ -0,0 +1,10 @@ +# ListCustomersReset + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `interval` | [models.ListCustomersIntervalUnion](../models/listcustomersintervalunion.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersresponse.md b/others/python-sdk/docs/models/listcustomersresponse.md new file mode 100644 index 000000000..4d7bbf3ef --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersresponse.md @@ -0,0 +1,14 @@ +# ListCustomersResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `list` | List[[models.ListT](../models/listt.md)] | :heavy_check_mark: | Array of items for current page | +| `has_more` | *bool* | :heavy_check_mark: | Whether more results exist after this page | +| `offset` | *float* | :heavy_check_mark: | Current offset position | +| `limit` | *float* | :heavy_check_mark: | Limit passed in the request | +| `total` | *float* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersrollover.md b/others/python-sdk/docs/models/listcustomersrollover.md new file mode 100644 index 000000000..01463f0ef --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersrollover.md @@ -0,0 +1,9 @@ +# ListCustomersRollover + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `balance` | *float* | :heavy_check_mark: | N/A | +| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomersstatus.md b/others/python-sdk/docs/models/listcustomersstatus.md new file mode 100644 index 000000000..06b87554d --- /dev/null +++ b/others/python-sdk/docs/models/listcustomersstatus.md @@ -0,0 +1,10 @@ +# ListCustomersStatus + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ACTIVE` | active | +| `SCHEDULED` | scheduled | +| `EXPIRED` | expired | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerssubscription.md b/others/python-sdk/docs/models/listcustomerssubscription.md new file mode 100644 index 000000000..40294b3c6 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomerssubscription.md @@ -0,0 +1,20 @@ +# ListCustomersSubscription + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | N/A | +| `auto_enable` | *bool* | :heavy_check_mark: | N/A | +| `add_on` | *bool* | :heavy_check_mark: | N/A | +| `status` | [models.ListCustomersStatus](../models/listcustomersstatus.md) | :heavy_check_mark: | N/A | +| `past_due` | *bool* | :heavy_check_mark: | N/A | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `started_at` | *float* | :heavy_check_mark: | N/A | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerstier.md b/others/python-sdk/docs/models/listcustomerstier.md new file mode 100644 index 000000000..870585501 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomerstier.md @@ -0,0 +1,9 @@ +# ListCustomersTier + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `to` | *Optional[Any]* | :heavy_minus_sign: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listcustomerstype.md b/others/python-sdk/docs/models/listcustomerstype.md new file mode 100644 index 000000000..7d759dbd6 --- /dev/null +++ b/others/python-sdk/docs/models/listcustomerstype.md @@ -0,0 +1,10 @@ +# ListCustomersType + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `BOOLEAN` | boolean | +| `METERED` | metered | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/listt.md b/others/python-sdk/docs/models/listt.md new file mode 100644 index 000000000..f9761f758 --- /dev/null +++ b/others/python-sdk/docs/models/listt.md @@ -0,0 +1,19 @@ +# ListT + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Nullable[str]* | :heavy_check_mark: | Your unique identifier for the customer. | +| `name` | *Nullable[str]* | :heavy_check_mark: | The name of the customer. | +| `email` | *Nullable[str]* | :heavy_check_mark: | The email address of the customer. | +| `created_at` | *float* | :heavy_check_mark: | Timestamp of customer creation in milliseconds since epoch. | +| `fingerprint` | *Nullable[str]* | :heavy_check_mark: | A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. | +| `stripe_id` | *Nullable[str]* | :heavy_check_mark: | Stripe customer ID. | +| `env` | [models.ListCustomersEnv](../models/listcustomersenv.md) | :heavy_check_mark: | The environment this customer was created in. | +| `metadata` | Dict[str, *Any*] | :heavy_check_mark: | The metadata for the customer. | +| `send_email_receipts` | *bool* | :heavy_check_mark: | Whether to send email receipts to the customer. | +| `subscriptions` | List[[models.ListCustomersSubscription](../models/listcustomerssubscription.md)] | :heavy_check_mark: | N/A | +| `purchases` | List[[models.ListCustomersPurchase](../models/listcustomerspurchase.md)] | :heavy_check_mark: | N/A | +| `balances` | Dict[str, [models.ListCustomersBalances](../models/listcustomersbalances.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/plan.md b/others/python-sdk/docs/models/plan.md index 2ca3f0581..e57ad9041 100644 --- a/others/python-sdk/docs/models/plan.md +++ b/others/python-sdk/docs/models/plan.md @@ -5,6 +5,7 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | N/A | | `name` | *str* | :heavy_check_mark: | N/A | | `description` | *Nullable[str]* | :heavy_check_mark: | N/A | | `group` | *Nullable[str]* | :heavy_check_mark: | N/A | @@ -14,6 +15,7 @@ | `price` | [Nullable[models.PlanPrice]](../models/planprice.md) | :heavy_check_mark: | N/A | | `items` | List[[models.Item](../models/item.md)] | :heavy_check_mark: | N/A | | `free_trial` | [Optional[models.FreeTrial]](../models/freetrial.md) | :heavy_minus_sign: | N/A | +| `created_at` | *float* | :heavy_check_mark: | N/A | | `env` | [models.PlanEnv](../models/planenv.md) | :heavy_check_mark: | N/A | | `archived` | *bool* | :heavy_check_mark: | N/A | | `base_variant_id` | *Nullable[str]* | :heavy_check_mark: | N/A | diff --git a/others/python-sdk/docs/models/plancreditschema.md b/others/python-sdk/docs/models/plancreditschema.md new file mode 100644 index 000000000..bcf7cd000 --- /dev/null +++ b/others/python-sdk/docs/models/plancreditschema.md @@ -0,0 +1,9 @@ +# PlanCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `credit_cost` | *float* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planfeature.md b/others/python-sdk/docs/models/planfeature.md new file mode 100644 index 000000000..150519646 --- /dev/null +++ b/others/python-sdk/docs/models/planfeature.md @@ -0,0 +1,13 @@ +# PlanFeature + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *str* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.PlanType](../models/plantype.md) | :heavy_check_mark: | The type of the feature | +| `display` | [OptionalNullable[models.ItemFeatureDisplay]](../models/itemfeaturedisplay.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `credit_schema` | List[[models.PlanCreditSchema](../models/plancreditschema.md)] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *OptionalNullable[bool]* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/others/python-sdk/docs/models/planprice.md b/others/python-sdk/docs/models/planprice.md index ad2a83713..c1df13940 100644 --- a/others/python-sdk/docs/models/planprice.md +++ b/others/python-sdk/docs/models/planprice.md @@ -3,8 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `amount` | *float* | :heavy_check_mark: | N/A | -| `interval` | [models.PriceInterval](../models/priceinterval.md) | :heavy_check_mark: | N/A | -| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `amount` | *float* | :heavy_check_mark: | N/A | +| `interval` | [models.PriceInterval](../models/priceinterval.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.PriceDisplay]](../models/pricedisplay.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/plantype.md b/others/python-sdk/docs/models/plantype.md new file mode 100644 index 000000000..cf233509e --- /dev/null +++ b/others/python-sdk/docs/models/plantype.md @@ -0,0 +1,14 @@ +# PlanType + +The type of the feature + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `STATIC` | static | +| `BOOLEAN` | boolean | +| `SINGLE_USE` | single_use | +| `CONTINUOUS_USE` | continuous_use | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/models/pricedisplay.md b/others/python-sdk/docs/models/pricedisplay.md new file mode 100644 index 000000000..5af13ee5d --- /dev/null +++ b/others/python-sdk/docs/models/pricedisplay.md @@ -0,0 +1,9 @@ +# PriceDisplay + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `primary_text` | *str* | :heavy_check_mark: | N/A | +| `secondary_text` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/referral.md b/others/python-sdk/docs/models/referral.md index 8a192f999..f9a88e2c2 100644 --- a/others/python-sdk/docs/models/referral.md +++ b/others/python-sdk/docs/models/referral.md @@ -7,4 +7,5 @@ | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | `program_id` | *str* | :heavy_check_mark: | N/A | | `customer` | [models.ReferralCustomer](../models/referralcustomer.md) | :heavy_check_mark: | N/A | -| `reward_applied` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file +| `reward_applied` | *bool* | :heavy_check_mark: | N/A | +| `created_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/referralcustomer.md b/others/python-sdk/docs/models/referralcustomer.md index da8b2e17f..8cad0f99c 100644 --- a/others/python-sdk/docs/models/referralcustomer.md +++ b/others/python-sdk/docs/models/referralcustomer.md @@ -5,5 +5,6 @@ | Field | Type | Required | Description | | ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `id` | *str* | :heavy_check_mark: | N/A | | `name` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | | `email` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/type.md b/others/python-sdk/docs/models/rewardstype.md similarity index 95% rename from others/python-sdk/docs/models/type.md rename to others/python-sdk/docs/models/rewardstype.md index 7af50db5c..e3e5b0cff 100644 --- a/others/python-sdk/docs/models/type.md +++ b/others/python-sdk/docs/models/rewardstype.md @@ -1,4 +1,4 @@ -# Type +# RewardsType The type of reward diff --git a/others/python-sdk/docs/models/subscriptionstatus.md b/others/python-sdk/docs/models/subscriptionstatus.md new file mode 100644 index 000000000..6751a7686 --- /dev/null +++ b/others/python-sdk/docs/models/subscriptionstatus.md @@ -0,0 +1,11 @@ +# SubscriptionStatus + +Filter by customer product status. Defaults to active and scheduled + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ACTIVE` | active | +| `SCHEDULED` | scheduled | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerbalances.md b/others/python-sdk/docs/models/updatecustomerbalances.md new file mode 100644 index 000000000..273486f9e --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerbalances.md @@ -0,0 +1,18 @@ +# UpdateCustomerBalances + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `feature_id` | *str* | :heavy_check_mark: | N/A | +| `feature` | [Optional[models.UpdateCustomerFeature]](../models/updatecustomerfeature.md) | :heavy_minus_sign: | N/A | +| `granted` | *float* | :heavy_check_mark: | N/A | +| `remaining` | *float* | :heavy_check_mark: | N/A | +| `usage` | *float* | :heavy_check_mark: | N/A | +| `unlimited` | *bool* | :heavy_check_mark: | N/A | +| `overage_allowed` | *bool* | :heavy_check_mark: | N/A | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `next_reset_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `breakdown` | List[[models.UpdateCustomerBreakdown](../models/updatecustomerbreakdown.md)] | :heavy_minus_sign: | N/A | +| `rollovers` | List[[models.UpdateCustomerRollover](../models/updatecustomerrollover.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerbillingmethod.md b/others/python-sdk/docs/models/updatecustomerbillingmethod.md new file mode 100644 index 000000000..175ceae8f --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerbillingmethod.md @@ -0,0 +1,9 @@ +# UpdateCustomerBillingMethod + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `PREPAID` | prepaid | +| `USAGE_BASED` | usage_based | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerbreakdown.md b/others/python-sdk/docs/models/updatecustomerbreakdown.md new file mode 100644 index 000000000..0a5f66612 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerbreakdown.md @@ -0,0 +1,17 @@ +# UpdateCustomerBreakdown + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `id` | *Optional[str]* | :heavy_minus_sign: | N/A | +| `plan_id` | *Nullable[str]* | :heavy_check_mark: | N/A | +| `included_grant` | *float* | :heavy_check_mark: | N/A | +| `prepaid_grant` | *float* | :heavy_check_mark: | N/A | +| `remaining` | *float* | :heavy_check_mark: | N/A | +| `usage` | *float* | :heavy_check_mark: | N/A | +| `unlimited` | *bool* | :heavy_check_mark: | N/A | +| `reset` | [Nullable[models.UpdateCustomerReset]](../models/updatecustomerreset.md) | :heavy_check_mark: | N/A | +| `price` | [Nullable[models.UpdateCustomerPrice]](../models/updatecustomerprice.md) | :heavy_check_mark: | N/A | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomercreditschema.md b/others/python-sdk/docs/models/updatecustomercreditschema.md new file mode 100644 index 000000000..67fcfec84 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomercreditschema.md @@ -0,0 +1,9 @@ +# UpdateCustomerCreditSchema + + +## Fields + +| Field | Type | Required | Description | +| -------------------- | -------------------- | -------------------- | -------------------- | +| `metered_feature_id` | *str* | :heavy_check_mark: | N/A | +| `credit_cost` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerdisplay.md b/others/python-sdk/docs/models/updatecustomerdisplay.md new file mode 100644 index 000000000..0fee459c9 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerdisplay.md @@ -0,0 +1,9 @@ +# UpdateCustomerDisplay + + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `singular` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `plural` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerenv.md b/others/python-sdk/docs/models/updatecustomerenv.md new file mode 100644 index 000000000..93eb528d8 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerenv.md @@ -0,0 +1,11 @@ +# UpdateCustomerEnv + +The environment this customer was created in. + + +## Values + +| Name | Value | +| --------- | --------- | +| `SANDBOX` | sandbox | +| `LIVE` | live | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerfeature.md b/others/python-sdk/docs/models/updatecustomerfeature.md new file mode 100644 index 000000000..773fbeb9e --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerfeature.md @@ -0,0 +1,15 @@ +# UpdateCustomerFeature + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `id` | *str* | :heavy_check_mark: | N/A | +| `name` | *str* | :heavy_check_mark: | N/A | +| `type` | [models.UpdateCustomerType](../models/updatecustomertype.md) | :heavy_check_mark: | N/A | +| `consumable` | *bool* | :heavy_check_mark: | N/A | +| `event_names` | List[*str*] | :heavy_minus_sign: | N/A | +| `credit_schema` | List[[models.UpdateCustomerCreditSchema](../models/updatecustomercreditschema.md)] | :heavy_minus_sign: | N/A | +| `display` | [Optional[models.UpdateCustomerDisplay]](../models/updatecustomerdisplay.md) | :heavy_minus_sign: | N/A | +| `archived` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerglobals.md b/others/python-sdk/docs/models/updatecustomerglobals.md new file mode 100644 index 000000000..5010263b0 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerglobals.md @@ -0,0 +1,8 @@ +# UpdateCustomerGlobals + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `x_api_version` | *Optional[str]* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerintervalenum.md b/others/python-sdk/docs/models/updatecustomerintervalenum.md new file mode 100644 index 000000000..691fcd18c --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerintervalenum.md @@ -0,0 +1,16 @@ +# UpdateCustomerIntervalEnum + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `ONE_OFF` | one_off | +| `MINUTE` | minute | +| `HOUR` | hour | +| `DAY` | day | +| `WEEK` | week | +| `MONTH` | month | +| `QUARTER` | quarter | +| `SEMI_ANNUAL` | semi_annual | +| `YEAR` | year | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerintervalunion.md b/others/python-sdk/docs/models/updatecustomerintervalunion.md new file mode 100644 index 000000000..c47a47e06 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerintervalunion.md @@ -0,0 +1,17 @@ +# UpdateCustomerIntervalUnion + + +## Supported Types + +### `models.UpdateCustomerIntervalEnum` + +```python +value: models.UpdateCustomerIntervalEnum = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/updatecustomerparams.md b/others/python-sdk/docs/models/updatecustomerparams.md new file mode 100644 index 000000000..9f4d5f96f --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerparams.md @@ -0,0 +1,15 @@ +# UpdateCustomerParams + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | ID of the customer to update | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Customer's name | +| `email` | *OptionalNullable[str]* | :heavy_minus_sign: | Customer's email address | +| `fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse | +| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Additional metadata for the customer | +| `stripe_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Stripe customer ID if you already have one | +| `send_email_receipts` | *Optional[bool]* | :heavy_minus_sign: | Whether to send email receipts to this customer | +| `new_customer_id` | *Optional[str]* | :heavy_minus_sign: | Your unique identifier for the customer | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerprice.md b/others/python-sdk/docs/models/updatecustomerprice.md new file mode 100644 index 000000000..073a0ccc1 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerprice.md @@ -0,0 +1,12 @@ +# UpdateCustomerPrice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `amount` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `tiers` | List[[models.UpdateCustomerTier](../models/updatecustomertier.md)] | :heavy_minus_sign: | N/A | +| `billing_units` | *float* | :heavy_check_mark: | N/A | +| `billing_method` | [models.UpdateCustomerBillingMethod](../models/updatecustomerbillingmethod.md) | :heavy_check_mark: | N/A | +| `max_purchase` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerpurchase.md b/others/python-sdk/docs/models/updatecustomerpurchase.md new file mode 100644 index 000000000..0e7ac3b22 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerpurchase.md @@ -0,0 +1,12 @@ +# UpdateCustomerPurchase + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | N/A | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `started_at` | *float* | :heavy_check_mark: | N/A | +| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerreset.md b/others/python-sdk/docs/models/updatecustomerreset.md new file mode 100644 index 000000000..ff27d3a15 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerreset.md @@ -0,0 +1,10 @@ +# UpdateCustomerReset + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `interval` | [models.UpdateCustomerIntervalUnion](../models/updatecustomerintervalunion.md) | :heavy_check_mark: | N/A | +| `interval_count` | *Optional[float]* | :heavy_minus_sign: | N/A | +| `resets_at` | *Nullable[float]* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerresponse.md b/others/python-sdk/docs/models/updatecustomerresponse.md new file mode 100644 index 000000000..655453dd0 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerresponse.md @@ -0,0 +1,21 @@ +# UpdateCustomerResponse + +OK + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `id` | *Nullable[str]* | :heavy_check_mark: | Your unique identifier for the customer. | +| `name` | *Nullable[str]* | :heavy_check_mark: | The name of the customer. | +| `email` | *Nullable[str]* | :heavy_check_mark: | The email address of the customer. | +| `created_at` | *float* | :heavy_check_mark: | Timestamp of customer creation in milliseconds since epoch. | +| `fingerprint` | *Nullable[str]* | :heavy_check_mark: | A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. | +| `stripe_id` | *Nullable[str]* | :heavy_check_mark: | Stripe customer ID. | +| `env` | [models.UpdateCustomerEnv](../models/updatecustomerenv.md) | :heavy_check_mark: | The environment this customer was created in. | +| `metadata` | Dict[str, *Any*] | :heavy_check_mark: | The metadata for the customer. | +| `send_email_receipts` | *bool* | :heavy_check_mark: | Whether to send email receipts to the customer. | +| `subscriptions` | List[[models.UpdateCustomerSubscription](../models/updatecustomersubscription.md)] | :heavy_check_mark: | N/A | +| `purchases` | List[[models.UpdateCustomerPurchase](../models/updatecustomerpurchase.md)] | :heavy_check_mark: | N/A | +| `balances` | Dict[str, [models.UpdateCustomerBalances](../models/updatecustomerbalances.md)] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerrollover.md b/others/python-sdk/docs/models/updatecustomerrollover.md new file mode 100644 index 000000000..af07f81be --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerrollover.md @@ -0,0 +1,9 @@ +# UpdateCustomerRollover + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `balance` | *float* | :heavy_check_mark: | N/A | +| `expires_at` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerstatus.md b/others/python-sdk/docs/models/updatecustomerstatus.md new file mode 100644 index 000000000..09097d659 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerstatus.md @@ -0,0 +1,10 @@ +# UpdateCustomerStatus + + +## Values + +| Name | Value | +| ----------- | ----------- | +| `ACTIVE` | active | +| `SCHEDULED` | scheduled | +| `EXPIRED` | expired | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomersubscription.md b/others/python-sdk/docs/models/updatecustomersubscription.md new file mode 100644 index 000000000..a09e306f9 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomersubscription.md @@ -0,0 +1,20 @@ +# UpdateCustomerSubscription + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `plan` | [Optional[models.Plan]](../models/plan.md) | :heavy_minus_sign: | N/A | +| `plan_id` | *str* | :heavy_check_mark: | N/A | +| `auto_enable` | *bool* | :heavy_check_mark: | N/A | +| `add_on` | *bool* | :heavy_check_mark: | N/A | +| `status` | [models.UpdateCustomerStatus](../models/updatecustomerstatus.md) | :heavy_check_mark: | N/A | +| `past_due` | *bool* | :heavy_check_mark: | N/A | +| `canceled_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `expires_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `trial_ends_at` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `started_at` | *float* | :heavy_check_mark: | N/A | +| `current_period_start` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `current_period_end` | *Nullable[float]* | :heavy_check_mark: | N/A | +| `quantity` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomertier.md b/others/python-sdk/docs/models/updatecustomertier.md new file mode 100644 index 000000000..a66e4f518 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomertier.md @@ -0,0 +1,9 @@ +# UpdateCustomerTier + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `to` | [models.UpdateCustomerTo](../models/updatecustomerto.md) | :heavy_check_mark: | N/A | +| `amount` | *float* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/others/python-sdk/docs/models/updatecustomerto.md b/others/python-sdk/docs/models/updatecustomerto.md new file mode 100644 index 000000000..41f217150 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomerto.md @@ -0,0 +1,17 @@ +# UpdateCustomerTo + + +## Supported Types + +### `float` + +```python +value: float = /* values here */ +``` + +### `str` + +```python +value: str = /* values here */ +``` + diff --git a/others/python-sdk/docs/models/updatecustomertype.md b/others/python-sdk/docs/models/updatecustomertype.md new file mode 100644 index 000000000..67da276b5 --- /dev/null +++ b/others/python-sdk/docs/models/updatecustomertype.md @@ -0,0 +1,10 @@ +# UpdateCustomerType + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `BOOLEAN` | boolean | +| `METERED` | metered | +| `CREDIT_SYSTEM` | credit_system | \ No newline at end of file diff --git a/others/python-sdk/docs/sdks/billing/README.md b/others/python-sdk/docs/sdks/billing/README.md index f9f02df10..3c06cfed8 100644 --- a/others/python-sdk/docs/sdks/billing/README.md +++ b/others/python-sdk/docs/sdks/billing/README.md @@ -32,6 +32,8 @@ with Autumn( | Parameter | Type | Required | Description | | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | `product_id` | *str* | :heavy_check_mark: | N/A | +| `entity_id` | *OptionalNullable[str]* | :heavy_minus_sign: | N/A | +| `entity_data` | [Optional[models.EntityData]](../../models/entitydata.md) | :heavy_minus_sign: | N/A | | `options` | List[[models.Options](../../models/options.md)] | :heavy_minus_sign: | N/A | | `version` | *Optional[float]* | :heavy_minus_sign: | N/A | | `free_trial` | [OptionalNullable[models.AttachFreeTrial]](../../models/attachfreetrial.md) | :heavy_minus_sign: | N/A | diff --git a/others/python-sdk/docs/sdks/customers/README.md b/others/python-sdk/docs/sdks/customers/README.md index 0a3f98c0f..c158c181f 100644 --- a/others/python-sdk/docs/sdks/customers/README.md +++ b/others/python-sdk/docs/sdks/customers/README.md @@ -5,42 +5,17 @@ ### Available Operations * [get_or_create](#get_or_create) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` +* [list](#list) - Lists customers with pagination and optional filters. +* [update](#update) - Updates an existing customer by ID. +* [delete](#delete) - Deletes a customer by ID. ## get_or_create Creates a customer if they do not exist, or returns the existing customer by your external customer ID. -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` - ### Example Usage - + ```python from autumn_sdk import Autumn @@ -79,6 +54,134 @@ with Autumn( ### Errors +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## list + +Lists customers with pagination and optional filters. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.customers.list(request={}) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `request` | [models.ListCustomersParams](../../models/listcustomersparams.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 + +**[models.ListCustomersResponse](../../models/listcustomersresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## update + +Updates an existing customer by ID. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.customers.update(customer_id="cus_123", name="Jane Doe", email="jane@example.com") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `customer_id` | *str* | :heavy_check_mark: | ID of the customer to update | +| `name` | *OptionalNullable[str]* | :heavy_minus_sign: | Customer's name | +| `email` | *OptionalNullable[str]* | :heavy_minus_sign: | Customer's email address | +| `fingerprint` | *OptionalNullable[str]* | :heavy_minus_sign: | Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse | +| `metadata` | Dict[str, *Any*] | :heavy_minus_sign: | Additional metadata for the customer | +| `stripe_id` | *OptionalNullable[str]* | :heavy_minus_sign: | Stripe customer ID if you already have one | +| `send_email_receipts` | *Optional[bool]* | :heavy_minus_sign: | Whether to send email receipts to this customer | +| `new_customer_id` | *Optional[str]* | :heavy_minus_sign: | Your unique identifier for the customer | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.UpdateCustomerResponse](../../models/updatecustomerresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| errors.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Deletes a customer by ID. + +### Example Usage + + +```python +from autumn_sdk import Autumn + + +with Autumn( + x_api_version="2.1", + secret_key="", +) as autumn: + + res = autumn.customers.delete(customer_id="cus_123", delete_in_stripe=False) + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `customer_id` | *str* | :heavy_check_mark: | ID of the customer to delete | +| `delete_in_stripe` | *Optional[bool]* | :heavy_minus_sign: | Whether to also delete the customer in Stripe | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | + +### Response + +**[models.DeleteCustomerResponse](../../models/deletecustomerresponse.md)** + +### Errors + | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | errors.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/others/python-sdk/pylintrc b/others/python-sdk/pylintrc index 58d705283..f13c2fb55 100644 --- a/others/python-sdk/pylintrc +++ b/others/python-sdk/pylintrc @@ -188,6 +188,7 @@ good-names=i, Run, _, e, + id, to # Good variable names regexes, separated by a comma. If names match any regex, diff --git a/others/python-sdk/pyproject.toml b/others/python-sdk/pyproject.toml index a05c06c14..65746bfc8 100644 --- a/others/python-sdk/pyproject.toml +++ b/others/python-sdk/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "autumn-sdk" -version = "0.1.7" +version = "0.2.10" description = "Python SDK for the Autumn billing API" authors = [{ name = "Autumn" },] readme = "README.md" diff --git a/others/python-sdk/src/autumn_sdk/_version.py b/others/python-sdk/src/autumn_sdk/_version.py index 1491b5fb6..02aea602c 100644 --- a/others/python-sdk/src/autumn_sdk/_version.py +++ b/others/python-sdk/src/autumn_sdk/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "autumn-sdk" -__version__: str = "0.1.7" +__version__: str = "0.2.10" __openapi_doc_version__: str = "2.1.0" __gen_version__: str = "2.824.1" -__user_agent__: str = "speakeasy-sdk/python 0.1.7 2.824.1 2.1.0 autumn-sdk" +__user_agent__: str = "speakeasy-sdk/python 0.2.10 2.824.1 2.1.0 autumn-sdk" try: if __package__ is not None: diff --git a/others/python-sdk/src/autumn_sdk/billing.py b/others/python-sdk/src/autumn_sdk/billing.py index 09ec0b7c2..6b2b9d3fe 100644 --- a/others/python-sdk/src/autumn_sdk/billing.py +++ b/others/python-sdk/src/autumn_sdk/billing.py @@ -13,6 +13,10 @@ class Billing(BaseSDK): self, *, product_id: str, + entity_id: OptionalNullable[str] = UNSET, + entity_data: Optional[ + Union[models.EntityData, models.EntityDataTypedDict] + ] = None, options: OptionalNullable[ Union[List[models.Options], List[models.OptionsTypedDict]] ] = UNSET, @@ -39,6 +43,8 @@ class Billing(BaseSDK): ) -> models.AttachResponse: r""" :param product_id: + :param entity_id: + :param entity_data: :param options: :param version: :param free_trial: @@ -68,6 +74,10 @@ class Billing(BaseSDK): base_url = self._get_url(base_url, url_variables) request = models.AttachRequest( + entity_id=entity_id, + entity_data=utils.get_pydantic_model( + entity_data, Optional[models.EntityData] + ), options=utils.get_pydantic_model( options, OptionalNullable[List[models.Options]] ), @@ -151,6 +161,10 @@ class Billing(BaseSDK): self, *, product_id: str, + entity_id: OptionalNullable[str] = UNSET, + entity_data: Optional[ + Union[models.EntityData, models.EntityDataTypedDict] + ] = None, options: OptionalNullable[ Union[List[models.Options], List[models.OptionsTypedDict]] ] = UNSET, @@ -177,6 +191,8 @@ class Billing(BaseSDK): ) -> models.AttachResponse: r""" :param product_id: + :param entity_id: + :param entity_data: :param options: :param version: :param free_trial: @@ -206,6 +222,10 @@ class Billing(BaseSDK): base_url = self._get_url(base_url, url_variables) request = models.AttachRequest( + entity_id=entity_id, + entity_data=utils.get_pydantic_model( + entity_data, Optional[models.EntityData] + ), options=utils.get_pydantic_model( options, OptionalNullable[List[models.Options]] ), diff --git a/others/python-sdk/src/autumn_sdk/customers.py b/others/python-sdk/src/autumn_sdk/customers.py index eae96197b..88e2f9151 100644 --- a/others/python-sdk/src/autumn_sdk/customers.py +++ b/others/python-sdk/src/autumn_sdk/customers.py @@ -3,9 +3,9 @@ from .basesdk import BaseSDK from autumn_sdk import errors, models, utils from autumn_sdk._hooks import HookContext -from autumn_sdk.types import Nullable, OptionalNullable, UNSET +from autumn_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET from autumn_sdk.utils.unmarshal_json_response import unmarshal_json_response -from typing import Any, Dict, List, Mapping, Optional +from typing import Any, Dict, List, Mapping, Optional, Union, cast class Customers(BaseSDK): @@ -29,20 +29,6 @@ class Customers(BaseSDK): ) -> models.Customer: r"""Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - - @example - ```typescript - // Create or fetch a customer by external ID - const response = await client.getOrCreate({ - - - \"id\": \"cus_123\", - \"name\": \"John Doe\", - \"email\": \"john@example.com\" - }); - ``` - :param customer_id: :param name: Customer's name :param email: Customer's email address @@ -93,7 +79,7 @@ class Customers(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.GetOrCreateGlobals( + _globals=models.GetOrCreateCustomerGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, @@ -116,7 +102,7 @@ class Customers(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="getOrCreate", + operation_id="getOrCreateCustomer", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -160,20 +146,6 @@ class Customers(BaseSDK): ) -> models.Customer: r"""Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - - @example - ```typescript - // Create or fetch a customer by external ID - const response = await client.getOrCreate({ - - - \"id\": \"cus_123\", - \"name\": \"John Doe\", - \"email\": \"john@example.com\" - }); - ``` - :param customer_id: :param name: Customer's name :param email: Customer's email address @@ -224,7 +196,7 @@ class Customers(BaseSDK): user_agent_header="user-agent", accept_header_value="application/json", http_headers=http_headers, - _globals=models.GetOrCreateGlobals( + _globals=models.GetOrCreateCustomerGlobals( x_api_version=self.sdk_configuration.globals.x_api_version, ), security=self.sdk_configuration.security, @@ -247,7 +219,7 @@ class Customers(BaseSDK): hook_ctx=HookContext( config=self.sdk_configuration, base_url=base_url or "", - operation_id="getOrCreate", + operation_id="getOrCreateCustomer", oauth2_scopes=None, security_source=self.sdk_configuration.security, ), @@ -270,3 +242,595 @@ class Customers(BaseSDK): ) raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def list( + self, + *, + request: Optional[ + Union[models.ListCustomersParams, models.ListCustomersParamsTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.ListCustomersResponse: + r"""Lists customers with pagination and optional filters. + + :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, Optional[models.ListCustomersParams]) + request = cast(Optional[models.ListCustomersParams], request) + + req = self._build_request( + method="POST", + path="/v1/customers.list", + 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, + _globals=models.ListCustomersGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, True, "json", Optional[models.ListCustomersParams] + ), + allow_empty_value=None, + 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="listCustomers", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.ListCustomersResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "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 errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def list_async( + self, + *, + request: Optional[ + Union[models.ListCustomersParams, models.ListCustomersParamsTypedDict] + ] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.ListCustomersResponse: + r"""Lists customers with pagination and optional filters. + + :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, Optional[models.ListCustomersParams]) + request = cast(Optional[models.ListCustomersParams], request) + + req = self._build_request_async( + method="POST", + path="/v1/customers.list", + 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, + _globals=models.ListCustomersGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, True, "json", Optional[models.ListCustomersParams] + ), + allow_empty_value=None, + 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="listCustomers", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.ListCustomersResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "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 errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def update( + self, + *, + customer_id: str, + name: OptionalNullable[str] = UNSET, + email: OptionalNullable[str] = UNSET, + fingerprint: OptionalNullable[str] = UNSET, + metadata: OptionalNullable[Dict[str, Any]] = UNSET, + stripe_id: OptionalNullable[str] = UNSET, + send_email_receipts: Optional[bool] = None, + new_customer_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.UpdateCustomerResponse: + r"""Updates an existing customer by ID. + + :param customer_id: ID of the customer to update + :param name: Customer's name + :param email: Customer's email address + :param fingerprint: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + :param metadata: Additional metadata for the customer + :param stripe_id: Stripe customer ID if you already have one + :param send_email_receipts: Whether to send email receipts to this customer + :param new_customer_id: Your unique identifier for the customer + :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.UpdateCustomerParams( + customer_id=customer_id, + name=name, + email=email, + fingerprint=fingerprint, + metadata=metadata, + stripe_id=stripe_id, + send_email_receipts=send_email_receipts, + new_customer_id=new_customer_id, + ) + + req = self._build_request( + method="POST", + path="/v1/customers.update", + 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, + _globals=models.UpdateCustomerGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.UpdateCustomerParams + ), + allow_empty_value=None, + 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="updateCustomer", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.UpdateCustomerResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "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 errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def update_async( + self, + *, + customer_id: str, + name: OptionalNullable[str] = UNSET, + email: OptionalNullable[str] = UNSET, + fingerprint: OptionalNullable[str] = UNSET, + metadata: OptionalNullable[Dict[str, Any]] = UNSET, + stripe_id: OptionalNullable[str] = UNSET, + send_email_receipts: Optional[bool] = None, + new_customer_id: Optional[str] = None, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.UpdateCustomerResponse: + r"""Updates an existing customer by ID. + + :param customer_id: ID of the customer to update + :param name: Customer's name + :param email: Customer's email address + :param fingerprint: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + :param metadata: Additional metadata for the customer + :param stripe_id: Stripe customer ID if you already have one + :param send_email_receipts: Whether to send email receipts to this customer + :param new_customer_id: Your unique identifier for the customer + :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.UpdateCustomerParams( + customer_id=customer_id, + name=name, + email=email, + fingerprint=fingerprint, + metadata=metadata, + stripe_id=stripe_id, + send_email_receipts=send_email_receipts, + new_customer_id=new_customer_id, + ) + + req = self._build_request_async( + method="POST", + path="/v1/customers.update", + 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, + _globals=models.UpdateCustomerGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.UpdateCustomerParams + ), + allow_empty_value=None, + 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="updateCustomer", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.UpdateCustomerResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "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 errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + def delete( + self, + *, + customer_id: str, + delete_in_stripe: Optional[bool] = False, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeleteCustomerResponse: + r"""Deletes a customer by ID. + + :param customer_id: ID of the customer to delete + :param delete_in_stripe: Whether to also delete the customer in Stripe + :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.DeleteCustomerParams( + customer_id=customer_id, + delete_in_stripe=delete_in_stripe, + ) + + req = self._build_request( + method="POST", + path="/v1/customers.delete", + 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, + _globals=models.DeleteCustomerGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.DeleteCustomerParams + ), + allow_empty_value=None, + 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="deleteCustomer", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeleteCustomerResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.AutumnDefaultError( + "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 errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) + + async def delete_async( + self, + *, + customer_id: str, + delete_in_stripe: Optional[bool] = False, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.DeleteCustomerResponse: + r"""Deletes a customer by ID. + + :param customer_id: ID of the customer to delete + :param delete_in_stripe: Whether to also delete the customer in Stripe + :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.DeleteCustomerParams( + customer_id=customer_id, + delete_in_stripe=delete_in_stripe, + ) + + req = self._build_request_async( + method="POST", + path="/v1/customers.delete", + 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, + _globals=models.DeleteCustomerGlobals( + x_api_version=self.sdk_configuration.globals.x_api_version, + ), + security=self.sdk_configuration.security, + get_serialized_body=lambda: utils.serialize_request_body( + request, False, False, "json", models.DeleteCustomerParams + ), + allow_empty_value=None, + 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="deleteCustomer", + oauth2_scopes=None, + security_source=self.sdk_configuration.security, + ), + request=req, + error_status_codes=["4XX", "5XX"], + retry_config=retry_config, + ) + + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.DeleteCustomerResponse, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.AutumnDefaultError( + "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 errors.AutumnDefaultError( + "API error occurred", http_res, http_res_text + ) + + raise errors.AutumnDefaultError("Unexpected response received", http_res) diff --git a/others/python-sdk/src/autumn_sdk/models/__init__.py b/others/python-sdk/src/autumn_sdk/models/__init__.py index a392d40e3..fe1d47a7c 100644 --- a/others/python-sdk/src/autumn_sdk/models/__init__.py +++ b/others/python-sdk/src/autumn_sdk/models/__init__.py @@ -26,6 +26,8 @@ if TYPE_CHECKING: BillingBehavior, Code, Duration, + EntityData, + EntityDataTypedDict, IncludedUsage, IncludedUsageTypedDict, Options, @@ -44,10 +46,19 @@ if TYPE_CHECKING: Breakdown, BreakdownTypedDict, Customer, + CustomerBalancesType, CustomerBillingMethod, + CustomerCreditSchema, + CustomerCreditSchemaTypedDict, + CustomerDisplay, + CustomerDisplayTypedDict, CustomerDurationType, CustomerEnv, + CustomerFeature, + CustomerFeatureTypedDict, CustomerIntervalEnum, + CustomerIntervalUnion, + CustomerIntervalUnionTypedDict, CustomerPrice, CustomerPriceTypedDict, CustomerReset, @@ -64,8 +75,6 @@ if TYPE_CHECKING: Entity, EntityEnv, EntityTypedDict, - Interval, - IntervalTypedDict, Invoice, InvoiceTypedDict, Purchase, @@ -75,20 +84,70 @@ if TYPE_CHECKING: ReferralCustomerTypedDict, ReferralTypedDict, Rewards, + RewardsType, RewardsTypedDict, Status, Subscription, SubscriptionTypedDict, TrialsUsed, TrialsUsedTypedDict, - Type, ) from .customerexpand import CustomerExpand - from .getorcreateop import ( + from .deletecustomerop import ( + DeleteCustomerGlobals, + DeleteCustomerGlobalsTypedDict, + DeleteCustomerParams, + DeleteCustomerParamsTypedDict, + DeleteCustomerResponse, + DeleteCustomerResponseTypedDict, + ) + from .getorcreatecustomerop import ( + GetOrCreateCustomerGlobals, + GetOrCreateCustomerGlobalsTypedDict, GetOrCreateCustomerParams, GetOrCreateCustomerParamsTypedDict, - GetOrCreateGlobals, - GetOrCreateGlobalsTypedDict, + ) + from .listcustomersop import ( + ListCustomersBalances, + ListCustomersBalancesTypedDict, + ListCustomersBillingMethod, + ListCustomersBreakdown, + ListCustomersBreakdownTypedDict, + ListCustomersCreditSchema, + ListCustomersCreditSchemaTypedDict, + ListCustomersDisplay, + ListCustomersDisplayTypedDict, + ListCustomersEnv, + ListCustomersFeature, + ListCustomersFeatureTypedDict, + ListCustomersGlobals, + ListCustomersGlobalsTypedDict, + ListCustomersIntervalEnum, + ListCustomersIntervalUnion, + ListCustomersIntervalUnionTypedDict, + ListCustomersParams, + ListCustomersParamsTypedDict, + ListCustomersPlan, + ListCustomersPlanTypedDict, + ListCustomersPrice, + ListCustomersPriceTypedDict, + ListCustomersPurchase, + ListCustomersPurchaseTypedDict, + ListCustomersReset, + ListCustomersResetTypedDict, + ListCustomersResponse, + ListCustomersResponseTypedDict, + ListCustomersRollover, + ListCustomersRolloverTypedDict, + ListCustomersStatus, + ListCustomersSubscription, + ListCustomersSubscriptionTypedDict, + ListCustomersTier, + ListCustomersTierTypedDict, + ListCustomersType, + ListT, + ListTTypedDict, + SubscriptionStatus, ) from .listop import ( ListGlobals, @@ -105,6 +164,10 @@ if TYPE_CHECKING: FreeTrial, FreeTrialTypedDict, Item, + ItemDisplay, + ItemDisplayTypedDict, + ItemFeatureDisplay, + ItemFeatureDisplayTypedDict, ItemPrice, ItemPriceTypedDict, ItemTypedDict, @@ -112,8 +175,12 @@ if TYPE_CHECKING: OnIncrease, Plan, PlanBillingMethod, + PlanCreditSchema, + PlanCreditSchemaTypedDict, PlanDurationType, PlanEnv, + PlanFeature, + PlanFeatureTypedDict, PlanPrice, PlanPriceTypedDict, PlanReset, @@ -125,7 +192,10 @@ if TYPE_CHECKING: PlanTierTypedDict, PlanTo, PlanToTypedDict, + PlanType, PlanTypedDict, + PriceDisplay, + PriceDisplayTypedDict, PriceInterval, PriceItemInterval, Proration, @@ -133,6 +203,45 @@ if TYPE_CHECKING: Scenario, ) from .security import Security, SecurityTypedDict + from .updatecustomerop import ( + UpdateCustomerBalances, + UpdateCustomerBalancesTypedDict, + UpdateCustomerBillingMethod, + UpdateCustomerBreakdown, + UpdateCustomerBreakdownTypedDict, + UpdateCustomerCreditSchema, + UpdateCustomerCreditSchemaTypedDict, + UpdateCustomerDisplay, + UpdateCustomerDisplayTypedDict, + UpdateCustomerEnv, + UpdateCustomerFeature, + UpdateCustomerFeatureTypedDict, + UpdateCustomerGlobals, + UpdateCustomerGlobalsTypedDict, + UpdateCustomerIntervalEnum, + UpdateCustomerIntervalUnion, + UpdateCustomerIntervalUnionTypedDict, + UpdateCustomerParams, + UpdateCustomerParamsTypedDict, + UpdateCustomerPrice, + UpdateCustomerPriceTypedDict, + UpdateCustomerPurchase, + UpdateCustomerPurchaseTypedDict, + UpdateCustomerReset, + UpdateCustomerResetTypedDict, + UpdateCustomerResponse, + UpdateCustomerResponseTypedDict, + UpdateCustomerRollover, + UpdateCustomerRolloverTypedDict, + UpdateCustomerStatus, + UpdateCustomerSubscription, + UpdateCustomerSubscriptionTypedDict, + UpdateCustomerTier, + UpdateCustomerTierTypedDict, + UpdateCustomerTo, + UpdateCustomerToTypedDict, + UpdateCustomerType, + ) __all__ = [ "AttachFreeTrial", @@ -158,13 +267,22 @@ __all__ = [ "BreakdownTypedDict", "Code", "Customer", + "CustomerBalancesType", "CustomerBillingMethod", + "CustomerCreditSchema", + "CustomerCreditSchemaTypedDict", + "CustomerDisplay", + "CustomerDisplayTypedDict", "CustomerDurationType", "CustomerEligibility", "CustomerEligibilityTypedDict", "CustomerEnv", "CustomerExpand", + "CustomerFeature", + "CustomerFeatureTypedDict", "CustomerIntervalEnum", + "CustomerIntervalUnion", + "CustomerIntervalUnionTypedDict", "CustomerPrice", "CustomerPriceTypedDict", "CustomerReset", @@ -176,43 +294,96 @@ __all__ = [ "CustomerTo", "CustomerToTypedDict", "CustomerTypedDict", + "DeleteCustomerGlobals", + "DeleteCustomerGlobalsTypedDict", + "DeleteCustomerParams", + "DeleteCustomerParamsTypedDict", + "DeleteCustomerResponse", + "DeleteCustomerResponseTypedDict", "Discount", "DiscountTypedDict", "Duration", "Entity", + "EntityData", + "EntityDataTypedDict", "EntityEnv", "EntityTypedDict", "ExpiryDurationType", "FreeTrial", "FreeTrialTypedDict", + "GetOrCreateCustomerGlobals", + "GetOrCreateCustomerGlobalsTypedDict", "GetOrCreateCustomerParams", "GetOrCreateCustomerParamsTypedDict", - "GetOrCreateGlobals", - "GetOrCreateGlobalsTypedDict", "IncludedUsage", "IncludedUsageTypedDict", - "Interval", - "IntervalTypedDict", "Invoice", "InvoiceTypedDict", "Item", + "ItemDisplay", + "ItemDisplayTypedDict", + "ItemFeatureDisplay", + "ItemFeatureDisplayTypedDict", "ItemPrice", "ItemPriceTypedDict", "ItemTypedDict", + "ListCustomersBalances", + "ListCustomersBalancesTypedDict", + "ListCustomersBillingMethod", + "ListCustomersBreakdown", + "ListCustomersBreakdownTypedDict", + "ListCustomersCreditSchema", + "ListCustomersCreditSchemaTypedDict", + "ListCustomersDisplay", + "ListCustomersDisplayTypedDict", + "ListCustomersEnv", + "ListCustomersFeature", + "ListCustomersFeatureTypedDict", + "ListCustomersGlobals", + "ListCustomersGlobalsTypedDict", + "ListCustomersIntervalEnum", + "ListCustomersIntervalUnion", + "ListCustomersIntervalUnionTypedDict", + "ListCustomersParams", + "ListCustomersParamsTypedDict", + "ListCustomersPlan", + "ListCustomersPlanTypedDict", + "ListCustomersPrice", + "ListCustomersPriceTypedDict", + "ListCustomersPurchase", + "ListCustomersPurchaseTypedDict", + "ListCustomersReset", + "ListCustomersResetTypedDict", + "ListCustomersResponse", + "ListCustomersResponseTypedDict", + "ListCustomersRollover", + "ListCustomersRolloverTypedDict", + "ListCustomersStatus", + "ListCustomersSubscription", + "ListCustomersSubscriptionTypedDict", + "ListCustomersTier", + "ListCustomersTierTypedDict", + "ListCustomersType", "ListGlobals", "ListGlobalsTypedDict", "ListRequest", "ListRequestTypedDict", "ListResponse", "ListResponseTypedDict", + "ListT", + "ListTTypedDict", "OnDecrease", "OnIncrease", "Options", "OptionsTypedDict", "Plan", "PlanBillingMethod", + "PlanCreditSchema", + "PlanCreditSchemaTypedDict", "PlanDurationType", "PlanEnv", + "PlanFeature", + "PlanFeatureTypedDict", "PlanPrice", "PlanPriceTypedDict", "PlanReset", @@ -225,7 +396,10 @@ __all__ = [ "PlanTierTypedDict", "PlanTo", "PlanToTypedDict", + "PlanType", "PlanTypedDict", + "PriceDisplay", + "PriceDisplayTypedDict", "PriceInterval", "PriceItemInterval", "Proration", @@ -240,18 +414,56 @@ __all__ = [ "RequiredAction", "RequiredActionTypedDict", "Rewards", + "RewardsType", "RewardsTypedDict", "Scenario", "Security", "SecurityTypedDict", "Status", "Subscription", + "SubscriptionStatus", "SubscriptionTypedDict", "Tiers", "TiersTypedDict", "TrialsUsed", "TrialsUsedTypedDict", - "Type", + "UpdateCustomerBalances", + "UpdateCustomerBalancesTypedDict", + "UpdateCustomerBillingMethod", + "UpdateCustomerBreakdown", + "UpdateCustomerBreakdownTypedDict", + "UpdateCustomerCreditSchema", + "UpdateCustomerCreditSchemaTypedDict", + "UpdateCustomerDisplay", + "UpdateCustomerDisplayTypedDict", + "UpdateCustomerEnv", + "UpdateCustomerFeature", + "UpdateCustomerFeatureTypedDict", + "UpdateCustomerGlobals", + "UpdateCustomerGlobalsTypedDict", + "UpdateCustomerIntervalEnum", + "UpdateCustomerIntervalUnion", + "UpdateCustomerIntervalUnionTypedDict", + "UpdateCustomerParams", + "UpdateCustomerParamsTypedDict", + "UpdateCustomerPrice", + "UpdateCustomerPriceTypedDict", + "UpdateCustomerPurchase", + "UpdateCustomerPurchaseTypedDict", + "UpdateCustomerReset", + "UpdateCustomerResetTypedDict", + "UpdateCustomerResponse", + "UpdateCustomerResponseTypedDict", + "UpdateCustomerRollover", + "UpdateCustomerRolloverTypedDict", + "UpdateCustomerStatus", + "UpdateCustomerSubscription", + "UpdateCustomerSubscriptionTypedDict", + "UpdateCustomerTier", + "UpdateCustomerTierTypedDict", + "UpdateCustomerTo", + "UpdateCustomerToTypedDict", + "UpdateCustomerType", "UsageModel", ] @@ -275,6 +487,8 @@ _dynamic_imports: dict[str, str] = { "BillingBehavior": ".attachop", "Code": ".attachop", "Duration": ".attachop", + "EntityData": ".attachop", + "EntityDataTypedDict": ".attachop", "IncludedUsage": ".attachop", "IncludedUsageTypedDict": ".attachop", "Options": ".attachop", @@ -291,10 +505,19 @@ _dynamic_imports: dict[str, str] = { "Breakdown": ".customer", "BreakdownTypedDict": ".customer", "Customer": ".customer", + "CustomerBalancesType": ".customer", "CustomerBillingMethod": ".customer", + "CustomerCreditSchema": ".customer", + "CustomerCreditSchemaTypedDict": ".customer", + "CustomerDisplay": ".customer", + "CustomerDisplayTypedDict": ".customer", "CustomerDurationType": ".customer", "CustomerEnv": ".customer", + "CustomerFeature": ".customer", + "CustomerFeatureTypedDict": ".customer", "CustomerIntervalEnum": ".customer", + "CustomerIntervalUnion": ".customer", + "CustomerIntervalUnionTypedDict": ".customer", "CustomerPrice": ".customer", "CustomerPriceTypedDict": ".customer", "CustomerReset": ".customer", @@ -311,8 +534,6 @@ _dynamic_imports: dict[str, str] = { "Entity": ".customer", "EntityEnv": ".customer", "EntityTypedDict": ".customer", - "Interval": ".customer", - "IntervalTypedDict": ".customer", "Invoice": ".customer", "InvoiceTypedDict": ".customer", "Purchase": ".customer", @@ -322,18 +543,64 @@ _dynamic_imports: dict[str, str] = { "ReferralCustomerTypedDict": ".customer", "ReferralTypedDict": ".customer", "Rewards": ".customer", + "RewardsType": ".customer", "RewardsTypedDict": ".customer", "Status": ".customer", "Subscription": ".customer", "SubscriptionTypedDict": ".customer", "TrialsUsed": ".customer", "TrialsUsedTypedDict": ".customer", - "Type": ".customer", "CustomerExpand": ".customerexpand", - "GetOrCreateCustomerParams": ".getorcreateop", - "GetOrCreateCustomerParamsTypedDict": ".getorcreateop", - "GetOrCreateGlobals": ".getorcreateop", - "GetOrCreateGlobalsTypedDict": ".getorcreateop", + "DeleteCustomerGlobals": ".deletecustomerop", + "DeleteCustomerGlobalsTypedDict": ".deletecustomerop", + "DeleteCustomerParams": ".deletecustomerop", + "DeleteCustomerParamsTypedDict": ".deletecustomerop", + "DeleteCustomerResponse": ".deletecustomerop", + "DeleteCustomerResponseTypedDict": ".deletecustomerop", + "GetOrCreateCustomerGlobals": ".getorcreatecustomerop", + "GetOrCreateCustomerGlobalsTypedDict": ".getorcreatecustomerop", + "GetOrCreateCustomerParams": ".getorcreatecustomerop", + "GetOrCreateCustomerParamsTypedDict": ".getorcreatecustomerop", + "ListCustomersBalances": ".listcustomersop", + "ListCustomersBalancesTypedDict": ".listcustomersop", + "ListCustomersBillingMethod": ".listcustomersop", + "ListCustomersBreakdown": ".listcustomersop", + "ListCustomersBreakdownTypedDict": ".listcustomersop", + "ListCustomersCreditSchema": ".listcustomersop", + "ListCustomersCreditSchemaTypedDict": ".listcustomersop", + "ListCustomersDisplay": ".listcustomersop", + "ListCustomersDisplayTypedDict": ".listcustomersop", + "ListCustomersEnv": ".listcustomersop", + "ListCustomersFeature": ".listcustomersop", + "ListCustomersFeatureTypedDict": ".listcustomersop", + "ListCustomersGlobals": ".listcustomersop", + "ListCustomersGlobalsTypedDict": ".listcustomersop", + "ListCustomersIntervalEnum": ".listcustomersop", + "ListCustomersIntervalUnion": ".listcustomersop", + "ListCustomersIntervalUnionTypedDict": ".listcustomersop", + "ListCustomersParams": ".listcustomersop", + "ListCustomersParamsTypedDict": ".listcustomersop", + "ListCustomersPlan": ".listcustomersop", + "ListCustomersPlanTypedDict": ".listcustomersop", + "ListCustomersPrice": ".listcustomersop", + "ListCustomersPriceTypedDict": ".listcustomersop", + "ListCustomersPurchase": ".listcustomersop", + "ListCustomersPurchaseTypedDict": ".listcustomersop", + "ListCustomersReset": ".listcustomersop", + "ListCustomersResetTypedDict": ".listcustomersop", + "ListCustomersResponse": ".listcustomersop", + "ListCustomersResponseTypedDict": ".listcustomersop", + "ListCustomersRollover": ".listcustomersop", + "ListCustomersRolloverTypedDict": ".listcustomersop", + "ListCustomersStatus": ".listcustomersop", + "ListCustomersSubscription": ".listcustomersop", + "ListCustomersSubscriptionTypedDict": ".listcustomersop", + "ListCustomersTier": ".listcustomersop", + "ListCustomersTierTypedDict": ".listcustomersop", + "ListCustomersType": ".listcustomersop", + "ListT": ".listcustomersop", + "ListTTypedDict": ".listcustomersop", + "SubscriptionStatus": ".listcustomersop", "ListGlobals": ".listop", "ListGlobalsTypedDict": ".listop", "ListRequest": ".listop", @@ -346,6 +613,10 @@ _dynamic_imports: dict[str, str] = { "FreeTrial": ".plan", "FreeTrialTypedDict": ".plan", "Item": ".plan", + "ItemDisplay": ".plan", + "ItemDisplayTypedDict": ".plan", + "ItemFeatureDisplay": ".plan", + "ItemFeatureDisplayTypedDict": ".plan", "ItemPrice": ".plan", "ItemPriceTypedDict": ".plan", "ItemTypedDict": ".plan", @@ -353,8 +624,12 @@ _dynamic_imports: dict[str, str] = { "OnIncrease": ".plan", "Plan": ".plan", "PlanBillingMethod": ".plan", + "PlanCreditSchema": ".plan", + "PlanCreditSchemaTypedDict": ".plan", "PlanDurationType": ".plan", "PlanEnv": ".plan", + "PlanFeature": ".plan", + "PlanFeatureTypedDict": ".plan", "PlanPrice": ".plan", "PlanPriceTypedDict": ".plan", "PlanReset": ".plan", @@ -366,7 +641,10 @@ _dynamic_imports: dict[str, str] = { "PlanTierTypedDict": ".plan", "PlanTo": ".plan", "PlanToTypedDict": ".plan", + "PlanType": ".plan", "PlanTypedDict": ".plan", + "PriceDisplay": ".plan", + "PriceDisplayTypedDict": ".plan", "PriceInterval": ".plan", "PriceItemInterval": ".plan", "Proration": ".plan", @@ -374,6 +652,43 @@ _dynamic_imports: dict[str, str] = { "Scenario": ".plan", "Security": ".security", "SecurityTypedDict": ".security", + "UpdateCustomerBalances": ".updatecustomerop", + "UpdateCustomerBalancesTypedDict": ".updatecustomerop", + "UpdateCustomerBillingMethod": ".updatecustomerop", + "UpdateCustomerBreakdown": ".updatecustomerop", + "UpdateCustomerBreakdownTypedDict": ".updatecustomerop", + "UpdateCustomerCreditSchema": ".updatecustomerop", + "UpdateCustomerCreditSchemaTypedDict": ".updatecustomerop", + "UpdateCustomerDisplay": ".updatecustomerop", + "UpdateCustomerDisplayTypedDict": ".updatecustomerop", + "UpdateCustomerEnv": ".updatecustomerop", + "UpdateCustomerFeature": ".updatecustomerop", + "UpdateCustomerFeatureTypedDict": ".updatecustomerop", + "UpdateCustomerGlobals": ".updatecustomerop", + "UpdateCustomerGlobalsTypedDict": ".updatecustomerop", + "UpdateCustomerIntervalEnum": ".updatecustomerop", + "UpdateCustomerIntervalUnion": ".updatecustomerop", + "UpdateCustomerIntervalUnionTypedDict": ".updatecustomerop", + "UpdateCustomerParams": ".updatecustomerop", + "UpdateCustomerParamsTypedDict": ".updatecustomerop", + "UpdateCustomerPrice": ".updatecustomerop", + "UpdateCustomerPriceTypedDict": ".updatecustomerop", + "UpdateCustomerPurchase": ".updatecustomerop", + "UpdateCustomerPurchaseTypedDict": ".updatecustomerop", + "UpdateCustomerReset": ".updatecustomerop", + "UpdateCustomerResetTypedDict": ".updatecustomerop", + "UpdateCustomerResponse": ".updatecustomerop", + "UpdateCustomerResponseTypedDict": ".updatecustomerop", + "UpdateCustomerRollover": ".updatecustomerop", + "UpdateCustomerRolloverTypedDict": ".updatecustomerop", + "UpdateCustomerStatus": ".updatecustomerop", + "UpdateCustomerSubscription": ".updatecustomerop", + "UpdateCustomerSubscriptionTypedDict": ".updatecustomerop", + "UpdateCustomerTier": ".updatecustomerop", + "UpdateCustomerTierTypedDict": ".updatecustomerop", + "UpdateCustomerTo": ".updatecustomerop", + "UpdateCustomerToTypedDict": ".updatecustomerop", + "UpdateCustomerType": ".updatecustomerop", } diff --git a/others/python-sdk/src/autumn_sdk/models/attachop.py b/others/python-sdk/src/autumn_sdk/models/attachop.py index 3aefdfdb3..c9341b3c5 100644 --- a/others/python-sdk/src/autumn_sdk/models/attachop.py +++ b/others/python-sdk/src/autumn_sdk/models/attachop.py @@ -44,6 +44,37 @@ class AttachGlobals(BaseModel): return m +class EntityDataTypedDict(TypedDict): + feature_id: str + r"""The feature ID that this entity is associated with""" + name: NotRequired[str] + r"""Name of the entity""" + + +class EntityData(BaseModel): + feature_id: str + r"""The feature ID that this entity is associated with""" + + name: Optional[str] = None + r"""Name of the entity""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + class OptionsTypedDict(TypedDict): feature_id: str quantity: NotRequired[float] @@ -299,6 +330,8 @@ BillingBehavior = Literal[ class AttachRequestTypedDict(TypedDict): product_id: str + entity_id: NotRequired[Nullable[str]] + entity_data: NotRequired[EntityDataTypedDict] options: NotRequired[Nullable[List[OptionsTypedDict]]] version: NotRequired[float] free_trial: NotRequired[Nullable[AttachFreeTrialTypedDict]] @@ -317,6 +350,10 @@ class AttachRequestTypedDict(TypedDict): class AttachRequest(BaseModel): product_id: str + entity_id: OptionalNullable[str] = UNSET + + entity_data: Optional[EntityData] = None + options: OptionalNullable[List[Options]] = UNSET version: Optional[float] = None @@ -347,6 +384,8 @@ class AttachRequest(BaseModel): def serialize_model(self, handler): optional_fields = set( [ + "entity_id", + "entity_data", "options", "version", "free_trial", @@ -362,7 +401,7 @@ class AttachRequest(BaseModel): "adjustable_quantity", ] ) - nullable_fields = set(["options", "free_trial"]) + nullable_fields = set(["entity_id", "options", "free_trial"]) serialized = handler(self) m = {} @@ -445,6 +484,7 @@ class AttachResponseTypedDict(TypedDict): customer_id: str payment_url: Nullable[str] + entity_id: NotRequired[str] invoice: NotRequired[AttachInvoiceTypedDict] required_action: NotRequired[RequiredActionTypedDict] @@ -456,13 +496,15 @@ class AttachResponse(BaseModel): payment_url: Nullable[str] + entity_id: Optional[str] = None + invoice: Optional[AttachInvoice] = None required_action: Optional[RequiredAction] = None @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["invoice", "required_action"]) + optional_fields = set(["entity_id", "invoice", "required_action"]) nullable_fields = set(["payment_url"]) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/customer.py b/others/python-sdk/src/autumn_sdk/models/customer.py index d891471aa..91ead7f80 100644 --- a/others/python-sdk/src/autumn_sdk/models/customer.py +++ b/others/python-sdk/src/autumn_sdk/models/customer.py @@ -157,6 +157,108 @@ class Purchase(BaseModel): return m +CustomerBalancesType = Union[ + Literal[ + "boolean", + "metered", + "credit_system", + ], + UnrecognizedStr, +] + + +class CustomerCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + credit_cost: float + + +class CustomerCreditSchema(BaseModel): + metered_feature_id: str + + credit_cost: float + + +class CustomerDisplayTypedDict(TypedDict): + singular: NotRequired[Nullable[str]] + plural: NotRequired[Nullable[str]] + + +class CustomerDisplay(BaseModel): + singular: OptionalNullable[str] = UNSET + + plural: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["singular", "plural"]) + nullable_fields = set(["singular", "plural"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class CustomerFeatureTypedDict(TypedDict): + id: str + name: str + type: CustomerBalancesType + consumable: bool + archived: bool + event_names: NotRequired[List[str]] + credit_schema: NotRequired[List[CustomerCreditSchemaTypedDict]] + display: NotRequired[CustomerDisplayTypedDict] + + +class CustomerFeature(BaseModel): + id: str + + name: str + + type: CustomerBalancesType + + consumable: bool + + archived: bool + + event_names: Optional[List[str]] = None + + credit_schema: Optional[List[CustomerCreditSchema]] = None + + display: Optional[CustomerDisplay] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["event_names", "credit_schema", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + CustomerIntervalEnum = Union[ Literal[ "one_off", @@ -173,20 +275,24 @@ CustomerIntervalEnum = Union[ ] -IntervalTypedDict = TypeAliasType("IntervalTypedDict", Union[CustomerIntervalEnum, str]) +CustomerIntervalUnionTypedDict = TypeAliasType( + "CustomerIntervalUnionTypedDict", Union[CustomerIntervalEnum, str] +) -Interval = TypeAliasType("Interval", Union[CustomerIntervalEnum, str]) +CustomerIntervalUnion = TypeAliasType( + "CustomerIntervalUnion", Union[CustomerIntervalEnum, str] +) class CustomerResetTypedDict(TypedDict): - interval: IntervalTypedDict + interval: CustomerIntervalUnionTypedDict resets_at: Nullable[float] interval_count: NotRequired[float] class CustomerReset(BaseModel): - interval: Interval + interval: CustomerIntervalUnion resets_at: Nullable[float] @@ -299,6 +405,7 @@ class BreakdownTypedDict(TypedDict): reset: Nullable[CustomerResetTypedDict] price: Nullable[CustomerPriceTypedDict] expires_at: Nullable[float] + id: NotRequired[str] class Breakdown(BaseModel): @@ -320,17 +427,30 @@ class Breakdown(BaseModel): expires_at: Nullable[float] + id: Optional[str] = "" + @model_serializer(mode="wrap") def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - m[k] = val + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val return m @@ -355,6 +475,7 @@ class BalancesTypedDict(TypedDict): overage_allowed: bool max_purchase: Nullable[float] next_reset_at: Nullable[float] + feature: NotRequired[CustomerFeatureTypedDict] breakdown: NotRequired[List[BreakdownTypedDict]] rollovers: NotRequired[List[CustomerRolloverTypedDict]] @@ -376,13 +497,15 @@ class Balances(BaseModel): next_reset_at: Nullable[float] + feature: Optional[CustomerFeature] = None + breakdown: Optional[List[Breakdown]] = None rollovers: Optional[List[CustomerRollover]] = None @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["breakdown", "rollovers"]) + optional_fields = set(["feature", "breakdown", "rollovers"]) nullable_fields = set(["max_purchase", "next_reset_at"]) serialized = handler(self) m = {} @@ -417,6 +540,8 @@ class InvoiceTypedDict(TypedDict): r"""The total amount of the invoice""" currency: str r"""The currency code for the invoice""" + created_at: float + r"""Timestamp when the invoice was created""" hosted_invoice_url: NotRequired[Nullable[str]] r"""URL to the Stripe-hosted invoice page""" @@ -437,6 +562,9 @@ class Invoice(BaseModel): currency: str r"""The currency code for the invoice""" + created_at: float + r"""Timestamp when the invoice was created""" + hosted_invoice_url: OptionalNullable[str] = UNSET r"""URL to the Stripe-hosted invoice page""" @@ -477,10 +605,15 @@ r"""The environment (sandbox/live)""" class EntityTypedDict(TypedDict): + id: Nullable[str] + r"""The unique identifier of the entity""" name: Nullable[str] r"""The name of the entity""" + created_at: float + r"""Unix timestamp when the entity was created""" env: EntityEnv r"""The environment (sandbox/live)""" + autumn_id: NotRequired[str] customer_id: NotRequired[Nullable[str]] r"""The customer ID this entity belongs to""" feature_id: NotRequired[Nullable[str]] @@ -488,12 +621,20 @@ class EntityTypedDict(TypedDict): class Entity(BaseModel): + id: Nullable[str] + r"""The unique identifier of the entity""" + name: Nullable[str] r"""The name of the entity""" + created_at: float + r"""Unix timestamp when the entity was created""" + env: EntityEnv r"""The environment (sandbox/live)""" + autumn_id: Optional[str] = None + customer_id: OptionalNullable[str] = UNSET r"""The customer ID this entity belongs to""" @@ -502,8 +643,8 @@ class Entity(BaseModel): @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["customer_id", "feature_id"]) - nullable_fields = set(["name", "customer_id", "feature_id"]) + optional_fields = set(["autumn_id", "customer_id", "feature_id"]) + nullable_fields = set(["id", "name", "customer_id", "feature_id"]) serialized = handler(self) m = {} @@ -565,7 +706,7 @@ class TrialsUsed(BaseModel): return m -Type = Union[ +RewardsType = Union[ Literal[ "percentage_discount", "fixed_discount", @@ -589,9 +730,11 @@ r"""How long the discount lasts""" class DiscountTypedDict(TypedDict): + id: str + r"""The unique identifier for this discount""" name: str r"""The name of the discount or coupon""" - type: Type + type: RewardsType r"""The type of reward""" discount_value: float r"""The discount value (percentage or fixed amount)""" @@ -612,10 +755,13 @@ class DiscountTypedDict(TypedDict): class Discount(BaseModel): + id: str + r"""The unique identifier for this discount""" + name: str r"""The name of the discount or coupon""" - type: Type + type: RewardsType r"""The type of reward""" discount_value: float @@ -697,11 +843,14 @@ class Rewards(BaseModel): class ReferralCustomerTypedDict(TypedDict): + id: str name: NotRequired[Nullable[str]] email: NotRequired[Nullable[str]] class ReferralCustomer(BaseModel): + id: str + name: OptionalNullable[str] = UNSET email: OptionalNullable[str] = UNSET @@ -736,6 +885,7 @@ class ReferralTypedDict(TypedDict): program_id: str customer: ReferralCustomerTypedDict reward_applied: bool + created_at: float class Referral(BaseModel): @@ -745,12 +895,18 @@ class Referral(BaseModel): reward_applied: bool + created_at: float + class CustomerTypedDict(TypedDict): + id: Nullable[str] + r"""Your unique identifier for the customer.""" name: Nullable[str] r"""The name of the customer.""" email: Nullable[str] r"""The email address of the customer.""" + created_at: float + r"""Timestamp of customer creation in milliseconds since epoch.""" fingerprint: Nullable[str] r"""A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.""" stripe_id: Nullable[str] @@ -773,12 +929,18 @@ class CustomerTypedDict(TypedDict): class Customer(BaseModel): + id: Nullable[str] + r"""Your unique identifier for the customer.""" + name: Nullable[str] r"""The name of the customer.""" email: Nullable[str] r"""The email address of the customer.""" + created_at: float + r"""Timestamp of customer creation in milliseconds since epoch.""" + fingerprint: Nullable[str] r"""A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.""" @@ -825,7 +987,15 @@ class Customer(BaseModel): ] ) nullable_fields = set( - ["name", "email", "fingerprint", "stripe_id", "rewards", "payment_method"] + [ + "id", + "name", + "email", + "fingerprint", + "stripe_id", + "rewards", + "payment_method", + ] ) serialized = handler(self) m = {} diff --git a/others/python-sdk/src/autumn_sdk/models/deletecustomerop.py b/others/python-sdk/src/autumn_sdk/models/deletecustomerop.py new file mode 100644 index 000000000..71f6b0b76 --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/deletecustomerop.py @@ -0,0 +1,80 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from autumn_sdk.types import BaseModel, UNSET_SENTINEL +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class DeleteCustomerGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class DeleteCustomerGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteCustomerParamsTypedDict(TypedDict): + customer_id: str + r"""ID of the customer to delete""" + delete_in_stripe: NotRequired[bool] + r"""Whether to also delete the customer in Stripe""" + + +class DeleteCustomerParams(BaseModel): + customer_id: str + r"""ID of the customer to delete""" + + delete_in_stripe: Optional[bool] = False + r"""Whether to also delete the customer in Stripe""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["delete_in_stripe"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class DeleteCustomerResponseTypedDict(TypedDict): + r"""OK""" + + success: bool + + +class DeleteCustomerResponse(BaseModel): + r"""OK""" + + success: bool diff --git a/others/python-sdk/src/autumn_sdk/models/getorcreateop.py b/others/python-sdk/src/autumn_sdk/models/getorcreatecustomerop.py similarity index 97% rename from others/python-sdk/src/autumn_sdk/models/getorcreateop.py rename to others/python-sdk/src/autumn_sdk/models/getorcreatecustomerop.py index 4609818c2..6f59baae0 100644 --- a/others/python-sdk/src/autumn_sdk/models/getorcreateop.py +++ b/others/python-sdk/src/autumn_sdk/models/getorcreatecustomerop.py @@ -16,11 +16,11 @@ from typing import Any, Dict, List, Optional from typing_extensions import Annotated, NotRequired, TypedDict -class GetOrCreateGlobalsTypedDict(TypedDict): +class GetOrCreateCustomerGlobalsTypedDict(TypedDict): x_api_version: NotRequired[str] -class GetOrCreateGlobals(BaseModel): +class GetOrCreateCustomerGlobals(BaseModel): x_api_version: Annotated[ Optional[str], pydantic.Field(alias="x-api-version"), diff --git a/others/python-sdk/src/autumn_sdk/models/listcustomersop.py b/others/python-sdk/src/autumn_sdk/models/listcustomersop.py new file mode 100644 index 000000000..7be0ab37e --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/listcustomersop.py @@ -0,0 +1,758 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .plan import Plan, PlanTypedDict +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class ListCustomersGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class ListCustomersGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class ListCustomersPlanTypedDict(TypedDict): + id: str + versions: NotRequired[List[float]] + + +class ListCustomersPlan(BaseModel): + id: str + + versions: Optional[List[float]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["versions"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +SubscriptionStatus = Literal[ + "active", + "scheduled", +] +r"""Filter by customer product status. Defaults to active and scheduled""" + + +class ListCustomersParamsTypedDict(TypedDict): + offset: NotRequired[int] + r"""Number of items to skip""" + limit: NotRequired[int] + r"""Number of items to return. Default 10, max 1000.""" + plans: NotRequired[List[ListCustomersPlanTypedDict]] + r"""Filter by plan ID and version. Returns customers with active subscriptions to this plan.""" + subscription_status: NotRequired[SubscriptionStatus] + r"""Filter by customer product status. Defaults to active and scheduled""" + search: NotRequired[str] + r"""Search customers by id, name, or email""" + + +class ListCustomersParams(BaseModel): + offset: Optional[int] = 0 + r"""Number of items to skip""" + + limit: Optional[int] = 10 + r"""Number of items to return. Default 10, max 1000.""" + + plans: Optional[List[ListCustomersPlan]] = None + r"""Filter by plan ID and version. Returns customers with active subscriptions to this plan.""" + + subscription_status: Optional[SubscriptionStatus] = None + r"""Filter by customer product status. Defaults to active and scheduled""" + + search: Optional[str] = None + r"""Search customers by id, name, or email""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["offset", "limit", "plans", "subscription_status", "search"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListCustomersEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""The environment this customer was created in.""" + + +ListCustomersStatus = Union[ + Literal[ + "active", + "scheduled", + "expired", + ], + UnrecognizedStr, +] + + +class ListCustomersSubscriptionTypedDict(TypedDict): + plan_id: str + auto_enable: bool + add_on: bool + status: ListCustomersStatus + past_due: bool + canceled_at: Nullable[float] + expires_at: Nullable[float] + trial_ends_at: Nullable[float] + started_at: float + current_period_start: Nullable[float] + current_period_end: Nullable[float] + quantity: float + plan: NotRequired[PlanTypedDict] + + +class ListCustomersSubscription(BaseModel): + plan_id: str + + auto_enable: bool + + add_on: bool + + status: ListCustomersStatus + + past_due: bool + + canceled_at: Nullable[float] + + expires_at: Nullable[float] + + trial_ends_at: Nullable[float] + + started_at: float + + current_period_start: Nullable[float] + + current_period_end: Nullable[float] + + quantity: float + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set( + [ + "canceled_at", + "expires_at", + "trial_ends_at", + "current_period_start", + "current_period_end", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListCustomersPurchaseTypedDict(TypedDict): + plan_id: str + expires_at: Nullable[float] + started_at: float + quantity: float + plan: NotRequired[PlanTypedDict] + + +class ListCustomersPurchase(BaseModel): + plan_id: str + + expires_at: Nullable[float] + + started_at: float + + quantity: float + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set(["expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +ListCustomersType = Union[ + Literal[ + "boolean", + "metered", + "credit_system", + ], + UnrecognizedStr, +] + + +class ListCustomersCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + credit_cost: float + + +class ListCustomersCreditSchema(BaseModel): + metered_feature_id: str + + credit_cost: float + + +class ListCustomersDisplayTypedDict(TypedDict): + singular: NotRequired[Nullable[str]] + plural: NotRequired[Nullable[str]] + + +class ListCustomersDisplay(BaseModel): + singular: OptionalNullable[str] = UNSET + + plural: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["singular", "plural"]) + nullable_fields = set(["singular", "plural"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListCustomersFeatureTypedDict(TypedDict): + id: str + name: str + type: ListCustomersType + consumable: bool + archived: bool + event_names: NotRequired[List[str]] + credit_schema: NotRequired[List[ListCustomersCreditSchemaTypedDict]] + display: NotRequired[ListCustomersDisplayTypedDict] + + +class ListCustomersFeature(BaseModel): + id: str + + name: str + + type: ListCustomersType + + consumable: bool + + archived: bool + + event_names: Optional[List[str]] = None + + credit_schema: Optional[List[ListCustomersCreditSchema]] = None + + display: Optional[ListCustomersDisplay] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["event_names", "credit_schema", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListCustomersIntervalEnum = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] + + +ListCustomersIntervalUnionTypedDict = TypeAliasType( + "ListCustomersIntervalUnionTypedDict", Union[ListCustomersIntervalEnum, str] +) + + +ListCustomersIntervalUnion = TypeAliasType( + "ListCustomersIntervalUnion", Union[ListCustomersIntervalEnum, str] +) + + +class ListCustomersResetTypedDict(TypedDict): + interval: ListCustomersIntervalUnionTypedDict + resets_at: Nullable[float] + interval_count: NotRequired[float] + + +class ListCustomersReset(BaseModel): + interval: ListCustomersIntervalUnion + + resets_at: Nullable[float] + + interval_count: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + nullable_fields = set(["resets_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListCustomersTierTypedDict(TypedDict): + amount: float + to: NotRequired[Any] + + +class ListCustomersTier(BaseModel): + amount: float + + to: Optional[Any] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["to"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +ListCustomersBillingMethod = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] + + +class ListCustomersPriceTypedDict(TypedDict): + billing_units: float + billing_method: ListCustomersBillingMethod + max_purchase: Nullable[float] + amount: NotRequired[float] + tiers: NotRequired[List[ListCustomersTierTypedDict]] + + +class ListCustomersPrice(BaseModel): + billing_units: float + + billing_method: ListCustomersBillingMethod + + max_purchase: Nullable[float] + + amount: Optional[float] = None + + tiers: Optional[List[ListCustomersTier]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListCustomersBreakdownTypedDict(TypedDict): + plan_id: Nullable[str] + included_grant: float + prepaid_grant: float + remaining: float + usage: float + unlimited: bool + reset: Nullable[ListCustomersResetTypedDict] + price: Nullable[ListCustomersPriceTypedDict] + expires_at: Nullable[float] + id: NotRequired[str] + + +class ListCustomersBreakdown(BaseModel): + plan_id: Nullable[str] + + included_grant: float + + prepaid_grant: float + + remaining: float + + usage: float + + unlimited: bool + + reset: Nullable[ListCustomersReset] + + price: Nullable[ListCustomersPrice] + + expires_at: Nullable[float] + + id: Optional[str] = "" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListCustomersRolloverTypedDict(TypedDict): + balance: float + expires_at: float + + +class ListCustomersRollover(BaseModel): + balance: float + + expires_at: float + + +class ListCustomersBalancesTypedDict(TypedDict): + feature_id: str + granted: float + remaining: float + usage: float + unlimited: bool + overage_allowed: bool + max_purchase: Nullable[float] + next_reset_at: Nullable[float] + feature: NotRequired[ListCustomersFeatureTypedDict] + breakdown: NotRequired[List[ListCustomersBreakdownTypedDict]] + rollovers: NotRequired[List[ListCustomersRolloverTypedDict]] + + +class ListCustomersBalances(BaseModel): + feature_id: str + + granted: float + + remaining: float + + usage: float + + unlimited: bool + + overage_allowed: bool + + max_purchase: Nullable[float] + + next_reset_at: Nullable[float] + + feature: Optional[ListCustomersFeature] = None + + breakdown: Optional[List[ListCustomersBreakdown]] = None + + rollovers: Optional[List[ListCustomersRollover]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "breakdown", "rollovers"]) + nullable_fields = set(["max_purchase", "next_reset_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class ListTTypedDict(TypedDict): + id: Nullable[str] + r"""Your unique identifier for the customer.""" + name: Nullable[str] + r"""The name of the customer.""" + email: Nullable[str] + r"""The email address of the customer.""" + created_at: float + r"""Timestamp of customer creation in milliseconds since epoch.""" + fingerprint: Nullable[str] + r"""A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.""" + stripe_id: Nullable[str] + r"""Stripe customer ID.""" + env: ListCustomersEnv + r"""The environment this customer was created in.""" + metadata: Dict[str, Any] + r"""The metadata for the customer.""" + send_email_receipts: bool + r"""Whether to send email receipts to the customer.""" + subscriptions: List[ListCustomersSubscriptionTypedDict] + purchases: List[ListCustomersPurchaseTypedDict] + balances: Dict[str, ListCustomersBalancesTypedDict] + + +class ListT(BaseModel): + id: Nullable[str] + r"""Your unique identifier for the customer.""" + + name: Nullable[str] + r"""The name of the customer.""" + + email: Nullable[str] + r"""The email address of the customer.""" + + created_at: float + r"""Timestamp of customer creation in milliseconds since epoch.""" + + fingerprint: Nullable[str] + r"""A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.""" + + stripe_id: Nullable[str] + r"""Stripe customer ID.""" + + env: ListCustomersEnv + r"""The environment this customer was created in.""" + + metadata: Dict[str, Any] + r"""The metadata for the customer.""" + + send_email_receipts: bool + r"""Whether to send email receipts to the customer.""" + + subscriptions: List[ListCustomersSubscription] + + purchases: List[ListCustomersPurchase] + + balances: Dict[str, ListCustomersBalances] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + m[k] = val + + return m + + +class ListCustomersResponseTypedDict(TypedDict): + r"""OK""" + + list: List[ListTTypedDict] + r"""Array of items for current page""" + has_more: bool + r"""Whether more results exist after this page""" + offset: float + r"""Current offset position""" + limit: float + r"""Limit passed in the request""" + total: float + r"""Total number of items returned in the current page""" + + +class ListCustomersResponse(BaseModel): + r"""OK""" + + list: List[ListT] + r"""Array of items for current page""" + + has_more: bool + r"""Whether more results exist after this page""" + + offset: float + r"""Current offset position""" + + limit: float + r"""Limit passed in the request""" + + total: float + r"""Total number of items returned in the current page""" diff --git a/others/python-sdk/src/autumn_sdk/models/plan.py b/others/python-sdk/src/autumn_sdk/models/plan.py index 17efb1b3d..c7f0feb2a 100644 --- a/others/python-sdk/src/autumn_sdk/models/plan.py +++ b/others/python-sdk/src/autumn_sdk/models/plan.py @@ -1,7 +1,14 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" from __future__ import annotations -from autumn_sdk.types import BaseModel, Nullable, UNSET_SENTINEL, UnrecognizedStr +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) from pydantic import model_serializer from typing import List, Literal, Optional, Union from typing_extensions import NotRequired, TypeAliasType, TypedDict @@ -20,22 +27,19 @@ PriceInterval = Union[ ] -class PlanPriceTypedDict(TypedDict): - amount: float - interval: PriceInterval - interval_count: NotRequired[float] +class PriceDisplayTypedDict(TypedDict): + primary_text: str + secondary_text: NotRequired[str] -class PlanPrice(BaseModel): - amount: float +class PriceDisplay(BaseModel): + primary_text: str - interval: PriceInterval - - interval_count: Optional[float] = None + secondary_text: Optional[str] = None @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["interval_count"]) + optional_fields = set(["secondary_text"]) serialized = handler(self) m = {} @@ -50,6 +54,142 @@ class PlanPrice(BaseModel): return m +class PlanPriceTypedDict(TypedDict): + amount: float + interval: PriceInterval + interval_count: NotRequired[float] + display: NotRequired[PriceDisplayTypedDict] + + +class PlanPrice(BaseModel): + amount: float + + interval: PriceInterval + + interval_count: Optional[float] = None + + display: Optional[PriceDisplay] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +PlanType = Union[ + Literal[ + "static", + "boolean", + "single_use", + "continuous_use", + "credit_system", + ], + UnrecognizedStr, +] +r"""The type of the feature""" + + +class ItemFeatureDisplayTypedDict(TypedDict): + singular: str + r"""The singular display name for the feature.""" + plural: str + r"""The plural display name for the feature.""" + + +class ItemFeatureDisplay(BaseModel): + singular: str + r"""The singular display name for the feature.""" + + plural: str + r"""The plural display name for the feature.""" + + +class PlanCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class PlanCreditSchema(BaseModel): + metered_feature_id: str + r"""The ID of the metered feature (should be a single_use feature).""" + + credit_cost: float + r"""The credit cost of the metered feature.""" + + +class PlanFeatureTypedDict(TypedDict): + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + type: PlanType + r"""The type of the feature""" + name: NotRequired[Nullable[str]] + r"""The name of the feature.""" + display: NotRequired[Nullable[ItemFeatureDisplayTypedDict]] + r"""Singular and plural display names for the feature.""" + credit_schema: NotRequired[Nullable[List[PlanCreditSchemaTypedDict]]] + r"""Credit cost schema for credit system features.""" + archived: NotRequired[Nullable[bool]] + r"""Whether or not the feature is archived.""" + + +class PlanFeature(BaseModel): + id: str + r"""The ID of the feature, used to refer to it in other API calls like /track or /check.""" + + type: PlanType + r"""The type of the feature""" + + name: OptionalNullable[str] = UNSET + r"""The name of the feature.""" + + display: OptionalNullable[ItemFeatureDisplay] = UNSET + r"""Singular and plural display names for the feature.""" + + credit_schema: OptionalNullable[List[PlanCreditSchema]] = UNSET + r"""Credit cost schema for credit system features.""" + + archived: OptionalNullable[bool] = UNSET + r"""Whether or not the feature is archived.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["name", "display", "credit_schema", "archived"]) + nullable_fields = set(["name", "display", "credit_schema", "archived"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + PlanResetInterval = Union[ Literal[ "one_off", @@ -183,6 +323,33 @@ class ItemPrice(BaseModel): return m +class ItemDisplayTypedDict(TypedDict): + primary_text: str + secondary_text: NotRequired[str] + + +class ItemDisplay(BaseModel): + primary_text: str + + secondary_text: Optional[str] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["secondary_text"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + ExpiryDurationType = Union[ Literal[ "month", @@ -287,6 +454,8 @@ class ItemTypedDict(TypedDict): unlimited: bool reset: Nullable[PlanResetTypedDict] price: Nullable[ItemPriceTypedDict] + feature: NotRequired[PlanFeatureTypedDict] + display: NotRequired[ItemDisplayTypedDict] rollover: NotRequired[PlanRolloverTypedDict] proration: NotRequired[ProrationTypedDict] @@ -302,13 +471,17 @@ class Item(BaseModel): price: Nullable[ItemPrice] + feature: Optional[PlanFeature] = None + + display: Optional[ItemDisplay] = None + rollover: Optional[PlanRollover] = None proration: Optional[Proration] = None @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["rollover", "proration"]) + optional_fields = set(["feature", "display", "rollover", "proration"]) nullable_fields = set(["reset", "price"]) serialized = handler(self) m = {} @@ -409,6 +582,7 @@ class CustomerEligibility(BaseModel): class PlanTypedDict(TypedDict): + id: str name: str description: Nullable[str] group: Nullable[str] @@ -417,6 +591,7 @@ class PlanTypedDict(TypedDict): auto_enable: bool price: Nullable[PlanPriceTypedDict] items: List[ItemTypedDict] + created_at: float env: PlanEnv archived: bool base_variant_id: Nullable[str] @@ -425,6 +600,8 @@ class PlanTypedDict(TypedDict): class Plan(BaseModel): + id: str + name: str description: Nullable[str] @@ -441,6 +618,8 @@ class Plan(BaseModel): items: List[Item] + created_at: float + env: PlanEnv archived: bool diff --git a/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py b/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py new file mode 100644 index 000000000..b501c3f8b --- /dev/null +++ b/others/python-sdk/src/autumn_sdk/models/updatecustomerop.py @@ -0,0 +1,718 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .plan import Plan, PlanTypedDict +from autumn_sdk.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, + UnrecognizedStr, +) +from autumn_sdk.utils import FieldMetadata, HeaderMetadata +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, List, Literal, Optional, Union +from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict + + +class UpdateCustomerGlobalsTypedDict(TypedDict): + x_api_version: NotRequired[str] + + +class UpdateCustomerGlobals(BaseModel): + x_api_version: Annotated[ + Optional[str], + pydantic.Field(alias="x-api-version"), + FieldMetadata(header=HeaderMetadata(style="simple", explode=False)), + ] = "2.1" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["x-api-version"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +class UpdateCustomerParamsTypedDict(TypedDict): + customer_id: str + r"""ID of the customer to update""" + name: NotRequired[Nullable[str]] + r"""Customer's name""" + email: NotRequired[Nullable[str]] + r"""Customer's email address""" + fingerprint: NotRequired[Nullable[str]] + r"""Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse""" + metadata: NotRequired[Nullable[Dict[str, Any]]] + r"""Additional metadata for the customer""" + stripe_id: NotRequired[Nullable[str]] + r"""Stripe customer ID if you already have one""" + send_email_receipts: NotRequired[bool] + r"""Whether to send email receipts to this customer""" + new_customer_id: NotRequired[str] + r"""Your unique identifier for the customer""" + + +class UpdateCustomerParams(BaseModel): + customer_id: str + r"""ID of the customer to update""" + + name: OptionalNullable[str] = UNSET + r"""Customer's name""" + + email: OptionalNullable[str] = UNSET + r"""Customer's email address""" + + fingerprint: OptionalNullable[str] = UNSET + r"""Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse""" + + metadata: OptionalNullable[Dict[str, Any]] = UNSET + r"""Additional metadata for the customer""" + + stripe_id: OptionalNullable[str] = UNSET + r"""Stripe customer ID if you already have one""" + + send_email_receipts: Optional[bool] = None + r"""Whether to send email receipts to this customer""" + + new_customer_id: Optional[str] = None + r"""Your unique identifier for the customer""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + [ + "name", + "email", + "fingerprint", + "metadata", + "stripe_id", + "send_email_receipts", + "new_customer_id", + ] + ) + nullable_fields = set(["name", "email", "fingerprint", "metadata", "stripe_id"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +UpdateCustomerEnv = Union[ + Literal[ + "sandbox", + "live", + ], + UnrecognizedStr, +] +r"""The environment this customer was created in.""" + + +UpdateCustomerStatus = Union[ + Literal[ + "active", + "scheduled", + "expired", + ], + UnrecognizedStr, +] + + +class UpdateCustomerSubscriptionTypedDict(TypedDict): + plan_id: str + auto_enable: bool + add_on: bool + status: UpdateCustomerStatus + past_due: bool + canceled_at: Nullable[float] + expires_at: Nullable[float] + trial_ends_at: Nullable[float] + started_at: float + current_period_start: Nullable[float] + current_period_end: Nullable[float] + quantity: float + plan: NotRequired[PlanTypedDict] + + +class UpdateCustomerSubscription(BaseModel): + plan_id: str + + auto_enable: bool + + add_on: bool + + status: UpdateCustomerStatus + + past_due: bool + + canceled_at: Nullable[float] + + expires_at: Nullable[float] + + trial_ends_at: Nullable[float] + + started_at: float + + current_period_start: Nullable[float] + + current_period_end: Nullable[float] + + quantity: float + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set( + [ + "canceled_at", + "expires_at", + "trial_ends_at", + "current_period_start", + "current_period_end", + ] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdateCustomerPurchaseTypedDict(TypedDict): + plan_id: str + expires_at: Nullable[float] + started_at: float + quantity: float + plan: NotRequired[PlanTypedDict] + + +class UpdateCustomerPurchase(BaseModel): + plan_id: str + + expires_at: Nullable[float] + + started_at: float + + quantity: float + + plan: Optional[Plan] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["plan"]) + nullable_fields = set(["expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +UpdateCustomerType = Union[ + Literal[ + "boolean", + "metered", + "credit_system", + ], + UnrecognizedStr, +] + + +class UpdateCustomerCreditSchemaTypedDict(TypedDict): + metered_feature_id: str + credit_cost: float + + +class UpdateCustomerCreditSchema(BaseModel): + metered_feature_id: str + + credit_cost: float + + +class UpdateCustomerDisplayTypedDict(TypedDict): + singular: NotRequired[Nullable[str]] + plural: NotRequired[Nullable[str]] + + +class UpdateCustomerDisplay(BaseModel): + singular: OptionalNullable[str] = UNSET + + plural: OptionalNullable[str] = UNSET + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["singular", "plural"]) + nullable_fields = set(["singular", "plural"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdateCustomerFeatureTypedDict(TypedDict): + id: str + name: str + type: UpdateCustomerType + consumable: bool + archived: bool + event_names: NotRequired[List[str]] + credit_schema: NotRequired[List[UpdateCustomerCreditSchemaTypedDict]] + display: NotRequired[UpdateCustomerDisplayTypedDict] + + +class UpdateCustomerFeature(BaseModel): + id: str + + name: str + + type: UpdateCustomerType + + consumable: bool + + archived: bool + + event_names: Optional[List[str]] = None + + credit_schema: Optional[List[UpdateCustomerCreditSchema]] = None + + display: Optional[UpdateCustomerDisplay] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["event_names", "credit_schema", "display"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +UpdateCustomerIntervalEnum = Union[ + Literal[ + "one_off", + "minute", + "hour", + "day", + "week", + "month", + "quarter", + "semi_annual", + "year", + ], + UnrecognizedStr, +] + + +UpdateCustomerIntervalUnionTypedDict = TypeAliasType( + "UpdateCustomerIntervalUnionTypedDict", Union[UpdateCustomerIntervalEnum, str] +) + + +UpdateCustomerIntervalUnion = TypeAliasType( + "UpdateCustomerIntervalUnion", Union[UpdateCustomerIntervalEnum, str] +) + + +class UpdateCustomerResetTypedDict(TypedDict): + interval: UpdateCustomerIntervalUnionTypedDict + resets_at: Nullable[float] + interval_count: NotRequired[float] + + +class UpdateCustomerReset(BaseModel): + interval: UpdateCustomerIntervalUnion + + resets_at: Nullable[float] + + interval_count: Optional[float] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["interval_count"]) + nullable_fields = set(["resets_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +UpdateCustomerToTypedDict = TypeAliasType( + "UpdateCustomerToTypedDict", Union[float, str] +) + + +UpdateCustomerTo = TypeAliasType("UpdateCustomerTo", Union[float, str]) + + +class UpdateCustomerTierTypedDict(TypedDict): + to: UpdateCustomerToTypedDict + amount: float + + +class UpdateCustomerTier(BaseModel): + to: UpdateCustomerTo + + amount: float + + +UpdateCustomerBillingMethod = Union[ + Literal[ + "prepaid", + "usage_based", + ], + UnrecognizedStr, +] + + +class UpdateCustomerPriceTypedDict(TypedDict): + billing_units: float + billing_method: UpdateCustomerBillingMethod + max_purchase: Nullable[float] + amount: NotRequired[float] + tiers: NotRequired[List[UpdateCustomerTierTypedDict]] + + +class UpdateCustomerPrice(BaseModel): + billing_units: float + + billing_method: UpdateCustomerBillingMethod + + max_purchase: Nullable[float] + + amount: Optional[float] = None + + tiers: Optional[List[UpdateCustomerTier]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["amount", "tiers"]) + nullable_fields = set(["max_purchase"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdateCustomerBreakdownTypedDict(TypedDict): + plan_id: Nullable[str] + included_grant: float + prepaid_grant: float + remaining: float + usage: float + unlimited: bool + reset: Nullable[UpdateCustomerResetTypedDict] + price: Nullable[UpdateCustomerPriceTypedDict] + expires_at: Nullable[float] + id: NotRequired[str] + + +class UpdateCustomerBreakdown(BaseModel): + plan_id: Nullable[str] + + included_grant: float + + prepaid_grant: float + + remaining: float + + usage: float + + unlimited: bool + + reset: Nullable[UpdateCustomerReset] + + price: Nullable[UpdateCustomerPrice] + + expires_at: Nullable[float] + + id: Optional[str] = "" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["id"]) + nullable_fields = set(["plan_id", "reset", "price", "expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdateCustomerRolloverTypedDict(TypedDict): + balance: float + expires_at: float + + +class UpdateCustomerRollover(BaseModel): + balance: float + + expires_at: float + + +class UpdateCustomerBalancesTypedDict(TypedDict): + feature_id: str + granted: float + remaining: float + usage: float + unlimited: bool + overage_allowed: bool + max_purchase: Nullable[float] + next_reset_at: Nullable[float] + feature: NotRequired[UpdateCustomerFeatureTypedDict] + breakdown: NotRequired[List[UpdateCustomerBreakdownTypedDict]] + rollovers: NotRequired[List[UpdateCustomerRolloverTypedDict]] + + +class UpdateCustomerBalances(BaseModel): + feature_id: str + + granted: float + + remaining: float + + usage: float + + unlimited: bool + + overage_allowed: bool + + max_purchase: Nullable[float] + + next_reset_at: Nullable[float] + + feature: Optional[UpdateCustomerFeature] = None + + breakdown: Optional[List[UpdateCustomerBreakdown]] = None + + rollovers: Optional[List[UpdateCustomerRollover]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["feature", "breakdown", "rollovers"]) + nullable_fields = set(["max_purchase", "next_reset_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) + + if val != UNSET_SENTINEL: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): + m[k] = val + + return m + + +class UpdateCustomerResponseTypedDict(TypedDict): + r"""OK""" + + id: Nullable[str] + r"""Your unique identifier for the customer.""" + name: Nullable[str] + r"""The name of the customer.""" + email: Nullable[str] + r"""The email address of the customer.""" + created_at: float + r"""Timestamp of customer creation in milliseconds since epoch.""" + fingerprint: Nullable[str] + r"""A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.""" + stripe_id: Nullable[str] + r"""Stripe customer ID.""" + env: UpdateCustomerEnv + r"""The environment this customer was created in.""" + metadata: Dict[str, Any] + r"""The metadata for the customer.""" + send_email_receipts: bool + r"""Whether to send email receipts to the customer.""" + subscriptions: List[UpdateCustomerSubscriptionTypedDict] + purchases: List[UpdateCustomerPurchaseTypedDict] + balances: Dict[str, UpdateCustomerBalancesTypedDict] + + +class UpdateCustomerResponse(BaseModel): + r"""OK""" + + id: Nullable[str] + r"""Your unique identifier for the customer.""" + + name: Nullable[str] + r"""The name of the customer.""" + + email: Nullable[str] + r"""The email address of the customer.""" + + created_at: float + r"""Timestamp of customer creation in milliseconds since epoch.""" + + fingerprint: Nullable[str] + r"""A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.""" + + stripe_id: Nullable[str] + r"""Stripe customer ID.""" + + env: UpdateCustomerEnv + r"""The environment this customer was created in.""" + + metadata: Dict[str, Any] + r"""The metadata for the customer.""" + + send_email_receipts: bool + r"""Whether to send email receipts to the customer.""" + + subscriptions: List[UpdateCustomerSubscription] + + purchases: List[UpdateCustomerPurchase] + + balances: Dict[str, UpdateCustomerBalances] + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k) + + if val != UNSET_SENTINEL: + m[k] = val + + return m diff --git a/others/python-sdk/uv.lock b/others/python-sdk/uv.lock index fd0a01203..8e392ef89 100644 --- a/others/python-sdk/uv.lock +++ b/others/python-sdk/uv.lock @@ -44,7 +44,7 @@ wheels = [ [[package]] name = "autumn-sdk" -version = "0.1.7" +version = "0.2.10" source = { editable = "." } dependencies = [ { name = "httpcore" }, diff --git a/package.json b/package.json index 1d725f3ab..a58c633dd 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "knip:fix-all": "knip --fix --allow-remove-files", "prepare": "husky", - "api": "bun -F @autumn/openapi generate", + "api": "cd packages/openapi && bun generate", "docs:pull": "bun -F @autumn/docs pull", "docs:dev": "bun -F @autumn/docs dev", "docs:build": "bun -F @autumn/docs build" diff --git a/packages/openapi/api.ts b/packages/openapi/api.ts index 9e1652e22..127d1bd3f 100644 --- a/packages/openapi/api.ts +++ b/packages/openapi/api.ts @@ -31,7 +31,7 @@ async function main() { // Generate Mintlify docs (transform OpenAPI + generate MDX) await generateMintlifyDocs({ openApiPath: paths.docsOpenApiPath, - docsDir: paths.docsApiDir, + docsDir: paths.docsDir, }); console.log("Done!"); diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml index 4ca5f7c2a..758f2dd0f 100644 --- a/packages/openapi/openapi.yml +++ b/packages/openapi/openapi.yml @@ -70,6 +70,11 @@ components: Customer: type: object properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. name: anyOf: - type: string @@ -80,6 +85,9 @@ components: - type: string - type: "null" description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. fingerprint: anyOf: - type: string @@ -192,6 +200,55 @@ components: properties: feature_id: type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived granted: type: number remaining: @@ -216,6 +273,9 @@ components: items: type: object properties: + id: + type: string + default: "" plan_id: anyOf: - type: string @@ -349,6 +409,9 @@ components: currency: type: string description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created hosted_invoice_url: anyOf: - type: string @@ -360,11 +423,19 @@ components: - status - total - currency + - created_at entities: type: array items: type: object properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity name: anyOf: - type: string @@ -380,13 +451,18 @@ components: - type: string - type: "null" description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created env: enum: - sandbox - live description: The environment (sandbox/live) required: + - id - name + - created_at - env trials_used: type: array @@ -413,6 +489,9 @@ components: items: type: object properties: + id: + type: string + description: The unique identifier for this discount name: type: string description: The name of the discount or coupon @@ -464,6 +543,7 @@ components: - type: "null" description: Total amount saved from this discount required: + - id - name - type - discount_value @@ -482,6 +562,8 @@ components: customer: type: object properties: + id: + type: string name: anyOf: - type: string @@ -490,20 +572,26 @@ components: anyOf: - type: string - type: "null" - required: [] + required: + - id reward_applied: type: boolean + created_at: + type: number required: - program_id - customer - reward_applied + - created_at payment_method: anyOf: - {} - type: "null" required: + - id - name - email + - created_at - fingerprint - stripe_id - env @@ -540,6 +628,8 @@ components: Plan: type: object properties: + id: + type: string name: type: string description: @@ -572,6 +662,15 @@ components: - year interval_count: type: number + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text required: - amount - interval @@ -583,6 +682,66 @@ components: properties: feature_id: type: string + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like + /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type included: type: number unlimited: @@ -653,6 +812,15 @@ components: - billing_method - max_purchase - type: "null" + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text rollover: type: object properties: @@ -707,6 +875,8 @@ components: - duration_length - duration_type - card_required + created_at: + type: number env: enum: - sandbox @@ -736,6 +906,7 @@ components: required: - scenario required: + - id - name - description - group @@ -744,6 +915,7 @@ components: - auto_enable - price - items + - created_at - env - archived - base_variant_id @@ -755,28 +927,9 @@ components: paths: /v1/customers.getOrCreate: post: - operationId: getOrCreate - description: >- - Creates a customer if they do not exist, or returns the existing + operationId: getOrCreateCustomer + description: Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - - - Use this as the primary entrypoint before billing operations so the - customer record is always present and up to date. - - - @example - - ```typescript - - // Create or fetch a customer by external ID - - const response = await client.getOrCreate({ - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); - ``` tags: - customers requestBody: @@ -848,6 +1001,7 @@ paths: application/json: schema: $ref: "#/components/schemas/Customer" + x-speakeasy-name-override: getOrCreate parameters: - &a1 name: x-api-version @@ -857,6 +1011,866 @@ paths: type: string default: "2.1" x-speakeasy-globals-hidden: true + /v1/customers.list: + post: + operationId: listCustomers + description: Lists customers with pagination and optional filters. + tags: + - customers + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9007199254740991 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 10 + description: Number of items to return. Default 10, max 1000. + plans: + type: array + items: + type: object + properties: + id: + type: string + versions: + type: array + items: + type: number + required: + - id + description: Filter by plan ID and version. Returns customers with active + subscriptions to this plan. + subscription_status: + enum: + - active + - scheduled + description: Filter by customer product status. Defaults to active and scheduled + search: + type: string + description: Search customers by id, name, or email + title: ListCustomersParams + examples: + - limit: 10 + offset: 0 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. + name: + anyOf: + - type: string + - type: "null" + description: The name of the customer. + email: + anyOf: + - type: string + - type: "null" + description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. + fingerprint: + anyOf: + - type: string + - type: "null" + description: "A unique identifier (eg. serial number) to de-duplicate customers + across devices or browsers. For example: apple + device ID." + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID. + env: + enum: + - sandbox + - live + description: The environment this customer was created in. + metadata: + type: object + propertyNames: {} + additionalProperties: {} + description: The metadata for the customer. + send_email_receipts: + type: boolean + description: Whether to send email receipts to the customer. + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - {} + - {} + amount: + type: number + required: + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + x-speakeasy-name-override: list + parameters: + - *a1 + /v1/customers.update: + post: + operationId: updateCustomer + description: Updates an existing customer by ID. + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + title: CustomerId + description: ID of the customer to update + name: + anyOf: + - type: string + - type: "null" + description: Customer's name + email: + anyOf: + - type: string + format: email + - type: "null" + description: Customer's email address + fingerprint: + anyOf: + - type: string + - type: "null" + description: Unique identifier (eg, serial number) to detect duplicate customers + and prevent free trial abuse + metadata: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: {} + - type: "null" + description: Additional metadata for the customer + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID if you already have one + send_email_receipts: + type: boolean + description: Whether to send email receipts to this customer + new_customer_id: + $ref: "#/components/schemas/CustomerId" + description: New ID for the customer + required: + - customer_id + title: UpdateCustomerParams + examples: + - customer_id: cus_123 + name: Jane Doe + email: jane@example.com + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. + name: + anyOf: + - type: string + - type: "null" + description: The name of the customer. + email: + anyOf: + - type: string + - type: "null" + description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. + fingerprint: + anyOf: + - type: string + - type: "null" + description: "A unique identifier (eg. serial number) to de-duplicate customers + across devices or browsers. For example: apple device ID." + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID. + env: + enum: + - sandbox + - live + description: The environment this customer was created in. + metadata: + type: object + propertyNames: {} + additionalProperties: {} + description: The metadata for the customer. + send_email_receipts: + type: boolean + description: Whether to send email receipts to the customer. + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + x-speakeasy-name-override: update + parameters: + - *a1 + /v1/customers.delete: + post: + operationId: deleteCustomer + description: Deletes a customer by ID. + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + title: CustomerId + description: ID of the customer to delete + delete_in_stripe: + type: boolean + default: false + description: Whether to also delete the customer in Stripe + required: + - customer_id + title: DeleteCustomerParams + examples: + - customer_id: cus_123 + delete_in_stripe: false + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - *a1 /v1/products: get: operationId: list @@ -891,6 +1905,21 @@ paths: schema: type: object properties: + entity_id: + anyOf: + - type: string + - type: "null" + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id options: anyOf: - type: array @@ -1063,6 +2092,8 @@ paths: properties: customer_id: type: string + entity_id: + type: string invoice: type: object properties: diff --git a/packages/openapi/tsconfig.json b/packages/openapi/tsconfig.json index 7600babe2..6d08724fc 100644 --- a/packages/openapi/tsconfig.json +++ b/packages/openapi/tsconfig.json @@ -1,17 +1,14 @@ { "compilerOptions": { "strict": true, - "composite": true, - "declaration": true, - "declarationMap": true, "esModuleInterop": true, "skipLibCheck": true, "module": "Preserve", "moduleResolution": "bundler", "target": "ES2020", - "outDir": "./dist", - "rootDir": ".", + "noEmit": true, "paths": { + "@autumn/shared": ["../../shared/index.ts"], "@api/*": ["../../shared/api/*"], "@models/*": ["../../shared/models/*"], "@utils/*": ["../../shared/utils/*"] diff --git a/packages/openapi/utils/apiReferenceGenerator/generateFields.ts b/packages/openapi/utils/apiReferenceGenerator/generateFields.ts index 4f16b0d41..b18c0046f 100644 --- a/packages/openapi/utils/apiReferenceGenerator/generateFields.ts +++ b/packages/openapi/utils/apiReferenceGenerator/generateFields.ts @@ -222,14 +222,13 @@ function buildResponseFieldProps({ /** * Format the type string, including enum values if present. + * Shows all enum values inline for better documentation clarity. */ function formatType(type: string, enumValues?: string[]): string { if (enumValues && enumValues.length > 0) { - // Show enum values inline if there are few, otherwise just show "enum" - if (enumValues.length <= 5) { - return enumValues.map((v) => `'${v}'`).join(" | "); - } - return "enum"; + const isArray = type.endsWith("[]"); + const values = enumValues.map((v) => `'${v}'`).join(" | "); + return isArray ? `(${values})[]` : values; } return type; } diff --git a/packages/openapi/utils/apiReferenceGenerator/index.ts b/packages/openapi/utils/apiReferenceGenerator/index.ts index 48b1783b5..5fe46b4da 100644 --- a/packages/openapi/utils/apiReferenceGenerator/index.ts +++ b/packages/openapi/utils/apiReferenceGenerator/index.ts @@ -31,7 +31,7 @@ export async function generateApiReference({ console.log(` Found ${operations.length} operations`); let generated = 0; - let skipped = 0; + const skipped = 0; for (const operation of operations) { const { tag, operationId } = operation; @@ -40,22 +40,9 @@ export async function generateApiReference({ const manualMdxPath = path.join(manualMdxDir, tag, `${operationId}.mdx`); const outputPath = path.join(outputDir, tag, `${operationId}.mdx`); - // Check if output file already exists and there's no manual MDX - // In that case, skip to avoid overwriting existing content - if (existsSync(outputPath) && !existsSync(manualMdxPath)) { - skipped++; - continue; - } - // Generate fields MDX const generatedContent = generateFields({ operation }); - // Skip if no content was generated - if (!generatedContent.trim()) { - skipped++; - continue; - } - // Merge with manual MDX (if exists) const finalMdx = mergeMdx({ manualMdxPath, diff --git a/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts b/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts index 35fbdb1f9..83938dede 100644 --- a/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts +++ b/packages/openapi/utils/apiReferenceGenerator/parseOpenApi.ts @@ -407,20 +407,23 @@ function parseField({ const itemType = resolveType(items, schemas); type = `${itemType}[]`; - // Check if array items have properties - if (items.type === "object" && items.properties) { - children = parseSchema({ - schema: items, - schemas, - requiredFields: (items.required as string[]) ?? [], - visited, - }); + // Check if array items are an enum (directly or via $ref) + if (items.enum) { + enumValues = items.enum as string[]; } else if (items.$ref) { const refPath = items.$ref as string; const refName = refPath.replace("#/components/schemas/", ""); const refSchema = schemas[refName] as Record | undefined; - if (refSchema && refSchema.type === "object" && refSchema.properties) { + if (refSchema?.enum) { + // Array items reference an enum schema + enumValues = refSchema.enum as string[]; + } else if ( + refSchema && + refSchema.type === "object" && + refSchema.properties + ) { + // Array items reference an object schema children = parseSchema({ schema: refSchema, schemas, @@ -429,6 +432,16 @@ function parseField({ }); } } + + // Check if array items have properties (inline object) + if (items.type === "object" && items.properties) { + children = parseSchema({ + schema: items, + schemas, + requiredFields: (items.required as string[]) ?? [], + visited, + }); + } } return { diff --git a/packages/openapi/utils/mintlifyTransform/index.ts b/packages/openapi/utils/mintlifyTransform/index.ts index 611902ce7..f74947dbb 100644 --- a/packages/openapi/utils/mintlifyTransform/index.ts +++ b/packages/openapi/utils/mintlifyTransform/index.ts @@ -2,6 +2,7 @@ import { readFileSync, writeFileSync } from "node:fs"; import path from "node:path"; import yaml from "yaml"; import { generateApiReference } from "../apiReferenceGenerator/index.js"; +import { removeInternalFields } from "../openapiTransform/removeInternalFields.js"; import { transformNode } from "./transformNode.js"; export { stripJsDocTags } from "./stripJsDocTags.js"; @@ -14,6 +15,7 @@ export { resolveSchemaExample, transformNode } from "./transformNode.js"; /** * Transforms an OpenAPI YAML document for Mintlify consumption. * + * - Removes internal fields (marked with `internal: true` or `x-internal: true`) * - Strips JSDoc tags from descriptions * - Transforms Speakeasy code samples to use autumn-js format * - Copies schema examples to response content level @@ -23,6 +25,10 @@ export function transformOpenApiForMintlify(yamlContent: string): string { const schemas = (doc.components as Record)?.schemas as | Record | undefined; + + // Remove internal fields before other transformations + removeInternalFields({ openApiDocument: doc }); + transformNode(doc, schemas); return yaml.stringify(doc); } diff --git a/packages/openapi/utils/registerInternalSchemas.ts b/packages/openapi/utils/registerInternalSchemas.ts index d63a5c763..020a7c21f 100644 --- a/packages/openapi/utils/registerInternalSchemas.ts +++ b/packages/openapi/utils/registerInternalSchemas.ts @@ -1,17 +1,18 @@ -import { JSON_SCHEMA_INPUT_REGISTRY } from "@orpc/zod/zod4"; +import { + JSON_SCHEMA_INPUT_REGISTRY, + JSON_SCHEMA_OUTPUT_REGISTRY, +} from "@orpc/zod/zod4"; import type { z } from "zod/v4"; import { globalRegistry } from "zod/v4/core"; /** * Recursively walks a Zod schema and registers any schemas marked with - * `.meta({ internal: true })` in the JSON_SCHEMA_INPUT_REGISTRY with - * `x-internal: true`. This allows `removeInternalFields()` to strip them - * from the generated OpenAPI spec. + * `.meta({ internal: true })` in both JSON_SCHEMA_INPUT_REGISTRY and + * JSON_SCHEMA_OUTPUT_REGISTRY with `x-internal: true`. This allows + * `removeInternalFields()` to strip them from the generated OpenAPI spec. * - * Note: This approach has limitations with schema transformations like - * `.omit()`, `.extend()`, `.refine()` which create new schema instances. - * For reliable internal field removal, use the INTERNAL_FIELD_NAMES - * list in openapi2.1.ts which removes fields by name. + * Both registries are needed because ORPC uses the input registry for + * request body schemas and the output registry for response schemas. */ export function registerInternalSchemas(schema: z.ZodType): void { const visited = new WeakSet(); @@ -25,9 +26,12 @@ function walkSchema(schema: z.ZodType, visited: WeakSet): void { // Check if this schema has internal: true in its metadata const meta = globalRegistry.get(schema); if (meta?.internal === true) { - // Register with x-internal so removeInternalFields() can find it + // Register with x-internal in BOTH registries so removeInternalFields() can find it + // Input registry is used for request bodies, output registry for responses // biome-ignore lint/suspicious/noExplicitAny: TypeScript types are restrictive but runtime accepts arbitrary props JSON_SCHEMA_INPUT_REGISTRY.add(schema, { "x-internal": true } as any); + // biome-ignore lint/suspicious/noExplicitAny: TypeScript types are restrictive but runtime accepts arbitrary props + JSON_SCHEMA_OUTPUT_REGISTRY.add(schema, { "x-internal": true } as any); } // Get the internal Zod definition to traverse nested schemas diff --git a/packages/openapi/v2.1/contracts/customersContract.ts b/packages/openapi/v2.1/contracts/customersContract.ts index a54ed298d..67c35bb74 100644 --- a/packages/openapi/v2.1/contracts/customersContract.ts +++ b/packages/openapi/v2.1/contracts/customersContract.ts @@ -1,17 +1,29 @@ -// import { getOrCreateCustomerJsDoc } from "@api/common/jsDocs.js"; -import { ApiCustomerV5Schema } from "@api/customers/apiCustomerV5.js"; -import { CreateCustomerParamsV1Schema } from "@api/customers/crud/createCustomerParams"; +import { createPagePaginatedResponseSchema } from "@api/common/pagePaginationSchemas.js"; +import { + ApiCustomerV5Schema, + BaseApiCustomerV5Schema, +} from "@api/customers/apiCustomerV5.js"; +import { CreateCustomerParamsV1Schema } from "@api/customers/crud/createCustomerParams.js"; +import { + DeleteCustomerParamsSchema, + DeleteCustomerResponseSchema, +} from "@api/customers/crud/deleteCustomerParams.js"; +import { ListCustomersV2ParamsSchema } from "@api/customers/crud/listCustomersParamsV2.js"; +import { UpdateCustomerParamsV1Schema } from "@api/customers/crud/updateCustomerParams.js"; import { oc } from "@orpc/contract"; export const getOrCreateCustomerContract = oc .route({ method: "POST", path: "/v1/customers.getOrCreate", - operationId: "getOrCreate", + operationId: "getOrCreateCustomer", tags: ["customers"], - // description: getOrCreateCustomerJsDoc, description: "Creates a customer if they do not exist, or returns the existing customer by your external customer ID.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "getOrCreate", + }), }) .input( CreateCustomerParamsV1Schema.meta({ @@ -26,3 +38,79 @@ export const getOrCreateCustomerContract = oc }), ) .output(ApiCustomerV5Schema); + +export const listCustomersContract = oc + .route({ + method: "POST", + path: "/v1/customers.list", + operationId: "listCustomers", + tags: ["customers"], + description: "Lists customers with pagination and optional filters.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "list", + }), + }) + .input( + ListCustomersV2ParamsSchema.optional().meta({ + title: "ListCustomersParams", + examples: [ + { + limit: 10, + offset: 0, + }, + ], + }), + ) + .output(createPagePaginatedResponseSchema(BaseApiCustomerV5Schema)); + +export const updateCustomerContract = oc + .route({ + method: "POST", + path: "/v1/customers.update", + operationId: "updateCustomer", + tags: ["customers"], + description: "Updates an existing customer by ID.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "update", + }), + }) + .input( + UpdateCustomerParamsV1Schema.meta({ + title: "UpdateCustomerParams", + examples: [ + { + customer_id: "cus_123", + name: "Jane Doe", + email: "jane@example.com", + }, + ], + }), + ) + .output(BaseApiCustomerV5Schema); + +export const deleteCustomerContract = oc + .route({ + method: "POST", + path: "/v1/customers.delete", + operationId: "deleteCustomer", + tags: ["customers"], + description: "Deletes a customer by ID.", + spec: (spec) => ({ + ...spec, + "x-speakeasy-name-override": "delete", + }), + }) + .input( + DeleteCustomerParamsSchema.meta({ + title: "DeleteCustomerParams", + examples: [ + { + customer_id: "cus_123", + delete_in_stripe: false, + }, + ], + }), + ) + .output(DeleteCustomerResponseSchema); diff --git a/packages/openapi/v2.1/contracts/index.ts b/packages/openapi/v2.1/contracts/index.ts index fee2fcb0d..fda452678 100644 --- a/packages/openapi/v2.1/contracts/index.ts +++ b/packages/openapi/v2.1/contracts/index.ts @@ -1,10 +1,23 @@ import { oc } from "@orpc/contract"; import { attachContract } from "./attachContract.js"; -import { getOrCreateCustomerContract } from "./customersContract.js"; +import { + deleteCustomerContract, + getOrCreateCustomerContract, + listCustomersContract, + updateCustomerContract, +} from "./customersContract.js"; import { listPlansContract } from "./plansContract.js"; export const v2_1ContractRouter = oc.router({ + // Customers getOrCreateCustomer: getOrCreateCustomerContract, + listCustomers: listCustomersContract, + updateCustomer: updateCustomerContract, + deleteCustomer: deleteCustomerContract, + + // Plans listPlans: listPlansContract, + + // Billing attach: attachContract, }); diff --git a/packages/openapi/v2.1/openapi2.1.ts b/packages/openapi/v2.1/openapi2.1.ts index 75789d802..43bb4b14f 100644 --- a/packages/openapi/v2.1/openapi2.1.ts +++ b/packages/openapi/v2.1/openapi2.1.ts @@ -1,12 +1,16 @@ import { writeFileSync } from "node:fs"; +import { + ApiCustomerV5Schema, + ApiPlanV1Schema, + AttachParamsV0Schema, + BaseApiCustomerSchema, + BillingResponseSchema, + CreateCustomerParamsV1Schema, + CustomerDataSchema, + CustomerExpandEnum, + CustomerIdSchema, +} from "@autumn/shared"; -import { BillingResponseSchema } from "@api/billing/common/billingResponse.js"; -import { CustomerIdSchema } from "@api/common/customerId.js"; -import { ApiCustomerV5Schema } from "@api/customers/apiCustomerV5.js"; -import { CustomerExpandEnum } from "@api/customers/components/customerExpand/customerExpand.js"; -import { CreateCustomerParamsV1Schema } from "@api/customers/crud/createCustomerParams.js"; -import { AttachParamsV0Schema, CustomerDataSchema } from "@api/models.js"; -import { ApiPlanV1Schema } from "@api/products/apiPlanV1.js"; import { OpenAPIGenerator } from "@orpc/openapi"; import { ZodToJsonSchemaConverter } from "@orpc/zod/zod4"; import yaml from "yaml"; @@ -29,6 +33,7 @@ export const writeOpenApi_2_1_0 = async ({ }) => { // Register internal schemas before generation so they get x-internal: true // in the OpenAPI output, which removeInternalFields() will then strip + registerInternalSchemas(BaseApiCustomerSchema); registerInternalSchemas(CreateCustomerParamsV1Schema); registerInternalSchemas(AttachParamsV0Schema); registerInternalSchemas(BillingResponseSchema); diff --git a/packages/sdk/.speakeasy/code-samples.overlay.yaml b/packages/sdk/.speakeasy/code-samples.overlay.yaml index 66dc93edd..8f3d3784c 100644 --- a/packages/sdk/.speakeasy/code-samples.overlay.yaml +++ b/packages/sdk/.speakeasy/code-samples.overlay.yaml @@ -24,6 +24,28 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/customers.delete"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.customers.delete({ + customerId: "cus_123", + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/customers.getOrCreate"]["post"] update: @@ -48,6 +70,50 @@ actions: console.log(result); } + run(); + - target: $["paths"]["/v1/customers.list"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.customers.list({}); + + console.log(result); + } + + run(); + - target: $["paths"]["/v1/customers.update"]["post"] + update: + x-codeSamples: + - lang: typescript + label: Typescript (SDK) + source: |- + import { Autumn } from "@useautumn/sdk"; + + const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", + }); + + async function run() { + const result = await autumn.customers.update({ + customerId: "cus_123", + name: "Jane Doe", + email: "jane@example.com", + }); + + console.log(result); + } + run(); - target: $["paths"]["/v1/products"]["get"] update: diff --git a/packages/sdk/.speakeasy/gen.lock b/packages/sdk/.speakeasy/gen.lock index 4b9f228bb..0b2a4a31b 100644 --- a/packages/sdk/.speakeasy/gen.lock +++ b/packages/sdk/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: 7b300647-cd76-49e9-bf77-7d1bf5446d66 management: - docChecksum: b65ff198c2a9d322f115152bb4da709a + docChecksum: 3fea67c2d1978eb098ab3724598f1f73 docVersion: 2.1.0 speakeasyVersion: 1.719.0 generationVersion: 2.824.1 - releaseVersion: 0.7.29 - configChecksum: 13f08285f9b274814b2d46050374eef9 + releaseVersion: 0.8.11 + configChecksum: c0fdfd2f91709a98814008a14bb8a9e9 persistentEdits: - generation_id: bd22a6eb-315b-4c33-b0e4-edb497c26c67 - pristine_commit_hash: a96dff9597bfab5096e7cb96a3be02f68d8fc506 - pristine_tree_hash: 51873602d9af7f314d657d3d164ebc11ddf7df0d + generation_id: 2ac789eb-fa5a-4bf1-8180-55e224773960 + pristine_commit_hash: 71c82d4e988a87f4182289283d6b84e812001b54 + pristine_tree_hash: 3750f113828547db916f5f0a8cd9dd02549df193 features: typescript: additionalDependencies: 0.1.0 @@ -27,6 +27,7 @@ features: globals: 2.82.2 hiddenGlobals: 0.1.0 methodArguments: 0.1.2 + nameOverrides: 2.81.2 nullables: 0.1.1 responseFormat: 0.3.0 retries: 2.83.0 @@ -91,12 +92,12 @@ trackedFiles: pristine_git_object: 5dab41e71b2c203495d96ce060b7e0100f26167a docs/models/attach-request.md: id: 9e2ed03c1844 - last_write_checksum: sha1:ac9e609f3ab72a889cc51f373f3d1b76fde42853 - pristine_git_object: 50a550a22b82814cff9b78f60eff43623363060b + last_write_checksum: sha1:504d5358eea8913b71b23575156af0a4be518430 + pristine_git_object: 3b3e1b46373322fcc4a8330fda9aa6176bbce432 docs/models/attach-response.md: id: 7a5806587fd5 - last_write_checksum: sha1:7849b490fb4bc8b5556b7133465ce026d13581e7 - pristine_git_object: b3eec4c3fbf69785c5666a08354bce0040bb9693 + last_write_checksum: sha1:a7b8266aa2eeff06be640e3122290aacc690db37 + pristine_git_object: 2c48f0863a83a7365543db4cdeb40f7722111bb4 docs/models/attach-to.md: id: 39243c9d9b34 last_write_checksum: sha1:b3cdc5c90abed4d59f033c545019f56a3d2e2ce1 @@ -107,24 +108,36 @@ trackedFiles: pristine_git_object: 5316b2b61c30f9a86d13d723c08c112c498a3b0b docs/models/balances.md: id: 2f042cf3d0aa - last_write_checksum: sha1:b4b98e12527cbc39740c582a568427d715b85d03 - pristine_git_object: 3cecc0799bb1f00476c41b9a5c99c4e79b5ceb5e + last_write_checksum: sha1:9a9c2a84d066247446703b35af6efe14f5df1cb3 + pristine_git_object: fd59d3018e8e84c9fcdf744a438072eff75638b6 docs/models/billing-behavior.md: id: 59f3b5602fbf last_write_checksum: sha1:6ed351e2827574db97767e81b035f3ec225c01ab pristine_git_object: 4633622403fdd0438509ff950c13f857121fc588 docs/models/breakdown.md: id: 786823ab8ff0 - last_write_checksum: sha1:683ea06e2215c28c720f9851b4368098e0d06807 - pristine_git_object: be7b8808f650d49888af3e88b2d8ce34a335c7df + last_write_checksum: sha1:6992c68ed199fd46e06c6e7d26d412704f9164f8 + pristine_git_object: f6bdbd480cbf0f5ae1083f2c9cd3a9cd0fb80e9f docs/models/code.md: id: 2fcb3964c9c0 last_write_checksum: sha1:94a4beade541c66d62dec0d861813fe1ac19dd69 pristine_git_object: 595d8bd35314feacf5137f361e0eefb8889072ad + docs/models/customer-balances-type.md: + id: 07f78390b2b8 + last_write_checksum: sha1:b8f9ee007d08523105f4edb917bad45d71420f0e + pristine_git_object: 56317c9af5573ebb281faf683e103d9107cbab7e docs/models/customer-billing-method.md: id: 06ff2abe6f74 last_write_checksum: sha1:1a9942bc1176ec5185bfe33171162879bf79f405 pristine_git_object: 12c6c12ff6d8e5fc4dc9a98e0ab1dec6ea7efbb7 + docs/models/customer-credit-schema.md: + id: fa77c00fcafd + last_write_checksum: sha1:adf6bb711b3cfd99d84da8977c3005cb3baa24e1 + pristine_git_object: de538f3a711b297dcba238dd7db908ee881dae7f + docs/models/customer-display.md: + id: 58fadfb6f84d + last_write_checksum: sha1:02389782a6f3873571e7a8866eed09a5cc6098f5 + pristine_git_object: d86e56fea265fbd888ae6d62a570f54aa883be0a docs/models/customer-duration-type.md: id: cbfbb0769db5 last_write_checksum: sha1:5cc7fc548fc238c2c4db1517e1192dc036a74139 @@ -141,18 +154,26 @@ trackedFiles: id: 1730127f931b last_write_checksum: sha1:1d88fca3d4cc3cdcb78a1a46a91039b9d2f323c0 pristine_git_object: fd2e47dfff6dba01fbad342c2de102c69d44643f + docs/models/customer-feature.md: + id: d90579a4e5c4 + last_write_checksum: sha1:2571ed92544e364abe99128501011d5745ee3267 + pristine_git_object: a5179d50af3036734719b4158358e7dd6cd730c6 docs/models/customer-interval-enum.md: id: b224f2bcbf4b last_write_checksum: sha1:ef6926633f780442c7a7bce1a12c230465f3d6ad pristine_git_object: 7c66977ea25849ef3b234b4944d04e3e9dfd6219 + docs/models/customer-interval-union.md: + id: 19eb9860227e + last_write_checksum: sha1:8382a134d2408871763ba53f7cd484d6bca64350 + pristine_git_object: 51b233d363c22a95561c44c811ec71721339edac docs/models/customer-price.md: id: 8eec49124dd8 last_write_checksum: sha1:297d12a534c20d11365f454a0f225f6b63c40f17 pristine_git_object: 88a0feb0eb977e6bb085f3c0af1327ffef946036 docs/models/customer-reset.md: id: 27ef7dbfdae8 - last_write_checksum: sha1:957eb20d5f65413f434c0a29534124b51ee85c01 - pristine_git_object: 3c8ff205558e5ec80a059bd695ccd5cdc930abac + last_write_checksum: sha1:326f09990ff11b053ab2f1d74bf401de7d4a1be0 + pristine_git_object: d9fa2417ea1c8f119ebf31421585f27b61ff647d docs/models/customer-rollover.md: id: fe5a77432fc0 last_write_checksum: sha1:018ac63c30698124f84c74b763e81c17fe946ed5 @@ -167,24 +188,40 @@ trackedFiles: pristine_git_object: adb4e6a216daf5fe4f5e1566821240b1406007e1 docs/models/customer.md: id: 42ac97d31359 - last_write_checksum: sha1:177f9e80f86abcbf82d34ac230f78e26eb8afe05 - pristine_git_object: 3df262773e09df832a517056728d2add293693e2 + last_write_checksum: sha1:9d3f9fa3d14b9a85ee6e8bb245e213768ebc4da2 + pristine_git_object: d7c1b370d1bdab1832f7315616c7b5dae45661e6 + docs/models/delete-customer-globals.md: + id: e2b2740e2b2d + last_write_checksum: sha1:92a62a15010425dfd1b008717705100796c00620 + pristine_git_object: d9f546d3b5d178b7b27d2435d62b16b883d99527 + docs/models/delete-customer-params.md: + id: c88234813e6b + last_write_checksum: sha1:a51d64c47a21085c89a4134c4f3ec1290fb52888 + pristine_git_object: 19992e26dcd5990155b223d0100623302030d667 + docs/models/delete-customer-response.md: + id: 7f761e2b18cf + last_write_checksum: sha1:b525944202b47c959409d3e0e13edcd0eaa0ecdd + pristine_git_object: e019f8f1bbf3f5a24efe970442fc712d61517c3b docs/models/discount.md: id: 003b28f6c8a6 - last_write_checksum: sha1:fe89c4a5f07986dc1fd721b026218e7c96c2c63c - pristine_git_object: ea251e97cc69c9984c3c53295a03285a72541476 + last_write_checksum: sha1:514d11ebc37ebdb692a8137be44b60d35549cfb7 + pristine_git_object: 1cd19465e5e2ccba85d1117383cbb3ee6cae7763 docs/models/duration.md: id: e63d42c932a8 last_write_checksum: sha1:3ebfb271ff5182a27635748d8c7e3d9594fef510 pristine_git_object: e70c1be447f86b333b4cc601f7b8859ad5da92a8 + docs/models/entity-data.md: + id: 83395488e4e5 + last_write_checksum: sha1:384acbee9aecd8ead6c66ed3f6fc02375ebb54e5 + pristine_git_object: 115ceca1d43eef8b4b2ff57ea3986552a925a5c7 docs/models/entity-env.md: id: 817aa096ab27 last_write_checksum: sha1:e57c22c174cf8744c9fbc793a21c87eab86ba81a pristine_git_object: ea4e92658978c0c7494a04f24e0f2e9276baaaac docs/models/entity.md: id: 903c73579a5c - last_write_checksum: sha1:d45c1e98846cb22fa28b885b66bf4d341947673f - pristine_git_object: 5445e914a693e4bfa626d820fdba75a41b7b002d + last_write_checksum: sha1:3d90d8923798be834d241db6e33846dbbac2cfdf + pristine_git_object: 2ea16cf6f98cf4b2085ace4dae3ff34cbbe45f9f docs/models/expiry-duration-type.md: id: 3a927f275515 last_write_checksum: sha1:7059b0a8efd82cdb43c176b868824f5e26d8eb0c @@ -193,34 +230,122 @@ trackedFiles: id: 7d40737b76e3 last_write_checksum: sha1:ab8208a5a5ab8963a8c8fa7f93dfdd9cd068f6c4 pristine_git_object: 4600b15c1d50b17c86bfde5df59541dd36c152e1 + docs/models/get-or-create-customer-globals.md: + id: 4dd584e66362 + last_write_checksum: sha1:2f39158f4225bc4e4fbc5507304a0654c7a2af79 + pristine_git_object: 8419a8f3939aaf954b914edbb98bb2595c114dd6 docs/models/get-or-create-customer-params.md: id: 496662dd4c0d last_write_checksum: sha1:5bac80cea5c986ca03ff3d732070e618c39663f9 pristine_git_object: 570053b312dc0a87a05f1b71f815fae814697a7f - docs/models/get-or-create-globals.md: - id: 8474dc7dbc80 - last_write_checksum: sha1:7a65f90b8e52bfdd196c95737a4c200cf8146e48 - pristine_git_object: 86cb64fd78529421d0fe9ac65b7059aae7a1815a docs/models/included-usage.md: id: f27abcdfdd7d last_write_checksum: sha1:ca0a41260fa62322a9525f4267ac0ec6d93ae6d8 pristine_git_object: 5fe6a61067cd319d6cd0d1e1e7f1d165c0d4579d - docs/models/interval.md: - id: 11a74d2c19c0 - last_write_checksum: sha1:1d612bf1b73e7b6f54c8086bf13964ae62496463 - pristine_git_object: 6bd470a06b95cb33d5f2b2f4f4a609dbbae9a544 docs/models/invoice.md: id: 18e2034f11ad - last_write_checksum: sha1:72f2f97f724891e9af6123a5c2826181328b494f - pristine_git_object: f7338b19bded9bd82efc9687fafc03c2a02bf371 + last_write_checksum: sha1:321079a7eab955ee497e7879908a4c2e9ee446b2 + pristine_git_object: 39f3d1c3ab247ec4559923d5191fff971b8e5572 + docs/models/item-display.md: + id: d61d169a3333 + last_write_checksum: sha1:f0b2a0f71689c8a4736b7e759b0c6792404e4539 + pristine_git_object: fd1bde59e45b72b398f15ce7848f04c6cd766f12 + docs/models/item-feature-display.md: + id: 727688f35d0c + last_write_checksum: sha1:a7a4d3a4f3d7ca8b44daf4f3a9edaae5711b8177 + pristine_git_object: 939d71918b327e8d91e1a64725de39960432c26c docs/models/item-price.md: id: ec7f6a9f6ac5 last_write_checksum: sha1:9d5ea14c2b3845ed4489ac33fbdfa391d1bc6def pristine_git_object: 0d853a9a3abbd1aede8b939c43f23adab900f6b7 docs/models/item.md: id: 40dd7473ab87 - last_write_checksum: sha1:81e925dbb597518a2a3975856f56ee346e73a11f - pristine_git_object: 8f8d120e33c446a1134415a84ac24f5641a50885 + last_write_checksum: sha1:c2b45b5e5d9b2bfee2a5b08fc40bc722fd64227f + pristine_git_object: 2e6034a049e9cb9f120a94dd8d389f9bec2c46ab + docs/models/list-customers-balances.md: + id: 46cd8155bb0e + last_write_checksum: sha1:1d670bb537ecaffe2f48ced508c1cf672b2ade03 + pristine_git_object: 57123fe519103cc83169e9ddaa0a7fcbaa15d94d + docs/models/list-customers-billing-method.md: + id: 0d3398dec326 + last_write_checksum: sha1:f13e148e053d42bde8430b3fda4803bf7163f77c + pristine_git_object: 3ddd429f50edea95c30f8d0f163aca6e809e74da + docs/models/list-customers-breakdown.md: + id: ccf93d67f0e0 + last_write_checksum: sha1:c57363b82b82a2630374718c21832b4cc8f4dedc + pristine_git_object: e24c52777169794b632e0838ea0c4f6c88734fc2 + docs/models/list-customers-credit-schema.md: + id: bd8c18aa56d6 + last_write_checksum: sha1:7a96afb453ef3df9964ffa03fa62738c2185353d + pristine_git_object: e330bdaabfb8b7a9fff196174ed9ad8ec8b9e910 + docs/models/list-customers-display.md: + id: d0f0d28734d1 + last_write_checksum: sha1:daa1680664227795668a4d590eb39a13e880918e + pristine_git_object: 65ade27850f03064d68fd803ea1b6005eae1cd2e + docs/models/list-customers-env.md: + id: aa422f2f068e + last_write_checksum: sha1:2813f4b038dd5a0145a4904890f8e87bc83ae53b + pristine_git_object: ae3dc7884d8884306e3df9310c093ec681637681 + docs/models/list-customers-feature.md: + id: e66feeb7ba38 + last_write_checksum: sha1:8ea956d31fa73dd4a5c22956c8e1cb1aedeae3c0 + pristine_git_object: 2f16077933c2b628365efc79088d89fd3381fad3 + docs/models/list-customers-globals.md: + id: b1ab90baa295 + last_write_checksum: sha1:b89d70a4cfec57491c4af6b821acc506036a6114 + pristine_git_object: 8b5163cedee225b4b80be05037d7267d2f952b6c + docs/models/list-customers-interval-enum.md: + id: 39d50967de54 + last_write_checksum: sha1:9b53e2c1f1f8eb7b86be1a5fc272fc698e5c5ec5 + pristine_git_object: 532eb231bc4265e68cd708cf6fa961ca157b2ac1 + docs/models/list-customers-interval-union.md: + id: df32c8ba2c0f + last_write_checksum: sha1:05df9b4b7c1feb2e1fc476c47be4991fd1c52cb0 + pristine_git_object: 9f90f9e8b1e95bc793ac1665907026096fc41594 + docs/models/list-customers-params.md: + id: 2a01311d59ad + last_write_checksum: sha1:099d1b5f75f7c95f6ea79caf42a4a09e3e75f865 + pristine_git_object: 9f5cf2275199ec0a71dafe1f5563ac38fb8233b9 + docs/models/list-customers-plan.md: + id: 1dd1eb060144 + last_write_checksum: sha1:32c36fb64ec7f7463b72bf1b7cc8d94524288dd0 + pristine_git_object: 4b478123d07c00bf4b2c64a5cdbf9abb6e62d4c6 + docs/models/list-customers-price.md: + id: 550a843b57e8 + last_write_checksum: sha1:4c73576b961e987151695a50b28d814fe420e829 + pristine_git_object: 9093cb2a1901944d472afa8a8b3b386aaf7030ff + docs/models/list-customers-purchase.md: + id: d650442c19db + last_write_checksum: sha1:6ab974c1b43afd4c0aa7ec780e136abb25371f0e + pristine_git_object: 15a224ea137cd118e80acc0a8a64e5c0d7779169 + docs/models/list-customers-reset.md: + id: 6db31dd08290 + last_write_checksum: sha1:b01b4709a0c8aa2624fcb3a7871acfdfe0578f36 + pristine_git_object: 95dda29ba204003ac1541ad08ba8b084b3000236 + docs/models/list-customers-response.md: + id: a8afc03241c9 + last_write_checksum: sha1:f1fe9816d19c3546bc072a51b709b34b78278fb3 + pristine_git_object: 42ef6f2334aa5e4d49b1230dbd137e27d79ded77 + docs/models/list-customers-rollover.md: + id: 5cfdb990f867 + last_write_checksum: sha1:93262b341fc92d299fa78f9d83aa5d552be9a706 + pristine_git_object: e297b53d161144af333221f9a0730126bc101403 + docs/models/list-customers-status.md: + id: a101fc59dad3 + last_write_checksum: sha1:4468f2e7993bb0917e444392fb28f421d4d6cd44 + pristine_git_object: 6972de2eca4078bb4625f20946d8163bf915e623 + docs/models/list-customers-subscription.md: + id: e5c39bdff7de + last_write_checksum: sha1:b3ea35bea7d20edefca920d7cb3f10cccba93dbc + pristine_git_object: 678d509b7e78c0b2400de6c4a6e2b7ff2c5f85f3 + docs/models/list-customers-tier.md: + id: 6b79b434f75f + last_write_checksum: sha1:d8b70b33bc066203ea74421f493644bb13e5a886 + pristine_git_object: d536bc8dfeaa66aa2d4db518cc1b8b35e19fad3a + docs/models/list-customers-type.md: + id: 0800cbc8ca9e + last_write_checksum: sha1:ce41b4d4a6a56c5f9612079fff6040c13caa239d + pristine_git_object: 98cd871a2608aea5ad1c414eb845d27245073dc6 docs/models/list-globals.md: id: 58d9bcee8a08 last_write_checksum: sha1:0c51ff1aa46dce6a17238f78ae70a44b721139a3 @@ -233,6 +358,10 @@ trackedFiles: id: 48cf4c13bc7c last_write_checksum: sha1:6e56fc971cedd32ce4c73c5245a00a49bad7ff87 pristine_git_object: e3f663592de4496899a850db184a442d4ac7d020 + docs/models/list.md: + id: 8b31ed970535 + last_write_checksum: sha1:95b239cec1d8ccb8567d63da23de51f72f32d472 + pristine_git_object: 76fdf5d305ba1493108c579791c5836713ee20e8 docs/models/on-decrease.md: id: 101f3c344c1f last_write_checksum: sha1:b8ddb1671b4362bc1aac1936914e10aa554414e5 @@ -249,6 +378,10 @@ trackedFiles: id: 4789ae90ae01 last_write_checksum: sha1:8b53127c48cd1e81a29d62093ae96a52359b268a pristine_git_object: 930e05fe377d4ab12fd2b0245af950d9fd637967 + docs/models/plan-credit-schema.md: + id: 4a323c1dbf0a + last_write_checksum: sha1:167acec310caca3e8e3b1cd5461c5453994f09c9 + pristine_git_object: 9dfd58042a96b6de19c6f5f3a21319e1806a35a0 docs/models/plan-duration-type.md: id: 522f79a4e1c8 last_write_checksum: sha1:6265d10215e91bb4846f1f7648293cf04530d3d2 @@ -257,10 +390,14 @@ trackedFiles: id: 2684553fa0b2 last_write_checksum: sha1:43ecc2f0ae7ad2dd6acdbf3ea9a5c779855ede8a pristine_git_object: 73febb8eb90f0795e0bbcf16621698de452a1f41 + docs/models/plan-feature.md: + id: 1f1e65046cf0 + last_write_checksum: sha1:820bbac98f8f88db0a4ca8b7e731f64250f067aa + pristine_git_object: ef116371d9b52bf50a2f9be6b3fd11c6dc6ac3e3 docs/models/plan-price.md: id: f24c0778a8d1 - last_write_checksum: sha1:507311eb39a5936fd9bc44830d86ec0e5bd8dd22 - pristine_git_object: bce113caf172ed0bddd6f24b0cd6dd6779b490b8 + last_write_checksum: sha1:f0ad29bd2ec5a67f789192a2a417dd03ec213d93 + pristine_git_object: 3281c16938de8837e0285cd2d93f989953c5e305 docs/models/plan-reset-interval.md: id: 3ae21ed47961 last_write_checksum: sha1:957ef7145ffd6a231785068b66c82109dade812e @@ -285,10 +422,18 @@ trackedFiles: id: 265b5d85de02 last_write_checksum: sha1:73ba2dc4aa70a0e8dd181c625d49e195512a5aa8 pristine_git_object: 7a48160543abf02c3620bd86ccb7150bc32dad8f + docs/models/plan-type.md: + id: fcf04293a720 + last_write_checksum: sha1:8a55b776c10325c521c94693c2301c3d35865204 + pristine_git_object: e573a1e61915a219fc68d1e31dd55c795dda4253 docs/models/plan.md: id: 900c4149ef4b - last_write_checksum: sha1:429d233584eef116d3b165d6c09a050c1f9fc20a - pristine_git_object: 8b12eea5ba974880103edaa1a30a498ed3191124 + last_write_checksum: sha1:08f56cb8cac6d89aba2436975994c1648d8d286d + pristine_git_object: c02b9a57fbf832794d06b60296903c7304bddb55 + docs/models/price-display.md: + id: e7cc8364bc4b + last_write_checksum: sha1:f7d122e7b7776cdcffbc40fd2ced81a215d89c23 + pristine_git_object: 9fd5718215ab2855e209fdd606611f33fbf42562 docs/models/price-interval.md: id: 098d30620284 last_write_checksum: sha1:2f1acca2ad16f4709fb7cb72a869505a18826bbc @@ -311,20 +456,24 @@ trackedFiles: pristine_git_object: 4f29bd931311fec97a473b5bf61b12edcb7da7b9 docs/models/referral-customer.md: id: d9629d974163 - last_write_checksum: sha1:d12745723bb0c0cf3cbdfad581ca4dabf9323685 - pristine_git_object: e4978f3af0c093684838ec97443ae4bfb668ad3e + last_write_checksum: sha1:e4dab25dd04e413f338e813241694e88cb29c09f + pristine_git_object: 9537eddc4601bf6752271bc008cf8d9c93637781 docs/models/referral.md: id: b58def2d8bbe - last_write_checksum: sha1:4a205e661d3b742293132c8151388e72df5069b0 - pristine_git_object: 50e78acb13c4e157062623894c2e24fc497872c0 + last_write_checksum: sha1:6147d00b05240ea19ab4a012e37012501462790e + pristine_git_object: 6133ec7c2af5271b41ce09dddfb0eb8cbeb14418 docs/models/required-action.md: id: d4ddcbc1c128 last_write_checksum: sha1:c8f6235625f02d16392e0bbe5a671a2e534532b1 pristine_git_object: a3ae9b548a71e115f7b0c1924d256b9d7ce35553 + docs/models/rewards-type.md: + id: c48adeacd4fc + last_write_checksum: sha1:fc8c460d22c515495d54385f2b0ea1f045605e26 + pristine_git_object: ca2e4f7e35d62a3bfc3658e8c3e20dbdc6e0ed70 docs/models/rewards.md: id: 4551c882db3e - last_write_checksum: sha1:7238c7de53b3e40b56d4f7207f84b5813069fc7c - pristine_git_object: dd7ce5d168ac8811cb85dc3e4d61f917ef4f0dd3 + last_write_checksum: sha1:400f48d09c30265fc4650ca42db90109dfdda599 + pristine_git_object: 08b89a9cc150d2d174408e0ccb7d2eea9b8e4014 docs/models/scenario.md: id: e3aad8ab5efa last_write_checksum: sha1:5d6f7c24e821bf73b9ea5f4915448acc27c0f84f @@ -337,6 +486,10 @@ trackedFiles: id: 959cd204aadf last_write_checksum: sha1:e317fd6c26662da3d7a86188280bb120bf1e6f60 pristine_git_object: 041eaf0d0962f12510d4d8c8031ad3cd9cd7d5b8 + docs/models/subscription-status.md: + id: 041b9e856b18 + last_write_checksum: sha1:1aabc380fe08ae6fb74c04e205c079831c70f0fb + pristine_git_object: ae011837937def92a382e601b7285fae1151f38a docs/models/subscription.md: id: 4a200793e0f4 last_write_checksum: sha1:97dacf3bcc58a132384b9066f7e5c292c601cdd3 @@ -349,10 +502,90 @@ trackedFiles: id: 983b78eb51b7 last_write_checksum: sha1:0fdc1753311eb276ea3d69f275f9bafaf196e538 pristine_git_object: 72df6cb602ecac3658f8cbb19ea2c460995b7a4a - docs/models/type.md: - id: 98c32f09b2c8 - last_write_checksum: sha1:4cd3d065f419718c7d6883a133111999832246cc - pristine_git_object: 6f4d6d7fdd81d3ab6e3a41fc239af15d811f4bfe + docs/models/update-customer-balances.md: + id: 1bfa8c6cffed + last_write_checksum: sha1:4d0032ada0430399279f5fd8f7c27906c6211626 + pristine_git_object: 011ff0fe532ae95af0738f860353ad9e097e3ce9 + docs/models/update-customer-billing-method.md: + id: 88c216b41cc9 + last_write_checksum: sha1:3bb481957c5c6c49eafbf6f203f509f5b7e2cd58 + pristine_git_object: 8ce9fde5f55f832e49db75595f2d8ce9043491ac + docs/models/update-customer-breakdown.md: + id: f58ab0f6bff1 + last_write_checksum: sha1:15dae25ce69e028151ceb3fea98a1c8b540aed53 + pristine_git_object: a39a9da7e62530194a691bc5587b94df8253d336 + docs/models/update-customer-credit-schema.md: + id: 3cf3ff338501 + last_write_checksum: sha1:ab98468adfe3343dadcaf47c557f168345bfe0d2 + pristine_git_object: 88678d850a0bfc88371fb08b4732eda12b9b7cbe + docs/models/update-customer-display.md: + id: add1d657b760 + last_write_checksum: sha1:7225349a16c09fc14065b97c9900545bb944d716 + pristine_git_object: a467d361fcc4c0af7848e2587bab9ffff07c9a56 + docs/models/update-customer-env.md: + id: d418dfa14402 + last_write_checksum: sha1:d325228f92f006cadbaa962906f743d8ba5e0a1e + pristine_git_object: 43114cf33fd88602a5997e6575e4a30af88001e8 + docs/models/update-customer-feature.md: + id: 168e1b65d4aa + last_write_checksum: sha1:cc7c910d313598ad01b4489a3cf2d37ddbea8202 + pristine_git_object: 91b2ad87ba67757f5310b0739ac637255fafc816 + docs/models/update-customer-globals.md: + id: 143999995aa3 + last_write_checksum: sha1:68ee60cc1c95d8bae04f3df054e154eba1adad69 + pristine_git_object: 2c4647647c8e127048ff63b32b2525ad7bdeabbd + docs/models/update-customer-interval-enum.md: + id: 9d1646824693 + last_write_checksum: sha1:5069ecf0c65031090c4e8e945edf527083a43d6f + pristine_git_object: 5de2b03937db317630b628227e45e8f0234470c5 + docs/models/update-customer-interval-union.md: + id: c1080c322f1e + last_write_checksum: sha1:568f89e9dd14bfd44f0ec6ba3f486de1d7b27edd + pristine_git_object: 84e1f9a870da26c402c13bad823e51f8d49c827e + docs/models/update-customer-params.md: + id: b0eaa77673a7 + last_write_checksum: sha1:1e27c616f406a48b12d45adb7fba648e6cb82ca7 + pristine_git_object: 802aecaeb59cf78d2b7fae123eb22e771779650b + docs/models/update-customer-price.md: + id: dd3d29a936fd + last_write_checksum: sha1:82bea2ad66a537a7e60efa88f693cc55e1816bde + pristine_git_object: 0c19b42f6a2f4cc199161329533d08af813b9a69 + docs/models/update-customer-purchase.md: + id: b4c8c530ba2c + last_write_checksum: sha1:0e49dfe18dd6fdcfa8bf7bb71fb09c18a4ca8ef5 + pristine_git_object: 1977be2342b8ad291d7fcb9fd63e39102f1b170e + docs/models/update-customer-reset.md: + id: "728535289868" + last_write_checksum: sha1:dee58d03e84af1db74a0cd958ee44d942bbf1e43 + pristine_git_object: 2409db3ca717177224e94bdcc701a7c3c76782a7 + docs/models/update-customer-response.md: + id: 605a24a7d121 + last_write_checksum: sha1:ca554e09227c2edbe92a42914c6391511057ad1e + pristine_git_object: 60066e6c25ec487d6b3d9a7aa18ff566818a3a50 + docs/models/update-customer-rollover.md: + id: 3bebebf04665 + last_write_checksum: sha1:924d0bd4ba861322b711cdfe27cd114832951cf6 + pristine_git_object: c48f80df1ab0902c154341ccadee9965aaf443a6 + docs/models/update-customer-status.md: + id: 37adfd15b5dc + last_write_checksum: sha1:3ec6b8db6cf520dc9865e71dffb37b26e77588e8 + pristine_git_object: 50b58dd4f2237b2f0894759691961a886c7cf2ef + docs/models/update-customer-subscription.md: + id: "412049526229" + last_write_checksum: sha1:da8806e70ff66876187e85502f17369e5aaf0722 + pristine_git_object: db98114fe9d9a546194c2625e632ce8625ac0627 + docs/models/update-customer-tier.md: + id: 6416a7c50e28 + last_write_checksum: sha1:c86e861e69241388caf84c8e48edd85b12654c0e + pristine_git_object: e7a0834fc83283a491580dfb4425623f34af20b0 + docs/models/update-customer-to.md: + id: 0c85ec79b9a7 + last_write_checksum: sha1:7acae1ed7471305afdb3d95dab29692c25d51ec6 + pristine_git_object: f7297920dbf2285644965f0c57ba52e3fa9c10d2 + docs/models/update-customer-type.md: + id: 875a45ee72f2 + last_write_checksum: sha1:dc08a53346fdcf1560ea9519b84e2463d5d60cd5 + pristine_git_object: f5d1f7937c5730af0c1a470da9ab49d35dc68ab1 docs/models/usage-model.md: id: 32a269601e79 last_write_checksum: sha1:e5426aec062e39992d0a277844320dcce769247e @@ -363,8 +596,8 @@ trackedFiles: pristine_git_object: 6736de1838264c53e45c3ecc0171a5d59b7f2ca6 docs/sdks/customers/README.md: id: 9332759cffc2 - last_write_checksum: sha1:63e6af1b2c380806e67a371a1cf8a1adca199de0 - pristine_git_object: f1b8887234d1e057ca7b410846b03f918dd289b9 + last_write_checksum: sha1:7930b4ac0fb91678c10042de7bd31b6746a27386 + pristine_git_object: 27524f8546807f0a9e388be6314b54dea34cef44 docs/sdks/plans/README.md: id: 2d8c741fff57 last_write_checksum: sha1:3611895f9b87e480540dbac3c793f7305874949a @@ -391,12 +624,12 @@ trackedFiles: pristine_git_object: 900d545ed58929951e2208e1bec791cb264429a4 jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:a6cf6bc99595187ac88b823a14b3cd2a21b737de - pristine_git_object: f084f662c3534e5d9791554b293c9dca2337e9b1 + last_write_checksum: sha1:54f31b8f9f812cd42b3d41fee1cfca4bb00c7859 + pristine_git_object: dbe800c6e4e40f5be5de8f895f5c554d60aed47c package.json: id: 7030d0b2f71b - last_write_checksum: sha1:548e2e513b07e02d255ff7314841f2c5591c6f97 - pristine_git_object: 0ea76af20417b6b26cda76661d276ecbca8f60af + last_write_checksum: sha1:37c3e27815c759dd941a69bd1fa3426044ac0822 + pristine_git_object: c249735becb26adab319b912b678033d27819691 src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:f8f24a3ca09c1efb285d7a75ad3697d0128f47e2 @@ -405,10 +638,22 @@ trackedFiles: id: c23b3cd15f32 last_write_checksum: sha1:c395283b839cfc83f5d491a205fa215a93905e2a pristine_git_object: 39530e4ed42ffca2b0aac9727d446ec10e21754d + src/funcs/customers-delete.ts: + id: 92955b4ca056 + last_write_checksum: sha1:14160671d93a76cca245a45c25d8465f2e39acd0 + pristine_git_object: 97ab0552c007b0eb7c55d34684aa17e36d60b217 src/funcs/customers-get-or-create.ts: id: e47fc41cfecc - last_write_checksum: sha1:ec27c34d0213af5788698234f15c4ef5d1b78184 - pristine_git_object: ac7fefd7056c38b0570b3ca4d80785173a228def + last_write_checksum: sha1:ec931c7c1495580f9847c94e92a6ef415621d4c5 + pristine_git_object: d6b6592efc87375f814eb85a71e1dad1a9f21027 + src/funcs/customers-list.ts: + id: 97f381c7d9f0 + last_write_checksum: sha1:06aacf6e29eccaa29e79b05b3673271e10c38682 + pristine_git_object: 73658311d68574c77e0c7f6590610ad7d3734d5e + src/funcs/customers-update.ts: + id: 56f7739cc333 + last_write_checksum: sha1:a8486cfb7daaa2a6fa86dcdb74cc77f998068fb3 + pristine_git_object: d2e5861773eb1ef3cb84012dfa9a99de6d70304f src/funcs/plans-list.ts: id: ee004b08a26a last_write_checksum: sha1:1f3b8206ab056c57b4fc3b720b426c57f494b911 @@ -435,8 +680,8 @@ trackedFiles: pristine_git_object: 44be0eae8246521b230e8e711a88eff738fc015d src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:574782be9ed7ea34956c0c78e3b9e88101415b4f - pristine_git_object: fad97239094e1b286c8284ad5ed49c8e37ba4468 + last_write_checksum: sha1:a68fb04d6102d387a27ba5c828e3e4fbbf3737a7 + pristine_git_object: 594f827c40e765ddc32e26e2289b736c52ec48d4 src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:1dd3e3fbb4550c4bf31f5ef997faff355d6f3250 @@ -495,8 +740,8 @@ trackedFiles: pristine_git_object: f3a8de6c021de59c991707946cd294596cae954d src/models/attach-op.ts: id: 83ed65c26ab4 - last_write_checksum: sha1:bcb938761d3fde5cdb99972f5d3a1e217ae04064 - pristine_git_object: c21e0da461bc1693209f241aa7f0583d46befa5e + last_write_checksum: sha1:9cea79e693c014b41735ed009342f92c87857509 + pristine_git_object: f6b63b9feae508e125f3ceeddbbe239a54b549f5 src/models/autumn-default-error.ts: id: 2528aa7886eb last_write_checksum: sha1:4cce18f91be3262ada7d11dcd6326544e2341b58 @@ -511,28 +756,36 @@ trackedFiles: pristine_git_object: b6a303e11f4d5964b94379a470104d00ff8fb5cc src/models/customer.ts: id: 20be78c552a4 - last_write_checksum: sha1:1e62b5e3dc777ebecac4909ab72ab93e4576b380 - pristine_git_object: 036a131058981bf1e54dc3d0f5b005fb710cec61 - src/models/get-or-create-op.ts: - id: c9bf055f57c4 - last_write_checksum: sha1:40fa9030712cc39e5cb6d847546282c93da9866a - pristine_git_object: 6adb75311f5d00821820a877a4cca8ce0cffce7a + last_write_checksum: sha1:834fdd87d593fe97b8d00680f1f868571e814aec + pristine_git_object: 85200c4624b20c9991cd822a07f6f4c070e0c752 + src/models/delete-customer-op.ts: + id: 5a0865a96e72 + last_write_checksum: sha1:c13b51ffb77a1436b29b76a21686c69813c1e81d + pristine_git_object: 3b3187da0e7556b1c0cb43c912be28387438794c + src/models/get-or-create-customer-op.ts: + id: 46f8f65a57f2 + last_write_checksum: sha1:26098d6226df14b07bfd4b9c886000a2d3d82bd1 + pristine_git_object: 438cc17a1f829e2d6ccede223c04cf0fef9f9838 src/models/http-client-errors.ts: id: 5f17dcf0d62b last_write_checksum: sha1:994ced121c54fecd0af038ccfb7855fbfd3868ec pristine_git_object: b34f612124c797c2a1106b9735708f679a90b74f src/models/index.ts: id: f93644b0f37e - last_write_checksum: sha1:36ee9413a2066c5d94112101ab304b5a45122f68 - pristine_git_object: 7c2df887629f35b47f1a6df3f55df44934403f02 + last_write_checksum: sha1:61097437617261e9fe2b9a35c94fcf27109c4962 + pristine_git_object: d67de8030aba72a27ceccfd7a070534093504166 + src/models/list-customers-op.ts: + id: b391692c8429 + last_write_checksum: sha1:5f940428ca63d4e852d4b2b63abba9f258bc4cda + pristine_git_object: dae93235f3abd02ddb5558bbaa90e260d09ba204 src/models/list-op.ts: id: e798a0a401fe last_write_checksum: sha1:f31d79e67eb8f97a17acdd76b238f8387284fdb1 pristine_git_object: 43d0cd93187b7cead79aa26cfd1e2e52d29f981b src/models/plan.ts: id: 9e9698a64fe7 - last_write_checksum: sha1:543249fe6318abf6a24e873514f989f42f7c6ac2 - pristine_git_object: 1e7d7434b24cf1d9a01126d078fbcedb2107f4c0 + last_write_checksum: sha1:4c0733b3c88b871e876f284f7ab33b2ddfa8bd9e + pristine_git_object: b7f1f9e3eaf872753e8da372f393a3f40b9907e0 src/models/response-validation-error.ts: id: 7ace3beff92b last_write_checksum: sha1:2788a46874d1d2b88a1fe8352142516f2e5c9ded @@ -545,14 +798,18 @@ trackedFiles: id: d90c6c784ca5 last_write_checksum: sha1:f12af7291ebb0b6712532520d82e8d34fa86885a pristine_git_object: 3774cc1e9bbb80ac592990aa86f8d4a38ee51f29 + src/models/update-customer-op.ts: + id: 5d226d30d8e4 + last_write_checksum: sha1:2691abf4914fdc17ee2bfd41d39931aa968a894e + pristine_git_object: 249d7b1e7c1809d933e9109b5c32b9672996868c src/sdk/billing.ts: id: 10905058c4ad last_write_checksum: sha1:078d7bb748e445dceabaa9023c42a1c3dd7eb405 pristine_git_object: 3f35611958db5ea7deb47b5e4648fe935cd21d90 src/sdk/customers.ts: id: d33e193e0c00 - last_write_checksum: sha1:a052cbdbe50ccafd6f6b576ebb8ac871b019227c - pristine_git_object: cc75f3590188ce33000d7f24bedd5d077126fe67 + last_write_checksum: sha1:cec3848a0bb37429d1fd1406de436534b37c0c19 + pristine_git_object: 3f5a07797b0ff51e2b787d94486394959b6332c9 src/sdk/index.ts: id: a857902a703f last_write_checksum: sha1:ed6d64f2a6135349aa8498b8d8cff9ba85c7fb8f @@ -891,10 +1148,10 @@ examples: header: x-api-version: "2.1" requestBody: - application/json: {} + application/json: {"customer_id": "cus_123", "name": "John Doe", "email": "john@example.com"} responses: "200": - application/json: {"id": "", "name": "", "email": "Victoria.Sauer61@yahoo.com", "created_at": 3418.9, "fingerprint": "", "stripe_id": "", "env": "sandbox", "metadata": {"key": "", "key1": "", "key2": ""}, "send_email_receipts": true, "subscriptions": [], "purchases": [], "balances": {"key": {"feature_id": "", "granted": 3929.24, "remaining": 8214.93, "usage": 3544.01, "unlimited": false, "overage_allowed": false, "max_purchase": 8317.32, "next_reset_at": 7474.01}}} + application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": false, "add_on": false, "status": "active", "past_due": false, "canceled_at": 9611.97, "expires_at": 7806.81, "trial_ends_at": null, "started_at": 6124.93, "current_period_start": null, "current_period_end": 9733.97, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 8321.34, "remaining": 5.02, "usage": 8589.77, "unlimited": true, "overage_allowed": true, "max_purchase": 5498.35, "next_reset_at": 8214.93}}} listPlans: speakeasy-default-list-plans: parameters: @@ -930,5 +1187,35 @@ examples: x-api-version: "2.1" responses: "200": - application/json: {"list": [{"name": "", "description": "distant recompense trick", "group": "", "version": 9615.63, "add_on": true, "auto_enable": false, "price": {"amount": 2384.12, "interval": "week"}, "items": [{"feature_id": "", "included": 4974.83, "unlimited": false, "reset": {"interval": "day"}, "price": {"interval": "month", "billing_units": 5281.09, "billing_method": "prepaid", "max_purchase": 8873.17}}], "env": "live", "archived": true, "base_variant_id": ""}]} + application/json: {"list": [{"id": "", "name": "", "description": "distant recompense trick", "group": "", "version": 9615.63, "add_on": true, "auto_enable": false, "price": {"amount": 2384.12, "interval": "week"}, "items": [{"feature_id": "", "included": 4974.83, "unlimited": false, "reset": {"interval": "day"}, "price": {"interval": "month", "billing_units": 5281.09, "billing_method": "prepaid", "max_purchase": 8873.17}}], "created_at": 9820.05, "env": "live", "archived": true, "base_variant_id": ""}]} + listCustomers: + speakeasy-default-list-customers: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"offset": 0, "limit": 10} + responses: + "200": + application/json: {"list": [], "has_more": true, "offset": 5136.21, "limit": 2534.27, "total": 7618.77} + updateCustomer: + speakeasy-default-update-customer: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "name": "Jane Doe", "email": "jane@example.com"} + responses: + "200": + application/json: {"id": "cus_123", "name": "John Doe", "email": "john@example.com", "created_at": 1717000000, "fingerprint": "1234567890", "stripe_id": "cus_123", "env": "sandbox", "metadata": {}, "send_email_receipts": true, "subscriptions": [{"plan_id": "plan_123", "auto_enable": true, "add_on": true, "status": "active", "past_due": true, "canceled_at": 8303.59, "expires_at": 2755.88, "trial_ends_at": 1461.02, "started_at": 1649.05, "current_period_start": 8034.1, "current_period_end": 8058.66, "quantity": 1}], "purchases": [], "balances": {"balance_1": {"feature_id": "", "granted": 7559.37, "remaining": 952.25, "usage": 7029.24, "unlimited": true, "overage_allowed": true, "max_purchase": 7619.46, "next_reset_at": 411.76}}} + deleteCustomer: + speakeasy-default-delete-customer: + parameters: + header: + x-api-version: "2.1" + requestBody: + application/json: {"customer_id": "cus_123", "delete_in_stripe": false} + responses: + "200": + application/json: {"success": true} examplesVersion: 1.0.2 diff --git a/packages/sdk/.speakeasy/gen.yaml b/packages/sdk/.speakeasy/gen.yaml index 46c8aee1a..d6cb55d5d 100644 --- a/packages/sdk/.speakeasy/gen.yaml +++ b/packages/sdk/.speakeasy/gen.yaml @@ -33,7 +33,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: false typescript: - version: 0.7.29 + version: 0.8.11 acceptHeaderEnum: false additionalDependencies: dependencies: {} diff --git a/packages/sdk/.speakeasy/out.openapi.yaml b/packages/sdk/.speakeasy/out.openapi.yaml index c28ddd715..df1fd99a8 100644 --- a/packages/sdk/.speakeasy/out.openapi.yaml +++ b/packages/sdk/.speakeasy/out.openapi.yaml @@ -26,6 +26,11 @@ components: Customer: type: object properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. name: anyOf: - type: string @@ -36,6 +41,9 @@ components: - type: string - type: "null" description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. fingerprint: anyOf: - type: string @@ -147,6 +155,55 @@ components: properties: feature_id: type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived granted: type: number remaining: @@ -171,6 +228,9 @@ components: items: type: object properties: + id: + type: string + default: "" plan_id: anyOf: - type: string @@ -304,6 +364,9 @@ components: currency: type: string description: The currency code for the invoice + created_at: + type: number + description: Timestamp when the invoice was created hosted_invoice_url: anyOf: - type: string @@ -315,11 +378,19 @@ components: - status - total - currency + - created_at entities: type: array items: type: object properties: + autumn_id: + type: string + id: + anyOf: + - type: string + - type: "null" + description: The unique identifier of the entity name: anyOf: - type: string @@ -335,13 +406,18 @@ components: - type: string - type: "null" description: The feature ID this entity belongs to + created_at: + type: number + description: Unix timestamp when the entity was created env: enum: - sandbox - live description: The environment (sandbox/live) required: + - id - name + - created_at - env trials_used: type: array @@ -368,6 +444,9 @@ components: items: type: object properties: + id: + type: string + description: The unique identifier for this discount name: type: string description: The name of the discount or coupon @@ -418,6 +497,7 @@ components: - type: "null" description: Total amount saved from this discount required: + - id - name - type - discount_value @@ -436,6 +516,8 @@ components: customer: type: object properties: + id: + type: string name: anyOf: - type: string @@ -444,20 +526,26 @@ components: anyOf: - type: string - type: "null" - required: [] + required: + - id reward_applied: type: boolean + created_at: + type: number required: - program_id - customer - reward_applied + - created_at payment_method: anyOf: - {} - type: "null" required: + - id - name - email + - created_at - fingerprint - stripe_id - env @@ -494,6 +582,8 @@ components: Plan: type: object properties: + id: + type: string name: type: string description: @@ -526,6 +616,15 @@ components: - year interval_count: type: number + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text required: - amount - interval @@ -537,6 +636,65 @@ components: properties: feature_id: type: string + feature: + type: object + properties: + id: + type: string + description: The ID of the feature, used to refer to it in other API calls like /track or /check. + name: + anyOf: + - type: string + - type: "null" + description: The name of the feature. + type: + enum: + - static + - boolean + - single_use + - continuous_use + - credit_system + description: The type of the feature + display: + anyOf: + - type: object + properties: + singular: + type: string + description: The singular display name for the feature. + plural: + type: string + description: The plural display name for the feature. + required: + - singular + - plural + - type: "null" + description: Singular and plural display names for the feature. + credit_schema: + anyOf: + - type: array + items: + type: object + properties: + metered_feature_id: + type: string + description: The ID of the metered feature (should be a single_use feature). + credit_cost: + type: number + description: The credit cost of the metered feature. + required: + - metered_feature_id + - credit_cost + - type: "null" + description: Credit cost schema for credit system features. + archived: + anyOf: + - type: boolean + - type: "null" + description: Whether or not the feature is archived. + required: + - id + - type included: type: number unlimited: @@ -607,6 +765,15 @@ components: - billing_method - max_purchase - type: "null" + display: + type: object + properties: + primary_text: + type: string + secondary_text: + type: string + required: + - primary_text rollover: type: object properties: @@ -661,6 +828,8 @@ components: - duration_length - duration_type - card_required + created_at: + type: number env: enum: - sandbox @@ -690,6 +859,7 @@ components: required: - scenario required: + - id - name - description - group @@ -698,6 +868,7 @@ components: - auto_enable - price - items + - created_at - env - archived - base_variant_id @@ -709,28 +880,8 @@ components: paths: /v1/customers.getOrCreate: post: - operationId: getOrCreate - description: >- - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - - - Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - - - @example - - ```typescript - - // Create or fetch a customer by external ID - - const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); - ``` + operationId: getOrCreateCustomer + description: Creates a customer if they do not exist, or returns the existing customer by your external customer ID. tags: - customers requestBody: @@ -801,6 +952,7 @@ paths: application/json: schema: $ref: "#/components/schemas/Customer" + x-speakeasy-name-override: getOrCreate parameters: - &a1 name: x-api-version @@ -810,6 +962,861 @@ paths: type: string default: "2.1" x-speakeasy-globals-hidden: true + /v1/customers.list: + post: + operationId: listCustomers + description: Lists customers with pagination and optional filters. + tags: + - customers + requestBody: + required: false + content: + application/json: + schema: + type: object + properties: + offset: + type: integer + minimum: 0 + maximum: 9.007199254740991e+15 + default: 0 + description: Number of items to skip + limit: + type: integer + minimum: 1 + maximum: 1000 + default: 10 + description: Number of items to return. Default 10, max 1000. + plans: + type: array + items: + type: object + properties: + id: + type: string + versions: + type: array + items: + type: number + required: + - id + description: Filter by plan ID and version. Returns customers with active subscriptions to this plan. + subscription_status: + enum: + - active + - scheduled + description: Filter by customer product status. Defaults to active and scheduled + search: + type: string + description: Search customers by id, name, or email + title: ListCustomersParams + examples: + - limit: 10 + offset: 0 + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + list: + type: array + items: + type: object + properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. + name: + anyOf: + - type: string + - type: "null" + description: The name of the customer. + email: + anyOf: + - type: string + - type: "null" + description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. + fingerprint: + anyOf: + - type: string + - type: "null" + description: "A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID." + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID. + env: + enum: + - sandbox + - live + description: The environment this customer was created in. + metadata: + type: object + propertyNames: {} + additionalProperties: {} + description: The metadata for the customer. + send_email_receipts: + type: boolean + description: Whether to send email receipts to the customer. + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - {} + - {} + amount: + type: number + required: + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + description: Array of items for current page + has_more: + type: boolean + description: Whether more results exist after this page + offset: + type: number + description: Current offset position + limit: + type: number + description: Limit passed in the request + total: + type: number + description: Total number of items returned in the current page + required: + - list + - has_more + - offset + - limit + - total + x-speakeasy-name-override: list + parameters: + - *a1 + /v1/customers.update: + post: + operationId: updateCustomer + description: Updates an existing customer by ID. + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + title: CustomerId + description: ID of the customer to update + name: + anyOf: + - type: string + - type: "null" + description: Customer's name + email: + anyOf: + - type: string + format: email + - type: "null" + description: Customer's email address + fingerprint: + anyOf: + - type: string + - type: "null" + description: Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + metadata: + anyOf: + - type: object + propertyNames: + type: string + additionalProperties: {} + - type: "null" + description: Additional metadata for the customer + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID if you already have one + send_email_receipts: + type: boolean + description: Whether to send email receipts to this customer + new_customer_id: + $ref: "#/components/schemas/CustomerId" + description: New ID for the customer + required: + - customer_id + title: UpdateCustomerParams + examples: + - customer_id: cus_123 + name: Jane Doe + email: jane@example.com + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + id: + anyOf: + - type: string + - type: "null" + description: Your unique identifier for the customer. + name: + anyOf: + - type: string + - type: "null" + description: The name of the customer. + email: + anyOf: + - type: string + - type: "null" + description: The email address of the customer. + created_at: + type: number + description: Timestamp of customer creation in milliseconds since epoch. + fingerprint: + anyOf: + - type: string + - type: "null" + description: "A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID." + stripe_id: + anyOf: + - type: string + - type: "null" + description: Stripe customer ID. + env: + enum: + - sandbox + - live + description: The environment this customer was created in. + metadata: + type: object + propertyNames: {} + additionalProperties: {} + description: The metadata for the customer. + send_email_receipts: + type: boolean + description: Whether to send email receipts to the customer. + subscriptions: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + auto_enable: + type: boolean + add_on: + type: boolean + status: + enum: + - active + - scheduled + - expired + past_due: + type: boolean + canceled_at: + anyOf: + - type: number + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + trial_ends_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + current_period_start: + anyOf: + - type: number + - type: "null" + current_period_end: + anyOf: + - type: number + - type: "null" + quantity: + type: number + required: + - plan_id + - auto_enable + - add_on + - status + - past_due + - canceled_at + - expires_at + - trial_ends_at + - started_at + - current_period_start + - current_period_end + - quantity + purchases: + type: array + items: + type: object + properties: + plan: + $ref: "#/components/schemas/Plan" + plan_id: + type: string + expires_at: + anyOf: + - type: number + - type: "null" + started_at: + type: number + quantity: + type: number + required: + - plan_id + - expires_at + - started_at + - quantity + balances: + type: object + propertyNames: + type: string + additionalProperties: + type: object + properties: + feature_id: + type: string + feature: + type: object + properties: + id: + type: string + name: + type: string + type: + enum: + - boolean + - metered + - credit_system + consumable: + type: boolean + event_names: + type: array + items: + type: string + credit_schema: + type: array + items: + type: object + properties: + metered_feature_id: + type: string + credit_cost: + type: number + required: + - metered_feature_id + - credit_cost + display: + type: object + properties: + singular: + anyOf: + - type: string + - type: "null" + plural: + anyOf: + - type: string + - type: "null" + archived: + type: boolean + required: + - id + - name + - type + - consumable + - archived + granted: + type: number + remaining: + type: number + minimum: 0 + usage: + type: number + unlimited: + type: boolean + overage_allowed: + type: boolean + max_purchase: + anyOf: + - type: number + - type: "null" + next_reset_at: + anyOf: + - type: number + - type: "null" + breakdown: + type: array + items: + type: object + properties: + id: + type: string + default: "" + plan_id: + anyOf: + - type: string + - type: "null" + included_grant: + type: number + prepaid_grant: + type: number + remaining: + type: number + usage: + type: number + unlimited: + type: boolean + reset: + anyOf: + - type: object + properties: + interval: + anyOf: + - enum: + - one_off + - minute + - hour + - day + - week + - month + - quarter + - semi_annual + - year + - const: multiple + interval_count: + type: number + resets_at: + anyOf: + - type: number + - type: "null" + required: + - interval + - resets_at + - type: "null" + price: + anyOf: + - type: object + properties: + amount: + type: number + tiers: + type: array + items: + type: object + properties: + to: + anyOf: + - type: number + - const: inf + amount: + type: number + required: + - to + - amount + billing_units: + type: number + billing_method: + enum: + - prepaid + - usage_based + max_purchase: + anyOf: + - type: number + - type: "null" + required: + - billing_units + - billing_method + - max_purchase + - type: "null" + expires_at: + anyOf: + - type: number + - type: "null" + required: + - plan_id + - included_grant + - prepaid_grant + - remaining + - usage + - unlimited + - reset + - price + - expires_at + rollovers: + type: array + items: + type: object + properties: + balance: + type: number + expires_at: + type: number + required: + - balance + - expires_at + required: + - feature_id + - granted + - remaining + - usage + - unlimited + - overage_allowed + - max_purchase + - next_reset_at + required: + - id + - name + - email + - created_at + - fingerprint + - stripe_id + - env + - metadata + - send_email_receipts + - subscriptions + - purchases + - balances + x-speakeasy-name-override: update + parameters: + - *a1 + /v1/customers.delete: + post: + operationId: deleteCustomer + description: Deletes a customer by ID. + tags: + - customers + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + customer_id: + type: string + title: CustomerId + description: ID of the customer to delete + delete_in_stripe: + type: boolean + default: false + description: Whether to also delete the customer in Stripe + required: + - customer_id + title: DeleteCustomerParams + examples: + - customer_id: cus_123 + delete_in_stripe: false + responses: + "200": + description: OK + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + required: + - success + x-speakeasy-name-override: delete + parameters: + - *a1 /v1/products: get: operationId: list @@ -844,6 +1851,21 @@ paths: schema: type: object properties: + entity_id: + anyOf: + - type: string + - type: "null" + entity_data: + type: object + properties: + feature_id: + type: string + description: The feature ID that this entity is associated with + name: + type: string + description: Name of the entity + required: + - feature_id options: anyOf: - type: array @@ -1009,6 +2031,8 @@ paths: properties: customer_id: type: string + entity_id: + type: string invoice: type: object properties: diff --git a/packages/sdk/.speakeasy/workflow.lock b/packages/sdk/.speakeasy/workflow.lock index 1172fce8e..06903b5a8 100644 --- a/packages/sdk/.speakeasy/workflow.lock +++ b/packages/sdk/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.719.0 sources: Autumn API: sourceNamespace: autumn-api - sourceRevisionDigest: sha256:c513dea6b35ac61359bca574daa51591c99bff6a4f70884f17daadbaf9038068 - sourceBlobDigest: sha256:8a6566a50fa1a128ddee4e115b79ed58cf3f17a1602ee4cf2a706b4f8900d5e7 + sourceRevisionDigest: sha256:371d6b86b6dc06a7c259b4a6d241446d1715bc9fa9dde539d30590f7e3e59762 + sourceBlobDigest: sha256:767c878e76e5d6f4a7bf7780dce4c81986005925ea6f672c1a65251c87e392e2 tags: - latest - 2.1.0 @@ -18,10 +18,10 @@ targets: autumn-python: source: Autumn API sourceNamespace: autumn-api - sourceRevisionDigest: sha256:c513dea6b35ac61359bca574daa51591c99bff6a4f70884f17daadbaf9038068 - sourceBlobDigest: sha256:8a6566a50fa1a128ddee4e115b79ed58cf3f17a1602ee4cf2a706b4f8900d5e7 + sourceRevisionDigest: sha256:371d6b86b6dc06a7c259b4a6d241446d1715bc9fa9dde539d30590f7e3e59762 + sourceBlobDigest: sha256:767c878e76e5d6f4a7bf7780dce4c81986005925ea6f672c1a65251c87e392e2 codeSamplesNamespace: autumn-api-python-code-samples - codeSamplesRevisionDigest: sha256:6dce177dbc4f46c58cec13dfc4ebc6de316e2acf6950663061725f88e10aa414 + codeSamplesRevisionDigest: sha256:9f22c2c28f60ee571a84de660ef3bda4fbc9f286d520482fcd8732ca6b9a7510 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/packages/sdk/README.md b/packages/sdk/README.md index c2a1c7d7c..5781efd45 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -156,20 +156,9 @@ run(); ### [Customers](docs/sdks/customers/README.md) * [getOrCreate](docs/sdks/customers/README.md#getorcreate) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` +* [list](docs/sdks/customers/README.md#list) - Lists customers with pagination and optional filters. +* [update](docs/sdks/customers/README.md#update) - Updates an existing customer by ID. +* [delete](docs/sdks/customers/README.md#delete) - Deletes a customer by ID. ### [Plans](docs/sdks/plans/README.md) @@ -194,21 +183,10 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). Available standalone functions - [`billingAttach`](docs/sdks/billing/README.md#attach) +- [`customersDelete`](docs/sdks/customers/README.md#delete) - Deletes a customer by ID. - [`customersGetOrCreate`](docs/sdks/customers/README.md#getorcreate) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` +- [`customersList`](docs/sdks/customers/README.md#list) - Lists customers with pagination and optional filters. +- [`customersUpdate`](docs/sdks/customers/README.md#update) - Updates an existing customer by ID. - [`plansList`](docs/sdks/plans/README.md#list) - List Plans diff --git a/packages/sdk/docs/models/attach-request.md b/packages/sdk/docs/models/attach-request.md index 50a550a22..3b3e1b463 100644 --- a/packages/sdk/docs/models/attach-request.md +++ b/packages/sdk/docs/models/attach-request.md @@ -14,6 +14,8 @@ let value: AttachRequest = { | Field | Type | Required | Description | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `entityId` | *string* | :heavy_minus_sign: | N/A | +| `entityData` | [models.EntityData](../models/entity-data.md) | :heavy_minus_sign: | N/A | | `options` | [models.Options](../models/options.md)[] | :heavy_minus_sign: | N/A | | `version` | *number* | :heavy_minus_sign: | N/A | | `freeTrial` | [models.AttachFreeTrial](../models/attach-free-trial.md) | :heavy_minus_sign: | N/A | diff --git a/packages/sdk/docs/models/attach-response.md b/packages/sdk/docs/models/attach-response.md index b3eec4c3f..2c48f0863 100644 --- a/packages/sdk/docs/models/attach-response.md +++ b/packages/sdk/docs/models/attach-response.md @@ -18,6 +18,7 @@ let value: AttachResponse = { | Field | Type | Required | Description | | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | | `customerId` | *string* | :heavy_check_mark: | N/A | +| `entityId` | *string* | :heavy_minus_sign: | N/A | | `invoice` | [models.AttachInvoice](../models/attach-invoice.md) | :heavy_minus_sign: | N/A | | `paymentUrl` | *string* | :heavy_check_mark: | N/A | | `requiredAction` | [models.RequiredAction](../models/required-action.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/balances.md b/packages/sdk/docs/models/balances.md index 3cecc0799..fd59d3018 100644 --- a/packages/sdk/docs/models/balances.md +++ b/packages/sdk/docs/models/balances.md @@ -22,6 +22,7 @@ let value: Balances = { | Field | Type | Required | Description | | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | | `featureId` | *string* | :heavy_check_mark: | N/A | +| `feature` | [models.CustomerFeature](../models/customer-feature.md) | :heavy_minus_sign: | N/A | | `granted` | *number* | :heavy_check_mark: | N/A | | `remaining` | *number* | :heavy_check_mark: | N/A | | `usage` | *number* | :heavy_check_mark: | N/A | diff --git a/packages/sdk/docs/models/breakdown.md b/packages/sdk/docs/models/breakdown.md index be7b8808f..f6bdbd480 100644 --- a/packages/sdk/docs/models/breakdown.md +++ b/packages/sdk/docs/models/breakdown.md @@ -29,6 +29,7 @@ let value: Breakdown = { | Field | Type | Required | Description | | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | | `planId` | *string* | :heavy_check_mark: | N/A | | `includedGrant` | *number* | :heavy_check_mark: | N/A | | `prepaidGrant` | *number* | :heavy_check_mark: | N/A | diff --git a/packages/sdk/docs/models/customer-balances-type.md b/packages/sdk/docs/models/customer-balances-type.md new file mode 100644 index 000000000..56317c9af --- /dev/null +++ b/packages/sdk/docs/models/customer-balances-type.md @@ -0,0 +1,17 @@ +# CustomerBalancesType + +## Example Usage + +```typescript +import { CustomerBalancesType } from "@useautumn/sdk"; + +let value: CustomerBalancesType = "boolean"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"boolean" | "metered" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-credit-schema.md b/packages/sdk/docs/models/customer-credit-schema.md new file mode 100644 index 000000000..de538f3a7 --- /dev/null +++ b/packages/sdk/docs/models/customer-credit-schema.md @@ -0,0 +1,19 @@ +# CustomerCreditSchema + +## Example Usage + +```typescript +import { CustomerCreditSchema } from "@useautumn/sdk"; + +let value: CustomerCreditSchema = { + meteredFeatureId: "", + creditCost: 4.76, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `meteredFeatureId` | *string* | :heavy_check_mark: | N/A | +| `creditCost` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-display.md b/packages/sdk/docs/models/customer-display.md new file mode 100644 index 000000000..d86e56fea --- /dev/null +++ b/packages/sdk/docs/models/customer-display.md @@ -0,0 +1,16 @@ +# CustomerDisplay + +## Example Usage + +```typescript +import { CustomerDisplay } from "@useautumn/sdk"; + +let value: CustomerDisplay = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `singular` | *string* | :heavy_minus_sign: | N/A | +| `plural` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer-feature.md b/packages/sdk/docs/models/customer-feature.md new file mode 100644 index 000000000..a5179d50a --- /dev/null +++ b/packages/sdk/docs/models/customer-feature.md @@ -0,0 +1,28 @@ +# CustomerFeature + +## Example Usage + +```typescript +import { CustomerFeature } from "@useautumn/sdk"; + +let value: CustomerFeature = { + id: "", + name: "", + type: "metered", + consumable: false, + archived: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.CustomerBalancesType](../models/customer-balances-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.CustomerCreditSchema](../models/customer-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.CustomerDisplay](../models/customer-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/interval.md b/packages/sdk/docs/models/customer-interval-union.md similarity index 89% rename from packages/sdk/docs/models/interval.md rename to packages/sdk/docs/models/customer-interval-union.md index 6bd470a06..51b233d36 100644 --- a/packages/sdk/docs/models/interval.md +++ b/packages/sdk/docs/models/customer-interval-union.md @@ -1,4 +1,4 @@ -# Interval +# CustomerIntervalUnion ## Supported Types diff --git a/packages/sdk/docs/models/customer-reset.md b/packages/sdk/docs/models/customer-reset.md index 3c8ff2055..d9fa2417e 100644 --- a/packages/sdk/docs/models/customer-reset.md +++ b/packages/sdk/docs/models/customer-reset.md @@ -13,8 +13,8 @@ let value: CustomerReset = { ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `interval` | *models.Interval* | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | -| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | +| `interval` | *models.CustomerIntervalUnion* | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | +| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/customer.md b/packages/sdk/docs/models/customer.md index 3df262773..d7c1b370d 100644 --- a/packages/sdk/docs/models/customer.md +++ b/packages/sdk/docs/models/customer.md @@ -6,8 +6,10 @@ import { Customer } from "@useautumn/sdk"; let value: Customer = { + id: "cus_123", name: "John Doe", email: "john@example.com", + createdAt: 1717000000, fingerprint: "1234567890", stripeId: "cus_123", env: "sandbox", @@ -49,8 +51,10 @@ let value: Customer = { | Field | Type | Required | Description | | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Your unique identifier for the customer. | | `name` | *string* | :heavy_check_mark: | The name of the customer. | | `email` | *string* | :heavy_check_mark: | The email address of the customer. | +| `createdAt` | *number* | :heavy_check_mark: | Timestamp of customer creation in milliseconds since epoch. | | `fingerprint` | *string* | :heavy_check_mark: | A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. | | `stripeId` | *string* | :heavy_check_mark: | Stripe customer ID. | | `env` | [models.CustomerEnv](../models/customer-env.md) | :heavy_check_mark: | The environment this customer was created in. | diff --git a/packages/sdk/docs/models/delete-customer-globals.md b/packages/sdk/docs/models/delete-customer-globals.md new file mode 100644 index 000000000..d9f546d3b --- /dev/null +++ b/packages/sdk/docs/models/delete-customer-globals.md @@ -0,0 +1,15 @@ +# DeleteCustomerGlobals + +## Example Usage + +```typescript +import { DeleteCustomerGlobals } from "@useautumn/sdk"; + +let value: DeleteCustomerGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/delete-customer-params.md b/packages/sdk/docs/models/delete-customer-params.md new file mode 100644 index 000000000..19992e26d --- /dev/null +++ b/packages/sdk/docs/models/delete-customer-params.md @@ -0,0 +1,18 @@ +# DeleteCustomerParams + +## Example Usage + +```typescript +import { DeleteCustomerParams } from "@useautumn/sdk"; + +let value: DeleteCustomerParams = { + customerId: "cus_123", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| `customerId` | *string* | :heavy_check_mark: | ID of the customer to delete | +| `deleteInStripe` | *boolean* | :heavy_minus_sign: | Whether to also delete the customer in Stripe | \ No newline at end of file diff --git a/packages/sdk/docs/models/delete-customer-response.md b/packages/sdk/docs/models/delete-customer-response.md new file mode 100644 index 000000000..e019f8f1b --- /dev/null +++ b/packages/sdk/docs/models/delete-customer-response.md @@ -0,0 +1,19 @@ +# DeleteCustomerResponse + +OK + +## Example Usage + +```typescript +import { DeleteCustomerResponse } from "@useautumn/sdk"; + +let value: DeleteCustomerResponse = { + success: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `success` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/discount.md b/packages/sdk/docs/models/discount.md index ea251e97c..1cd19465e 100644 --- a/packages/sdk/docs/models/discount.md +++ b/packages/sdk/docs/models/discount.md @@ -6,6 +6,7 @@ import { Discount } from "@useautumn/sdk"; let value: Discount = { + id: "", name: "", type: "free_product", discountValue: 8208.57, @@ -17,8 +18,9 @@ let value: Discount = { | Field | Type | Required | Description | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | The unique identifier for this discount | | `name` | *string* | :heavy_check_mark: | The name of the discount or coupon | -| `type` | [models.Type](../models/type.md) | :heavy_check_mark: | The type of reward | +| `type` | [models.RewardsType](../models/rewards-type.md) | :heavy_check_mark: | The type of reward | | `discountValue` | *number* | :heavy_check_mark: | The discount value (percentage or fixed amount) | | `durationType` | [models.CustomerDurationType](../models/customer-duration-type.md) | :heavy_check_mark: | How long the discount lasts | | `durationValue` | *number* | :heavy_minus_sign: | Number of billing periods the discount applies for repeating durations | diff --git a/packages/sdk/docs/models/entity-data.md b/packages/sdk/docs/models/entity-data.md new file mode 100644 index 000000000..115ceca1d --- /dev/null +++ b/packages/sdk/docs/models/entity-data.md @@ -0,0 +1,18 @@ +# EntityData + +## Example Usage + +```typescript +import { EntityData } from "@useautumn/sdk"; + +let value: EntityData = { + featureId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | The feature ID that this entity is associated with | +| `name` | *string* | :heavy_minus_sign: | Name of the entity | \ No newline at end of file diff --git a/packages/sdk/docs/models/entity.md b/packages/sdk/docs/models/entity.md index 5445e914a..2ea16cf6f 100644 --- a/packages/sdk/docs/models/entity.md +++ b/packages/sdk/docs/models/entity.md @@ -6,7 +6,9 @@ import { Entity } from "@useautumn/sdk"; let value: Entity = { + id: "", name: "", + createdAt: 4436.47, env: "sandbox", }; ``` @@ -15,7 +17,10 @@ let value: Entity = { | Field | Type | Required | Description | | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `autumnId` | *string* | :heavy_minus_sign: | N/A | +| `id` | *string* | :heavy_check_mark: | The unique identifier of the entity | | `name` | *string* | :heavy_check_mark: | The name of the entity | | `customerId` | *string* | :heavy_minus_sign: | The customer ID this entity belongs to | | `featureId` | *string* | :heavy_minus_sign: | The feature ID this entity belongs to | +| `createdAt` | *number* | :heavy_check_mark: | Unix timestamp when the entity was created | | `env` | [models.EntityEnv](../models/entity-env.md) | :heavy_check_mark: | The environment (sandbox/live) | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-or-create-customer-globals.md b/packages/sdk/docs/models/get-or-create-customer-globals.md new file mode 100644 index 000000000..8419a8f39 --- /dev/null +++ b/packages/sdk/docs/models/get-or-create-customer-globals.md @@ -0,0 +1,15 @@ +# GetOrCreateCustomerGlobals + +## Example Usage + +```typescript +import { GetOrCreateCustomerGlobals } from "@useautumn/sdk"; + +let value: GetOrCreateCustomerGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/invoice.md b/packages/sdk/docs/models/invoice.md index f7338b19b..39f3d1c3a 100644 --- a/packages/sdk/docs/models/invoice.md +++ b/packages/sdk/docs/models/invoice.md @@ -11,6 +11,7 @@ let value: Invoice = { status: "", total: 9115.15, currency: "New Zealand Dollar", + createdAt: 1973.3, }; ``` @@ -23,4 +24,5 @@ let value: Invoice = { | `status` | *string* | :heavy_check_mark: | The status of the invoice | | `total` | *number* | :heavy_check_mark: | The total amount of the invoice | | `currency` | *string* | :heavy_check_mark: | The currency code for the invoice | +| `createdAt` | *number* | :heavy_check_mark: | Timestamp when the invoice was created | | `hostedInvoiceUrl` | *string* | :heavy_minus_sign: | URL to the Stripe-hosted invoice page | \ No newline at end of file diff --git a/packages/sdk/docs/models/item-display.md b/packages/sdk/docs/models/item-display.md new file mode 100644 index 000000000..fd1bde59e --- /dev/null +++ b/packages/sdk/docs/models/item-display.md @@ -0,0 +1,18 @@ +# ItemDisplay + +## Example Usage + +```typescript +import { ItemDisplay } from "@useautumn/sdk"; + +let value: ItemDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `primaryText` | *string* | :heavy_check_mark: | N/A | +| `secondaryText` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/item-feature-display.md b/packages/sdk/docs/models/item-feature-display.md new file mode 100644 index 000000000..939d71918 --- /dev/null +++ b/packages/sdk/docs/models/item-feature-display.md @@ -0,0 +1,19 @@ +# ItemFeatureDisplay + +## Example Usage + +```typescript +import { ItemFeatureDisplay } from "@useautumn/sdk"; + +let value: ItemFeatureDisplay = { + singular: "", + plural: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `singular` | *string* | :heavy_check_mark: | The singular display name for the feature. | +| `plural` | *string* | :heavy_check_mark: | The plural display name for the feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/item.md b/packages/sdk/docs/models/item.md index 8f8d120e3..2e6034a04 100644 --- a/packages/sdk/docs/models/item.md +++ b/packages/sdk/docs/models/item.md @@ -26,9 +26,11 @@ let value: Item = { | Field | Type | Required | Description | | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | | `featureId` | *string* | :heavy_check_mark: | N/A | +| `feature` | [models.PlanFeature](../models/plan-feature.md) | :heavy_minus_sign: | N/A | | `included` | *number* | :heavy_check_mark: | N/A | | `unlimited` | *boolean* | :heavy_check_mark: | N/A | | `reset` | [models.PlanReset](../models/plan-reset.md) | :heavy_check_mark: | N/A | | `price` | [models.ItemPrice](../models/item-price.md) | :heavy_check_mark: | N/A | +| `display` | [models.ItemDisplay](../models/item-display.md) | :heavy_minus_sign: | N/A | | `rollover` | [models.PlanRollover](../models/plan-rollover.md) | :heavy_minus_sign: | N/A | | `proration` | [models.Proration](../models/proration.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-balances.md b/packages/sdk/docs/models/list-customers-balances.md new file mode 100644 index 000000000..57123fe51 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-balances.md @@ -0,0 +1,34 @@ +# ListCustomersBalances + +## Example Usage + +```typescript +import { ListCustomersBalances } from "@useautumn/sdk"; + +let value: ListCustomersBalances = { + featureId: "", + granted: 2638.08, + remaining: 7638.23, + usage: 7770.47, + unlimited: false, + overageAllowed: false, + maxPurchase: 1309.81, + nextResetAt: 1108.02, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `featureId` | *string* | :heavy_check_mark: | N/A | +| `feature` | [models.ListCustomersFeature](../models/list-customers-feature.md) | :heavy_minus_sign: | N/A | +| `granted` | *number* | :heavy_check_mark: | N/A | +| `remaining` | *number* | :heavy_check_mark: | N/A | +| `usage` | *number* | :heavy_check_mark: | N/A | +| `unlimited` | *boolean* | :heavy_check_mark: | N/A | +| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | +| `maxPurchase` | *number* | :heavy_check_mark: | N/A | +| `nextResetAt` | *number* | :heavy_check_mark: | N/A | +| `breakdown` | [models.ListCustomersBreakdown](../models/list-customers-breakdown.md)[] | :heavy_minus_sign: | N/A | +| `rollovers` | [models.ListCustomersRollover](../models/list-customers-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-billing-method.md b/packages/sdk/docs/models/list-customers-billing-method.md new file mode 100644 index 000000000..3ddd429f5 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-billing-method.md @@ -0,0 +1,17 @@ +# ListCustomersBillingMethod + +## Example Usage + +```typescript +import { ListCustomersBillingMethod } from "@useautumn/sdk"; + +let value: ListCustomersBillingMethod = "usage_based"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-breakdown.md b/packages/sdk/docs/models/list-customers-breakdown.md new file mode 100644 index 000000000..e24c52777 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-breakdown.md @@ -0,0 +1,41 @@ +# ListCustomersBreakdown + +## Example Usage + +```typescript +import { ListCustomersBreakdown } from "@useautumn/sdk"; + +let value: ListCustomersBreakdown = { + planId: "", + includedGrant: 625.15, + prepaidGrant: 422.07, + remaining: 9195.45, + usage: 8064.71, + unlimited: true, + reset: { + interval: "week", + resetsAt: 4427.32, + }, + price: { + billingUnits: 7234.97, + billingMethod: "prepaid", + maxPurchase: 6333.52, + }, + expiresAt: 9959.62, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | N/A | +| `includedGrant` | *number* | :heavy_check_mark: | N/A | +| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | +| `remaining` | *number* | :heavy_check_mark: | N/A | +| `usage` | *number* | :heavy_check_mark: | N/A | +| `unlimited` | *boolean* | :heavy_check_mark: | N/A | +| `reset` | [models.ListCustomersReset](../models/list-customers-reset.md) | :heavy_check_mark: | N/A | +| `price` | [models.ListCustomersPrice](../models/list-customers-price.md) | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-credit-schema.md b/packages/sdk/docs/models/list-customers-credit-schema.md new file mode 100644 index 000000000..e330bdaab --- /dev/null +++ b/packages/sdk/docs/models/list-customers-credit-schema.md @@ -0,0 +1,19 @@ +# ListCustomersCreditSchema + +## Example Usage + +```typescript +import { ListCustomersCreditSchema } from "@useautumn/sdk"; + +let value: ListCustomersCreditSchema = { + meteredFeatureId: "", + creditCost: 2167.76, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `meteredFeatureId` | *string* | :heavy_check_mark: | N/A | +| `creditCost` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-display.md b/packages/sdk/docs/models/list-customers-display.md new file mode 100644 index 000000000..65ade2785 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-display.md @@ -0,0 +1,16 @@ +# ListCustomersDisplay + +## Example Usage + +```typescript +import { ListCustomersDisplay } from "@useautumn/sdk"; + +let value: ListCustomersDisplay = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `singular` | *string* | :heavy_minus_sign: | N/A | +| `plural` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-env.md b/packages/sdk/docs/models/list-customers-env.md new file mode 100644 index 000000000..ae3dc7884 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-env.md @@ -0,0 +1,19 @@ +# ListCustomersEnv + +The environment this customer was created in. + +## Example Usage + +```typescript +import { ListCustomersEnv } from "@useautumn/sdk"; + +let value: ListCustomersEnv = "live"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-feature.md b/packages/sdk/docs/models/list-customers-feature.md new file mode 100644 index 000000000..2f1607793 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-feature.md @@ -0,0 +1,28 @@ +# ListCustomersFeature + +## Example Usage + +```typescript +import { ListCustomersFeature } from "@useautumn/sdk"; + +let value: ListCustomersFeature = { + id: "", + name: "", + type: "metered", + consumable: false, + archived: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.ListCustomersType](../models/list-customers-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.ListCustomersCreditSchema](../models/list-customers-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.ListCustomersDisplay](../models/list-customers-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/get-or-create-globals.md b/packages/sdk/docs/models/list-customers-globals.md similarity index 72% rename from packages/sdk/docs/models/get-or-create-globals.md rename to packages/sdk/docs/models/list-customers-globals.md index 86cb64fd7..8b5163ced 100644 --- a/packages/sdk/docs/models/get-or-create-globals.md +++ b/packages/sdk/docs/models/list-customers-globals.md @@ -1,11 +1,11 @@ -# GetOrCreateGlobals +# ListCustomersGlobals ## Example Usage ```typescript -import { GetOrCreateGlobals } from "@useautumn/sdk"; +import { ListCustomersGlobals } from "@useautumn/sdk"; -let value: GetOrCreateGlobals = {}; +let value: ListCustomersGlobals = {}; ``` ## Fields diff --git a/packages/sdk/docs/models/list-customers-interval-enum.md b/packages/sdk/docs/models/list-customers-interval-enum.md new file mode 100644 index 000000000..532eb231b --- /dev/null +++ b/packages/sdk/docs/models/list-customers-interval-enum.md @@ -0,0 +1,17 @@ +# ListCustomersIntervalEnum + +## Example Usage + +```typescript +import { ListCustomersIntervalEnum } from "@useautumn/sdk"; + +let value: ListCustomersIntervalEnum = "quarter"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-interval-union.md b/packages/sdk/docs/models/list-customers-interval-union.md new file mode 100644 index 000000000..9f90f9e8b --- /dev/null +++ b/packages/sdk/docs/models/list-customers-interval-union.md @@ -0,0 +1,17 @@ +# ListCustomersIntervalUnion + + +## Supported Types + +### `models.ListCustomersIntervalEnum` + +```typescript +const value: models.ListCustomersIntervalEnum = "minute"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/list-customers-params.md b/packages/sdk/docs/models/list-customers-params.md new file mode 100644 index 000000000..9f5cf2275 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-params.md @@ -0,0 +1,19 @@ +# ListCustomersParams + +## Example Usage + +```typescript +import { ListCustomersParams } from "@useautumn/sdk"; + +let value: ListCustomersParams = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `offset` | *number* | :heavy_minus_sign: | Number of items to skip | +| `limit` | *number* | :heavy_minus_sign: | Number of items to return. Default 10, max 1000. | +| `plans` | [models.ListCustomersPlan](../models/list-customers-plan.md)[] | :heavy_minus_sign: | Filter by plan ID and version. Returns customers with active subscriptions to this plan. | +| `subscriptionStatus` | [models.SubscriptionStatus](../models/subscription-status.md) | :heavy_minus_sign: | Filter by customer product status. Defaults to active and scheduled | +| `search` | *string* | :heavy_minus_sign: | Search customers by id, name, or email | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-plan.md b/packages/sdk/docs/models/list-customers-plan.md new file mode 100644 index 000000000..4b478123d --- /dev/null +++ b/packages/sdk/docs/models/list-customers-plan.md @@ -0,0 +1,18 @@ +# ListCustomersPlan + +## Example Usage + +```typescript +import { ListCustomersPlan } from "@useautumn/sdk"; + +let value: ListCustomersPlan = { + id: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | +| `versions` | *number*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-price.md b/packages/sdk/docs/models/list-customers-price.md new file mode 100644 index 000000000..9093cb2a1 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-price.md @@ -0,0 +1,23 @@ +# ListCustomersPrice + +## Example Usage + +```typescript +import { ListCustomersPrice } from "@useautumn/sdk"; + +let value: ListCustomersPrice = { + billingUnits: 7963.03, + billingMethod: "usage_based", + maxPurchase: 9606.84, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `tiers` | [models.ListCustomersTier](../models/list-customers-tier.md)[] | :heavy_minus_sign: | N/A | +| `billingUnits` | *number* | :heavy_check_mark: | N/A | +| `billingMethod` | [models.ListCustomersBillingMethod](../models/list-customers-billing-method.md) | :heavy_check_mark: | N/A | +| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-purchase.md b/packages/sdk/docs/models/list-customers-purchase.md new file mode 100644 index 000000000..15a224ea1 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-purchase.md @@ -0,0 +1,24 @@ +# ListCustomersPurchase + +## Example Usage + +```typescript +import { ListCustomersPurchase } from "@useautumn/sdk"; + +let value: ListCustomersPurchase = { + planId: "", + expiresAt: 7305.07, + startedAt: 6817.18, + quantity: 6300.05, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | +| `startedAt` | *number* | :heavy_check_mark: | N/A | +| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-reset.md b/packages/sdk/docs/models/list-customers-reset.md new file mode 100644 index 000000000..95dda29ba --- /dev/null +++ b/packages/sdk/docs/models/list-customers-reset.md @@ -0,0 +1,20 @@ +# ListCustomersReset + +## Example Usage + +```typescript +import { ListCustomersReset } from "@useautumn/sdk"; + +let value: ListCustomersReset = { + interval: "", + resetsAt: 3006.21, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `interval` | *models.ListCustomersIntervalUnion* | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | +| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-response.md b/packages/sdk/docs/models/list-customers-response.md new file mode 100644 index 000000000..42ef6f233 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-response.md @@ -0,0 +1,51 @@ +# ListCustomersResponse + +OK + +## Example Usage + +```typescript +import { ListCustomersResponse } from "@useautumn/sdk"; + +let value: ListCustomersResponse = { + list: [ + { + id: "", + name: "", + email: "Cole_Kuhn@gmail.com", + createdAt: 9730.61, + fingerprint: "", + stripeId: "", + env: "live", + metadata: { + "key": "", + }, + sendEmailReceipts: true, + subscriptions: [], + purchases: [ + { + planId: "", + expiresAt: 4940.05, + startedAt: 1235.42, + quantity: 3895.4, + }, + ], + balances: {}, + }, + ], + hasMore: false, + offset: 2759.18, + limit: 4916.55, + total: 957.6, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `list` | [models.List](../models/list.md)[] | :heavy_check_mark: | Array of items for current page | +| `hasMore` | *boolean* | :heavy_check_mark: | Whether more results exist after this page | +| `offset` | *number* | :heavy_check_mark: | Current offset position | +| `limit` | *number* | :heavy_check_mark: | Limit passed in the request | +| `total` | *number* | :heavy_check_mark: | Total number of items returned in the current page | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-rollover.md b/packages/sdk/docs/models/list-customers-rollover.md new file mode 100644 index 000000000..e297b53d1 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-rollover.md @@ -0,0 +1,19 @@ +# ListCustomersRollover + +## Example Usage + +```typescript +import { ListCustomersRollover } from "@useautumn/sdk"; + +let value: ListCustomersRollover = { + balance: 8547.28, + expiresAt: 9955.79, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `balance` | *number* | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-status.md b/packages/sdk/docs/models/list-customers-status.md new file mode 100644 index 000000000..6972de2ec --- /dev/null +++ b/packages/sdk/docs/models/list-customers-status.md @@ -0,0 +1,17 @@ +# ListCustomersStatus + +## Example Usage + +```typescript +import { ListCustomersStatus } from "@useautumn/sdk"; + +let value: ListCustomersStatus = "expired"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"active" | "scheduled" | "expired" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-subscription.md b/packages/sdk/docs/models/list-customers-subscription.md new file mode 100644 index 000000000..678d509b7 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-subscription.md @@ -0,0 +1,40 @@ +# ListCustomersSubscription + +## Example Usage + +```typescript +import { ListCustomersSubscription } from "@useautumn/sdk"; + +let value: ListCustomersSubscription = { + planId: "", + autoEnable: true, + addOn: false, + status: "active", + pastDue: true, + canceledAt: 5507.54, + expiresAt: 809.35, + trialEndsAt: 981.36, + startedAt: 8496.01, + currentPeriodStart: 2876.92, + currentPeriodEnd: 7925.22, + quantity: 2056.51, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | N/A | +| `autoEnable` | *boolean* | :heavy_check_mark: | N/A | +| `addOn` | *boolean* | :heavy_check_mark: | N/A | +| `status` | [models.ListCustomersStatus](../models/list-customers-status.md) | :heavy_check_mark: | N/A | +| `pastDue` | *boolean* | :heavy_check_mark: | N/A | +| `canceledAt` | *number* | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | +| `trialEndsAt` | *number* | :heavy_check_mark: | N/A | +| `startedAt` | *number* | :heavy_check_mark: | N/A | +| `currentPeriodStart` | *number* | :heavy_check_mark: | N/A | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | N/A | +| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-tier.md b/packages/sdk/docs/models/list-customers-tier.md new file mode 100644 index 000000000..d536bc8df --- /dev/null +++ b/packages/sdk/docs/models/list-customers-tier.md @@ -0,0 +1,18 @@ +# ListCustomersTier + +## Example Usage + +```typescript +import { ListCustomersTier } from "@useautumn/sdk"; + +let value: ListCustomersTier = { + amount: 9004.91, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `to` | *any* | :heavy_minus_sign: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/list-customers-type.md b/packages/sdk/docs/models/list-customers-type.md new file mode 100644 index 000000000..98cd871a2 --- /dev/null +++ b/packages/sdk/docs/models/list-customers-type.md @@ -0,0 +1,17 @@ +# ListCustomersType + +## Example Usage + +```typescript +import { ListCustomersType } from "@useautumn/sdk"; + +let value: ListCustomersType = "credit_system"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"boolean" | "metered" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/list.md b/packages/sdk/docs/models/list.md new file mode 100644 index 000000000..76fdf5d30 --- /dev/null +++ b/packages/sdk/docs/models/list.md @@ -0,0 +1,48 @@ +# List + +## Example Usage + +```typescript +import { List } from "@useautumn/sdk"; + +let value: List = { + id: "", + name: "", + email: "Cole_Kuhn@gmail.com", + createdAt: 9730.61, + fingerprint: "", + stripeId: "", + env: "live", + metadata: { + "key": "", + }, + sendEmailReceipts: true, + subscriptions: [], + purchases: [ + { + planId: "", + expiresAt: 4940.05, + startedAt: 1235.42, + quantity: 3895.4, + }, + ], + balances: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Your unique identifier for the customer. | +| `name` | *string* | :heavy_check_mark: | The name of the customer. | +| `email` | *string* | :heavy_check_mark: | The email address of the customer. | +| `createdAt` | *number* | :heavy_check_mark: | Timestamp of customer creation in milliseconds since epoch. | +| `fingerprint` | *string* | :heavy_check_mark: | A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. | +| `stripeId` | *string* | :heavy_check_mark: | Stripe customer ID. | +| `env` | [models.ListCustomersEnv](../models/list-customers-env.md) | :heavy_check_mark: | The environment this customer was created in. | +| `metadata` | Record | :heavy_check_mark: | The metadata for the customer. | +| `sendEmailReceipts` | *boolean* | :heavy_check_mark: | Whether to send email receipts to the customer. | +| `subscriptions` | [models.ListCustomersSubscription](../models/list-customers-subscription.md)[] | :heavy_check_mark: | N/A | +| `purchases` | [models.ListCustomersPurchase](../models/list-customers-purchase.md)[] | :heavy_check_mark: | N/A | +| `balances` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-credit-schema.md b/packages/sdk/docs/models/plan-credit-schema.md new file mode 100644 index 000000000..9dfd58042 --- /dev/null +++ b/packages/sdk/docs/models/plan-credit-schema.md @@ -0,0 +1,19 @@ +# PlanCreditSchema + +## Example Usage + +```typescript +import { PlanCreditSchema } from "@useautumn/sdk"; + +let value: PlanCreditSchema = { + meteredFeatureId: "", + creditCost: 2845.35, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `meteredFeatureId` | *string* | :heavy_check_mark: | The ID of the metered feature (should be a single_use feature). | +| `creditCost` | *number* | :heavy_check_mark: | The credit cost of the metered feature. | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-feature.md b/packages/sdk/docs/models/plan-feature.md new file mode 100644 index 000000000..ef116371d --- /dev/null +++ b/packages/sdk/docs/models/plan-feature.md @@ -0,0 +1,23 @@ +# PlanFeature + +## Example Usage + +```typescript +import { PlanFeature } from "@useautumn/sdk"; + +let value: PlanFeature = { + id: "", + type: "boolean", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | The ID of the feature, used to refer to it in other API calls like /track or /check. | +| `name` | *string* | :heavy_minus_sign: | The name of the feature. | +| `type` | [models.PlanType](../models/plan-type.md) | :heavy_check_mark: | The type of the feature | +| `display` | [models.ItemFeatureDisplay](../models/item-feature-display.md) | :heavy_minus_sign: | Singular and plural display names for the feature. | +| `creditSchema` | [models.PlanCreditSchema](../models/plan-credit-schema.md)[] | :heavy_minus_sign: | Credit cost schema for credit system features. | +| `archived` | *boolean* | :heavy_minus_sign: | Whether or not the feature is archived. | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-price.md b/packages/sdk/docs/models/plan-price.md index bce113caf..3281c1693 100644 --- a/packages/sdk/docs/models/plan-price.md +++ b/packages/sdk/docs/models/plan-price.md @@ -17,4 +17,5 @@ let value: PlanPrice = { | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | | `amount` | *number* | :heavy_check_mark: | N/A | | `interval` | [models.PriceInterval](../models/price-interval.md) | :heavy_check_mark: | N/A | -| `intervalCount` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | +| `display` | [models.PriceDisplay](../models/price-display.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/plan-type.md b/packages/sdk/docs/models/plan-type.md new file mode 100644 index 000000000..e573a1e61 --- /dev/null +++ b/packages/sdk/docs/models/plan-type.md @@ -0,0 +1,19 @@ +# PlanType + +The type of the feature + +## Example Usage + +```typescript +import { PlanType } from "@useautumn/sdk"; + +let value: PlanType = "static"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"static" | "boolean" | "single_use" | "continuous_use" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/plan.md b/packages/sdk/docs/models/plan.md index 8b12eea5b..c02b9a57f 100644 --- a/packages/sdk/docs/models/plan.md +++ b/packages/sdk/docs/models/plan.md @@ -6,6 +6,7 @@ import { Plan } from "@useautumn/sdk"; let value: Plan = { + id: "", name: "", description: "deplore incomparable among because tired diligently pillow tenant pro mmm", @@ -18,7 +19,8 @@ let value: Plan = { interval: "one_off", }, items: [], - env: "sandbox", + createdAt: 3920.84, + env: "live", archived: false, baseVariantId: "", }; @@ -28,6 +30,7 @@ let value: Plan = { | Field | Type | Required | Description | | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | | `name` | *string* | :heavy_check_mark: | N/A | | `description` | *string* | :heavy_check_mark: | N/A | | `group` | *string* | :heavy_check_mark: | N/A | @@ -37,6 +40,7 @@ let value: Plan = { | `price` | [models.PlanPrice](../models/plan-price.md) | :heavy_check_mark: | N/A | | `items` | [models.Item](../models/item.md)[] | :heavy_check_mark: | N/A | | `freeTrial` | [models.FreeTrial](../models/free-trial.md) | :heavy_minus_sign: | N/A | +| `createdAt` | *number* | :heavy_check_mark: | N/A | | `env` | [models.PlanEnv](../models/plan-env.md) | :heavy_check_mark: | N/A | | `archived` | *boolean* | :heavy_check_mark: | N/A | | `baseVariantId` | *string* | :heavy_check_mark: | N/A | diff --git a/packages/sdk/docs/models/price-display.md b/packages/sdk/docs/models/price-display.md new file mode 100644 index 000000000..9fd571821 --- /dev/null +++ b/packages/sdk/docs/models/price-display.md @@ -0,0 +1,18 @@ +# PriceDisplay + +## Example Usage + +```typescript +import { PriceDisplay } from "@useautumn/sdk"; + +let value: PriceDisplay = { + primaryText: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `primaryText` | *string* | :heavy_check_mark: | N/A | +| `secondaryText` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/referral-customer.md b/packages/sdk/docs/models/referral-customer.md index e4978f3af..9537eddc4 100644 --- a/packages/sdk/docs/models/referral-customer.md +++ b/packages/sdk/docs/models/referral-customer.md @@ -5,12 +5,15 @@ ```typescript import { ReferralCustomer } from "@useautumn/sdk"; -let value: ReferralCustomer = {}; +let value: ReferralCustomer = { + id: "", +}; ``` ## Fields | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | | `name` | *string* | :heavy_minus_sign: | N/A | | `email` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/referral.md b/packages/sdk/docs/models/referral.md index 50e78acb1..6133ec7c2 100644 --- a/packages/sdk/docs/models/referral.md +++ b/packages/sdk/docs/models/referral.md @@ -7,8 +7,11 @@ import { Referral } from "@useautumn/sdk"; let value: Referral = { programId: "", - customer: {}, + customer: { + id: "", + }, rewardApplied: false, + createdAt: 6538.56, }; ``` @@ -18,4 +21,5 @@ let value: Referral = { | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | | `programId` | *string* | :heavy_check_mark: | N/A | | `customer` | [models.ReferralCustomer](../models/referral-customer.md) | :heavy_check_mark: | N/A | -| `rewardApplied` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file +| `rewardApplied` | *boolean* | :heavy_check_mark: | N/A | +| `createdAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/type.md b/packages/sdk/docs/models/rewards-type.md similarity index 74% rename from packages/sdk/docs/models/type.md rename to packages/sdk/docs/models/rewards-type.md index 6f4d6d7fd..ca2e4f7e3 100644 --- a/packages/sdk/docs/models/type.md +++ b/packages/sdk/docs/models/rewards-type.md @@ -1,13 +1,13 @@ -# Type +# RewardsType The type of reward ## Example Usage ```typescript -import { Type } from "@useautumn/sdk"; +import { RewardsType } from "@useautumn/sdk"; -let value: Type = "percentage_discount"; +let value: RewardsType = "free_product"; ``` ## Values diff --git a/packages/sdk/docs/models/rewards.md b/packages/sdk/docs/models/rewards.md index dd7ce5d16..08b89a9cc 100644 --- a/packages/sdk/docs/models/rewards.md +++ b/packages/sdk/docs/models/rewards.md @@ -8,6 +8,7 @@ import { Rewards } from "@useautumn/sdk"; let value: Rewards = { discounts: [ { + id: "", name: "", type: "invoice_credits", discountValue: 8349.54, diff --git a/packages/sdk/docs/models/subscription-status.md b/packages/sdk/docs/models/subscription-status.md new file mode 100644 index 000000000..ae0118379 --- /dev/null +++ b/packages/sdk/docs/models/subscription-status.md @@ -0,0 +1,17 @@ +# SubscriptionStatus + +Filter by customer product status. Defaults to active and scheduled + +## Example Usage + +```typescript +import { SubscriptionStatus } from "@useautumn/sdk"; + +let value: SubscriptionStatus = "scheduled"; +``` + +## Values + +```typescript +"active" | "scheduled" +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-balances.md b/packages/sdk/docs/models/update-customer-balances.md new file mode 100644 index 000000000..011ff0fe5 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-balances.md @@ -0,0 +1,34 @@ +# UpdateCustomerBalances + +## Example Usage + +```typescript +import { UpdateCustomerBalances } from "@useautumn/sdk"; + +let value: UpdateCustomerBalances = { + featureId: "", + granted: 3659.37, + remaining: 1762.52, + usage: 5915.11, + unlimited: false, + overageAllowed: false, + maxPurchase: 8309.89, + nextResetAt: 3915.29, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `featureId` | *string* | :heavy_check_mark: | N/A | +| `feature` | [models.UpdateCustomerFeature](../models/update-customer-feature.md) | :heavy_minus_sign: | N/A | +| `granted` | *number* | :heavy_check_mark: | N/A | +| `remaining` | *number* | :heavy_check_mark: | N/A | +| `usage` | *number* | :heavy_check_mark: | N/A | +| `unlimited` | *boolean* | :heavy_check_mark: | N/A | +| `overageAllowed` | *boolean* | :heavy_check_mark: | N/A | +| `maxPurchase` | *number* | :heavy_check_mark: | N/A | +| `nextResetAt` | *number* | :heavy_check_mark: | N/A | +| `breakdown` | [models.UpdateCustomerBreakdown](../models/update-customer-breakdown.md)[] | :heavy_minus_sign: | N/A | +| `rollovers` | [models.UpdateCustomerRollover](../models/update-customer-rollover.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-billing-method.md b/packages/sdk/docs/models/update-customer-billing-method.md new file mode 100644 index 000000000..8ce9fde5f --- /dev/null +++ b/packages/sdk/docs/models/update-customer-billing-method.md @@ -0,0 +1,17 @@ +# UpdateCustomerBillingMethod + +## Example Usage + +```typescript +import { UpdateCustomerBillingMethod } from "@useautumn/sdk"; + +let value: UpdateCustomerBillingMethod = "usage_based"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"prepaid" | "usage_based" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-breakdown.md b/packages/sdk/docs/models/update-customer-breakdown.md new file mode 100644 index 000000000..a39a9da7e --- /dev/null +++ b/packages/sdk/docs/models/update-customer-breakdown.md @@ -0,0 +1,41 @@ +# UpdateCustomerBreakdown + +## Example Usage + +```typescript +import { UpdateCustomerBreakdown } from "@useautumn/sdk"; + +let value: UpdateCustomerBreakdown = { + planId: "", + includedGrant: 2437.9, + prepaidGrant: 2339.29, + remaining: 5463.4, + usage: 6921.41, + unlimited: false, + reset: { + interval: "year", + resetsAt: 3469.62, + }, + price: { + billingUnits: 1078.41, + billingMethod: "prepaid", + maxPurchase: 9999.99, + }, + expiresAt: 9940.8, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | N/A | +| `includedGrant` | *number* | :heavy_check_mark: | N/A | +| `prepaidGrant` | *number* | :heavy_check_mark: | N/A | +| `remaining` | *number* | :heavy_check_mark: | N/A | +| `usage` | *number* | :heavy_check_mark: | N/A | +| `unlimited` | *boolean* | :heavy_check_mark: | N/A | +| `reset` | [models.UpdateCustomerReset](../models/update-customer-reset.md) | :heavy_check_mark: | N/A | +| `price` | [models.UpdateCustomerPrice](../models/update-customer-price.md) | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-credit-schema.md b/packages/sdk/docs/models/update-customer-credit-schema.md new file mode 100644 index 000000000..88678d850 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-credit-schema.md @@ -0,0 +1,19 @@ +# UpdateCustomerCreditSchema + +## Example Usage + +```typescript +import { UpdateCustomerCreditSchema } from "@useautumn/sdk"; + +let value: UpdateCustomerCreditSchema = { + meteredFeatureId: "", + creditCost: 7374.95, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `meteredFeatureId` | *string* | :heavy_check_mark: | N/A | +| `creditCost` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-display.md b/packages/sdk/docs/models/update-customer-display.md new file mode 100644 index 000000000..a467d361f --- /dev/null +++ b/packages/sdk/docs/models/update-customer-display.md @@ -0,0 +1,16 @@ +# UpdateCustomerDisplay + +## Example Usage + +```typescript +import { UpdateCustomerDisplay } from "@useautumn/sdk"; + +let value: UpdateCustomerDisplay = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `singular` | *string* | :heavy_minus_sign: | N/A | +| `plural` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-env.md b/packages/sdk/docs/models/update-customer-env.md new file mode 100644 index 000000000..43114cf33 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-env.md @@ -0,0 +1,19 @@ +# UpdateCustomerEnv + +The environment this customer was created in. + +## Example Usage + +```typescript +import { UpdateCustomerEnv } from "@useautumn/sdk"; + +let value: UpdateCustomerEnv = "live"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"sandbox" | "live" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-feature.md b/packages/sdk/docs/models/update-customer-feature.md new file mode 100644 index 000000000..91b2ad87b --- /dev/null +++ b/packages/sdk/docs/models/update-customer-feature.md @@ -0,0 +1,28 @@ +# UpdateCustomerFeature + +## Example Usage + +```typescript +import { UpdateCustomerFeature } from "@useautumn/sdk"; + +let value: UpdateCustomerFeature = { + id: "", + name: "", + type: "metered", + consumable: false, + archived: true, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `type` | [models.UpdateCustomerType](../models/update-customer-type.md) | :heavy_check_mark: | N/A | +| `consumable` | *boolean* | :heavy_check_mark: | N/A | +| `eventNames` | *string*[] | :heavy_minus_sign: | N/A | +| `creditSchema` | [models.UpdateCustomerCreditSchema](../models/update-customer-credit-schema.md)[] | :heavy_minus_sign: | N/A | +| `display` | [models.UpdateCustomerDisplay](../models/update-customer-display.md) | :heavy_minus_sign: | N/A | +| `archived` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-globals.md b/packages/sdk/docs/models/update-customer-globals.md new file mode 100644 index 000000000..2c4647647 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-globals.md @@ -0,0 +1,15 @@ +# UpdateCustomerGlobals + +## Example Usage + +```typescript +import { UpdateCustomerGlobals } from "@useautumn/sdk"; + +let value: UpdateCustomerGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `xApiVersion` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-interval-enum.md b/packages/sdk/docs/models/update-customer-interval-enum.md new file mode 100644 index 000000000..5de2b0393 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-interval-enum.md @@ -0,0 +1,17 @@ +# UpdateCustomerIntervalEnum + +## Example Usage + +```typescript +import { UpdateCustomerIntervalEnum } from "@useautumn/sdk"; + +let value: UpdateCustomerIntervalEnum = "month"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-interval-union.md b/packages/sdk/docs/models/update-customer-interval-union.md new file mode 100644 index 000000000..84e1f9a87 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-interval-union.md @@ -0,0 +1,17 @@ +# UpdateCustomerIntervalUnion + + +## Supported Types + +### `models.UpdateCustomerIntervalEnum` + +```typescript +const value: models.UpdateCustomerIntervalEnum = "hour"; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/update-customer-params.md b/packages/sdk/docs/models/update-customer-params.md new file mode 100644 index 000000000..802aecaeb --- /dev/null +++ b/packages/sdk/docs/models/update-customer-params.md @@ -0,0 +1,26 @@ +# UpdateCustomerParams + +## Example Usage + +```typescript +import { UpdateCustomerParams } from "@useautumn/sdk"; + +let value: UpdateCustomerParams = { + customerId: "cus_123", + name: "Jane Doe", + email: "jane@example.com", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `customerId` | *string* | :heavy_check_mark: | ID of the customer to update | +| `name` | *string* | :heavy_minus_sign: | Customer's name | +| `email` | *string* | :heavy_minus_sign: | Customer's email address | +| `fingerprint` | *string* | :heavy_minus_sign: | Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse | +| `metadata` | Record | :heavy_minus_sign: | Additional metadata for the customer | +| `stripeId` | *string* | :heavy_minus_sign: | Stripe customer ID if you already have one | +| `sendEmailReceipts` | *boolean* | :heavy_minus_sign: | Whether to send email receipts to this customer | +| `newCustomerId` | *string* | :heavy_minus_sign: | Your unique identifier for the customer | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-price.md b/packages/sdk/docs/models/update-customer-price.md new file mode 100644 index 000000000..0c19b42f6 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-price.md @@ -0,0 +1,23 @@ +# UpdateCustomerPrice + +## Example Usage + +```typescript +import { UpdateCustomerPrice } from "@useautumn/sdk"; + +let value: UpdateCustomerPrice = { + billingUnits: 5006.02, + billingMethod: "usage_based", + maxPurchase: 9037.13, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `tiers` | [models.UpdateCustomerTier](../models/update-customer-tier.md)[] | :heavy_minus_sign: | N/A | +| `billingUnits` | *number* | :heavy_check_mark: | N/A | +| `billingMethod` | [models.UpdateCustomerBillingMethod](../models/update-customer-billing-method.md) | :heavy_check_mark: | N/A | +| `maxPurchase` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-purchase.md b/packages/sdk/docs/models/update-customer-purchase.md new file mode 100644 index 000000000..1977be234 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-purchase.md @@ -0,0 +1,24 @@ +# UpdateCustomerPurchase + +## Example Usage + +```typescript +import { UpdateCustomerPurchase } from "@useautumn/sdk"; + +let value: UpdateCustomerPurchase = { + planId: "", + expiresAt: 4314.34, + startedAt: 9755.02, + quantity: 1307.25, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | +| `startedAt` | *number* | :heavy_check_mark: | N/A | +| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-reset.md b/packages/sdk/docs/models/update-customer-reset.md new file mode 100644 index 000000000..2409db3ca --- /dev/null +++ b/packages/sdk/docs/models/update-customer-reset.md @@ -0,0 +1,20 @@ +# UpdateCustomerReset + +## Example Usage + +```typescript +import { UpdateCustomerReset } from "@useautumn/sdk"; + +let value: UpdateCustomerReset = { + interval: "month", + resetsAt: 3142.36, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | +| `interval` | *models.UpdateCustomerIntervalUnion* | :heavy_check_mark: | N/A | +| `intervalCount` | *number* | :heavy_minus_sign: | N/A | +| `resetsAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-response.md b/packages/sdk/docs/models/update-customer-response.md new file mode 100644 index 000000000..60066e6c2 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-response.md @@ -0,0 +1,59 @@ +# UpdateCustomerResponse + +OK + +## Example Usage + +```typescript +import { UpdateCustomerResponse } from "@useautumn/sdk"; + +let value: UpdateCustomerResponse = { + id: "", + name: "", + email: "Nella63@yahoo.com", + createdAt: 1601.1, + fingerprint: "", + stripeId: "", + env: "live", + metadata: { + "key": "", + "key1": "", + }, + sendEmailReceipts: true, + subscriptions: [ + { + planId: "", + autoEnable: false, + addOn: true, + status: "scheduled", + pastDue: true, + canceledAt: 4476.93, + expiresAt: 6114.93, + trialEndsAt: 8136.42, + startedAt: 3369.97, + currentPeriodStart: 7857.72, + currentPeriodEnd: 200.12, + quantity: 8649.92, + }, + ], + purchases: [], + balances: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Your unique identifier for the customer. | +| `name` | *string* | :heavy_check_mark: | The name of the customer. | +| `email` | *string* | :heavy_check_mark: | The email address of the customer. | +| `createdAt` | *number* | :heavy_check_mark: | Timestamp of customer creation in milliseconds since epoch. | +| `fingerprint` | *string* | :heavy_check_mark: | A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. | +| `stripeId` | *string* | :heavy_check_mark: | Stripe customer ID. | +| `env` | [models.UpdateCustomerEnv](../models/update-customer-env.md) | :heavy_check_mark: | The environment this customer was created in. | +| `metadata` | Record | :heavy_check_mark: | The metadata for the customer. | +| `sendEmailReceipts` | *boolean* | :heavy_check_mark: | Whether to send email receipts to the customer. | +| `subscriptions` | [models.UpdateCustomerSubscription](../models/update-customer-subscription.md)[] | :heavy_check_mark: | N/A | +| `purchases` | [models.UpdateCustomerPurchase](../models/update-customer-purchase.md)[] | :heavy_check_mark: | N/A | +| `balances` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-rollover.md b/packages/sdk/docs/models/update-customer-rollover.md new file mode 100644 index 000000000..c48f80df1 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-rollover.md @@ -0,0 +1,19 @@ +# UpdateCustomerRollover + +## Example Usage + +```typescript +import { UpdateCustomerRollover } from "@useautumn/sdk"; + +let value: UpdateCustomerRollover = { + balance: 7797.12, + expiresAt: 297.95, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `balance` | *number* | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-status.md b/packages/sdk/docs/models/update-customer-status.md new file mode 100644 index 000000000..50b58dd4f --- /dev/null +++ b/packages/sdk/docs/models/update-customer-status.md @@ -0,0 +1,17 @@ +# UpdateCustomerStatus + +## Example Usage + +```typescript +import { UpdateCustomerStatus } from "@useautumn/sdk"; + +let value: UpdateCustomerStatus = "active"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"active" | "scheduled" | "expired" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-subscription.md b/packages/sdk/docs/models/update-customer-subscription.md new file mode 100644 index 000000000..db98114fe --- /dev/null +++ b/packages/sdk/docs/models/update-customer-subscription.md @@ -0,0 +1,40 @@ +# UpdateCustomerSubscription + +## Example Usage + +```typescript +import { UpdateCustomerSubscription } from "@useautumn/sdk"; + +let value: UpdateCustomerSubscription = { + planId: "", + autoEnable: false, + addOn: true, + status: "expired", + pastDue: false, + canceledAt: 7892.35, + expiresAt: 6728.93, + trialEndsAt: 4150.88, + startedAt: 3796.87, + currentPeriodStart: 3910.6, + currentPeriodEnd: 2894.6, + quantity: 8676.33, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `plan` | [models.Plan](../models/plan.md) | :heavy_minus_sign: | N/A | +| `planId` | *string* | :heavy_check_mark: | N/A | +| `autoEnable` | *boolean* | :heavy_check_mark: | N/A | +| `addOn` | *boolean* | :heavy_check_mark: | N/A | +| `status` | [models.UpdateCustomerStatus](../models/update-customer-status.md) | :heavy_check_mark: | N/A | +| `pastDue` | *boolean* | :heavy_check_mark: | N/A | +| `canceledAt` | *number* | :heavy_check_mark: | N/A | +| `expiresAt` | *number* | :heavy_check_mark: | N/A | +| `trialEndsAt` | *number* | :heavy_check_mark: | N/A | +| `startedAt` | *number* | :heavy_check_mark: | N/A | +| `currentPeriodStart` | *number* | :heavy_check_mark: | N/A | +| `currentPeriodEnd` | *number* | :heavy_check_mark: | N/A | +| `quantity` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-tier.md b/packages/sdk/docs/models/update-customer-tier.md new file mode 100644 index 000000000..e7a0834fc --- /dev/null +++ b/packages/sdk/docs/models/update-customer-tier.md @@ -0,0 +1,19 @@ +# UpdateCustomerTier + +## Example Usage + +```typescript +import { UpdateCustomerTier } from "@useautumn/sdk"; + +let value: UpdateCustomerTier = { + to: 1859, + amount: 4815.39, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `to` | *models.UpdateCustomerTo* | :heavy_check_mark: | N/A | +| `amount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/packages/sdk/docs/models/update-customer-to.md b/packages/sdk/docs/models/update-customer-to.md new file mode 100644 index 000000000..f7297920d --- /dev/null +++ b/packages/sdk/docs/models/update-customer-to.md @@ -0,0 +1,17 @@ +# UpdateCustomerTo + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/packages/sdk/docs/models/update-customer-type.md b/packages/sdk/docs/models/update-customer-type.md new file mode 100644 index 000000000..f5d1f7937 --- /dev/null +++ b/packages/sdk/docs/models/update-customer-type.md @@ -0,0 +1,17 @@ +# UpdateCustomerType + +## Example Usage + +```typescript +import { UpdateCustomerType } from "@useautumn/sdk"; + +let value: UpdateCustomerType = "credit_system"; +``` + +## Values + +This is an open enum. Unrecognized values will be captured as the `Unrecognized` branded type. + +```typescript +"boolean" | "metered" | "credit_system" | Unrecognized +``` \ No newline at end of file diff --git a/packages/sdk/docs/sdks/customers/README.md b/packages/sdk/docs/sdks/customers/README.md index f1b888723..27524f854 100644 --- a/packages/sdk/docs/sdks/customers/README.md +++ b/packages/sdk/docs/sdks/customers/README.md @@ -5,42 +5,17 @@ ### Available Operations * [getOrCreate](#getorcreate) - Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` +* [list](#list) - Lists customers with pagination and optional filters. +* [update](#update) - Updates an existing customer by ID. +* [delete](#delete) - Deletes a customer by ID. ## getOrCreate Creates a customer if they do not exist, or returns the existing customer by your external customer ID. -Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - -@example -```typescript -// Create or fetch a customer by external ID -const response = await client.getOrCreate({ - - - "id": "cus_123", - "name": "John Doe", - "email": "john@example.com" - }); -``` - ### Example Usage - + ```typescript import { Autumn } from "@useautumn/sdk"; @@ -109,6 +84,231 @@ run(); ### Errors +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## list + +Lists customers with pagination and optional filters. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.customers.list({}); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { customersList } from "@useautumn/sdk/funcs/customers-list.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await customersList(autumn, {}); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("customersList failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.ListCustomersParams](../../models/list-customers-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.ListCustomersResponse](../../models/list-customers-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## update + +Updates an existing customer by ID. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.customers.update({ + customerId: "cus_123", + name: "Jane Doe", + email: "jane@example.com", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { customersUpdate } from "@useautumn/sdk/funcs/customers-update.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await customersUpdate(autumn, { + customerId: "cus_123", + name: "Jane Doe", + email: "jane@example.com", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("customersUpdate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.UpdateCustomerParams](../../models/update-customer-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.UpdateCustomerResponse](../../models/update-customer-response.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------------- | ------------------------- | ------------------------- | +| models.AutumnDefaultError | 4XX, 5XX | \*/\* | + +## delete + +Deletes a customer by ID. + +### Example Usage + + +```typescript +import { Autumn } from "@useautumn/sdk"; + +const autumn = new Autumn({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const result = await autumn.customers.delete({ + customerId: "cus_123", + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { AutumnCore } from "@useautumn/sdk/core.js"; +import { customersDelete } from "@useautumn/sdk/funcs/customers-delete.js"; + +// Use `AutumnCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const autumn = new AutumnCore({ + xApiVersion: "2.1", + secretKey: process.env["AUTUMN_SECRET_KEY"] ?? "", +}); + +async function run() { + const res = await customersDelete(autumn, { + customerId: "cus_123", + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("customersDelete failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [models.DeleteCustomerParams](../../models/delete-customer-params.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[models.DeleteCustomerResponse](../../models/delete-customer-response.md)\>** + +### Errors + | Error Type | Status Code | Content Type | | ------------------------- | ------------------------- | ------------------------- | | models.AutumnDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/packages/sdk/jsr.json b/packages/sdk/jsr.json index f084f662c..dbe800c6e 100644 --- a/packages/sdk/jsr.json +++ b/packages/sdk/jsr.json @@ -2,7 +2,7 @@ { "name": "@useautumn/sdk", - "version": "0.7.29", + "version": "0.8.11", "exports": { ".": "./src/index.ts", "./models": "./src/models/index.ts", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index ba7d03c31..bacc8d0aa 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@useautumn/sdk", - "version": "0.7.29", + "version": "0.8.11", "author": "Speakeasy", "main": "./dist/commonjs/index.js", "module": "./dist/esm/index.js", diff --git a/packages/sdk/src/funcs/customers-delete.ts b/packages/sdk/src/funcs/customers-delete.ts new file mode 100644 index 000000000..97ab0552c --- /dev/null +++ b/packages/sdk/src/funcs/customers-delete.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Deletes a customer by ID. + */ +export function customersDelete( + client: AutumnCore, + request: models.DeleteCustomerParams, + options?: RequestOptions, +): APIPromise< + Result< + models.DeleteCustomerResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.DeleteCustomerParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.DeleteCustomerResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.DeleteCustomerParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/customers.delete")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "deleteCustomer", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.DeleteCustomerResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.DeleteCustomerResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/customers-get-or-create.ts b/packages/sdk/src/funcs/customers-get-or-create.ts index ac7fefd70..d6b6592ef 100644 --- a/packages/sdk/src/funcs/customers-get-or-create.ts +++ b/packages/sdk/src/funcs/customers-get-or-create.ts @@ -27,19 +27,6 @@ import { Result } from "../types/fp.js"; /** * Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - * - * Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - * - * @example - * ```typescript - * // Create or fetch a customer by external ID - * const response = await client.getOrCreate({ - * - * "id": "cus_123", - * "name": "John Doe", - * "email": "john@example.com" - * }); - * ``` */ export function customersGetOrCreate( client: AutumnCore, @@ -115,7 +102,7 @@ async function $do( const context = { options: client._options, baseURL: options?.serverURL ?? client._baseURL ?? "", - operationID: "getOrCreate", + operationID: "getOrCreateCustomer", oAuth2Scopes: null, resolvedSecurity: requestSecurity, diff --git a/packages/sdk/src/funcs/customers-list.ts b/packages/sdk/src/funcs/customers-list.ts new file mode 100644 index 000000000..73658311d --- /dev/null +++ b/packages/sdk/src/funcs/customers-list.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Lists customers with pagination and optional filters. + */ +export function customersList( + client: AutumnCore, + request?: models.ListCustomersParams | undefined, + options?: RequestOptions, +): APIPromise< + Result< + models.ListCustomersResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request?: models.ListCustomersParams | undefined, + options?: RequestOptions, +): Promise< + [ + Result< + models.ListCustomersResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => + z.parse(z.optional(models.ListCustomersParams$outboundSchema), value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = payload === undefined + ? null + : encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/customers.list")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "listCustomers", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.ListCustomersResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.ListCustomersResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/funcs/customers-update.ts b/packages/sdk/src/funcs/customers-update.ts new file mode 100644 index 000000000..d2e586177 --- /dev/null +++ b/packages/sdk/src/funcs/customers-update.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { AutumnCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { AutumnError } from "../models/autumn-error.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/http-client-errors.js"; +import * as models from "../models/index.js"; +import { ResponseValidationError } from "../models/response-validation-error.js"; +import { SDKValidationError } from "../models/sdk-validation-error.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Updates an existing customer by ID. + */ +export function customersUpdate( + client: AutumnCore, + request: models.UpdateCustomerParams, + options?: RequestOptions, +): APIPromise< + Result< + models.UpdateCustomerResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: AutumnCore, + request: models.UpdateCustomerParams, + options?: RequestOptions, +): Promise< + [ + Result< + models.UpdateCustomerResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => z.parse(models.UpdateCustomerParams$outboundSchema, value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/customers.update")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "x-api-version": encodeSimple( + "x-api-version", + client._options.xApiVersion, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.secretKey); + const securityInput = secConfig == null ? {} : { secretKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: options?.serverURL ?? client._baseURL ?? "", + operationID: "updateCustomer", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.secretKey, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: options?.serverURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["4XX", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const [result] = await M.match< + models.UpdateCustomerResponse, + | AutumnError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.UpdateCustomerResponse$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/packages/sdk/src/lib/config.ts b/packages/sdk/src/lib/config.ts index fad972390..594f827c4 100644 --- a/packages/sdk/src/lib/config.ts +++ b/packages/sdk/src/lib/config.ts @@ -66,7 +66,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "2.1.0", - sdkVersion: "0.7.29", + sdkVersion: "0.8.11", genVersion: "2.824.1", - userAgent: "speakeasy-sdk/typescript 0.7.29 2.824.1 2.1.0 @useautumn/sdk", + userAgent: "speakeasy-sdk/typescript 0.8.11 2.824.1 2.1.0 @useautumn/sdk", } as const; diff --git a/packages/sdk/src/models/attach-op.ts b/packages/sdk/src/models/attach-op.ts index c21e0da46..f6b63b9fe 100644 --- a/packages/sdk/src/models/attach-op.ts +++ b/packages/sdk/src/models/attach-op.ts @@ -16,6 +16,17 @@ export type AttachGlobals = { xApiVersion?: string | undefined; }; +export type EntityData = { + /** + * The feature ID that this entity is associated with + */ + featureId: string; + /** + * Name of the entity + */ + name?: string | undefined; +}; + export type Options = { featureId: string; quantity?: number | undefined; @@ -145,6 +156,8 @@ export const BillingBehavior = { export type BillingBehavior = ClosedEnum; export type AttachRequest = { + entityId?: string | null | undefined; + entityData?: EntityData | undefined; options?: Array | null | undefined; version?: number | undefined; freeTrial?: AttachFreeTrial | null | undefined; @@ -186,11 +199,38 @@ export type RequiredAction = { */ export type AttachResponse = { customerId: string; + entityId?: string | undefined; invoice?: AttachInvoice | undefined; paymentUrl: string | null; requiredAction?: RequiredAction | undefined; }; +/** @internal */ +export type EntityData$Outbound = { + feature_id: string; + name?: string | undefined; +}; + +/** @internal */ +export const EntityData$outboundSchema: z.ZodMiniType< + EntityData$Outbound, + EntityData +> = z.pipe( + z.object({ + featureId: z.string(), + name: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + featureId: "feature_id", + }); + }), +); + +export function entityDataToJSON(entityData: EntityData): string { + return JSON.stringify(EntityData$outboundSchema.parse(entityData)); +} + /** @internal */ export type Options$Outbound = { feature_id: string; @@ -374,6 +414,8 @@ export const BillingBehavior$outboundSchema: z.ZodMiniEnum< /** @internal */ export type AttachRequest$Outbound = { + entity_id?: string | null | undefined; + entity_data?: EntityData$Outbound | undefined; options?: Array | null | undefined; version?: number | undefined; free_trial?: AttachFreeTrial$Outbound | null | undefined; @@ -396,6 +438,8 @@ export const AttachRequest$outboundSchema: z.ZodMiniType< AttachRequest > = z.pipe( z.object({ + entityId: z.optional(z.nullable(z.string())), + entityData: z.optional(z.lazy(() => EntityData$outboundSchema)), options: z.optional( z.nullable(z.array(z.lazy(() => Options$outboundSchema))), ), @@ -417,6 +461,8 @@ export const AttachRequest$outboundSchema: z.ZodMiniType< }), z.transform((v) => { return remap$(v, { + entityId: "entity_id", + entityData: "entity_data", freeTrial: "free_trial", productId: "product_id", enableProductImmediately: "enable_product_immediately", @@ -495,6 +541,7 @@ export const AttachResponse$inboundSchema: z.ZodMiniType< > = z.pipe( z.object({ customer_id: types.string(), + entity_id: types.optional(types.string()), invoice: types.optional(z.lazy(() => AttachInvoice$inboundSchema)), payment_url: types.nullable(types.string()), required_action: types.optional(z.lazy(() => RequiredAction$inboundSchema)), @@ -502,6 +549,7 @@ export const AttachResponse$inboundSchema: z.ZodMiniType< z.transform((v) => { return remap$(v, { "customer_id": "customerId", + "entity_id": "entityId", "payment_url": "paymentUrl", "required_action": "requiredAction", }); diff --git a/packages/sdk/src/models/customer.ts b/packages/sdk/src/models/customer.ts index 036a13105..85200c462 100644 --- a/packages/sdk/src/models/customer.ts +++ b/packages/sdk/src/models/customer.ts @@ -56,6 +56,34 @@ export type Purchase = { quantity: number; }; +export const CustomerBalancesType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type CustomerBalancesType = OpenEnum; + +export type CustomerCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type CustomerDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +export type CustomerFeature = { + id: string; + name: string; + type: CustomerBalancesType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: CustomerDisplay | undefined; + archived: boolean; +}; + export const CustomerIntervalEnum = { OneOff: "one_off", Minute: "minute", @@ -69,7 +97,7 @@ export const CustomerIntervalEnum = { } as const; export type CustomerIntervalEnum = OpenEnum; -export type Interval = CustomerIntervalEnum | string; +export type CustomerIntervalUnion = CustomerIntervalEnum | string; export type CustomerReset = { interval: CustomerIntervalEnum | string; @@ -99,6 +127,7 @@ export type CustomerPrice = { }; export type Breakdown = { + id: string; planId: string | null; includedGrant: number; prepaidGrant: number; @@ -117,6 +146,7 @@ export type CustomerRollover = { export type Balances = { featureId: string; + feature?: CustomerFeature | undefined; granted: number; remaining: number; usage: number; @@ -149,6 +179,10 @@ export type Invoice = { * The currency code for the invoice */ currency: string; + /** + * Timestamp when the invoice was created + */ + createdAt: number; /** * URL to the Stripe-hosted invoice page */ @@ -168,6 +202,11 @@ export const EntityEnv = { export type EntityEnv = OpenEnum; export type Entity = { + autumnId?: string | undefined; + /** + * The unique identifier of the entity + */ + id: string | null; /** * The name of the entity */ @@ -180,6 +219,10 @@ export type Entity = { * The feature ID this entity belongs to */ featureId?: string | null | undefined; + /** + * Unix timestamp when the entity was created + */ + createdAt: number; /** * The environment (sandbox/live) */ @@ -195,7 +238,7 @@ export type TrialsUsed = { /** * The type of reward */ -export const Type = { +export const RewardsType = { PercentageDiscount: "percentage_discount", FixedDiscount: "fixed_discount", FreeProduct: "free_product", @@ -204,7 +247,7 @@ export const Type = { /** * The type of reward */ -export type Type = OpenEnum; +export type RewardsType = OpenEnum; /** * How long the discount lasts @@ -220,6 +263,10 @@ export const CustomerDurationType = { export type CustomerDurationType = OpenEnum; export type Discount = { + /** + * The unique identifier for this discount + */ + id: string; /** * The name of the discount or coupon */ @@ -227,7 +274,7 @@ export type Discount = { /** * The type of reward */ - type: Type; + type: RewardsType; /** * The discount value (percentage or fixed amount) */ @@ -270,6 +317,7 @@ export type Rewards = { }; export type ReferralCustomer = { + id: string; name?: string | null | undefined; email?: string | null | undefined; }; @@ -278,9 +326,14 @@ export type Referral = { programId: string; customer: ReferralCustomer; rewardApplied: boolean; + createdAt: number; }; export type Customer = { + /** + * Your unique identifier for the customer. + */ + id: string | null; /** * The name of the customer. */ @@ -289,6 +342,10 @@ export type Customer = { * The email address of the customer. */ email: string | null; + /** + * Timestamp of customer creation in milliseconds since epoch. + */ + createdAt: number; /** * A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. */ @@ -400,6 +457,93 @@ export function purchaseFromJSON( ); } +/** @internal */ +export const CustomerBalancesType$inboundSchema: z.ZodMiniType< + CustomerBalancesType, + unknown +> = openEnums.inboundSchema(CustomerBalancesType); + +/** @internal */ +export const CustomerCreditSchema$inboundSchema: z.ZodMiniType< + CustomerCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function customerCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomerCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomerCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const CustomerDisplay$inboundSchema: z.ZodMiniType< + CustomerDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function customerDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomerDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomerDisplay' from JSON`, + ); +} + +/** @internal */ +export const CustomerFeature$inboundSchema: z.ZodMiniType< + CustomerFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: CustomerBalancesType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => CustomerCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => CustomerDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function customerFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomerFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomerFeature' from JSON`, + ); +} + /** @internal */ export const CustomerIntervalEnum$inboundSchema: z.ZodMiniType< CustomerIntervalEnum, @@ -407,16 +551,18 @@ export const CustomerIntervalEnum$inboundSchema: z.ZodMiniType< > = openEnums.inboundSchema(CustomerIntervalEnum); /** @internal */ -export const Interval$inboundSchema: z.ZodMiniType = - smartUnion([CustomerIntervalEnum$inboundSchema, types.string()]); +export const CustomerIntervalUnion$inboundSchema: z.ZodMiniType< + CustomerIntervalUnion, + unknown +> = smartUnion([CustomerIntervalEnum$inboundSchema, types.string()]); -export function intervalFromJSON( +export function customerIntervalUnionFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => Interval$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Interval' from JSON`, + (x) => CustomerIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomerIntervalUnion' from JSON`, ); } @@ -520,6 +666,7 @@ export function customerPriceFromJSON( export const Breakdown$inboundSchema: z.ZodMiniType = z .pipe( z.object({ + id: z._default(types.string(), ""), plan_id: types.nullable(types.string()), included_grant: types.number(), prepaid_grant: types.number(), @@ -580,6 +727,7 @@ export function customerRolloverFromJSON( export const Balances$inboundSchema: z.ZodMiniType = z.pipe( z.object({ feature_id: types.string(), + feature: types.optional(z.lazy(() => CustomerFeature$inboundSchema)), granted: types.number(), remaining: types.number(), usage: types.number(), @@ -620,12 +768,14 @@ export const Invoice$inboundSchema: z.ZodMiniType = z.pipe( status: types.string(), total: types.number(), currency: types.string(), + created_at: types.number(), hosted_invoice_url: z.optional(z.nullable(types.string())), }), z.transform((v) => { return remap$(v, { "plan_ids": "planIds", "stripe_id": "stripeId", + "created_at": "createdAt", "hosted_invoice_url": "hostedInvoiceUrl", }); }), @@ -648,15 +798,20 @@ export const EntityEnv$inboundSchema: z.ZodMiniType = /** @internal */ export const Entity$inboundSchema: z.ZodMiniType = z.pipe( z.object({ + autumn_id: types.optional(types.string()), + id: types.nullable(types.string()), name: types.nullable(types.string()), customer_id: z.optional(z.nullable(types.string())), feature_id: z.optional(z.nullable(types.string())), + created_at: types.number(), env: EntityEnv$inboundSchema, }), z.transform((v) => { return remap$(v, { + "autumn_id": "autumnId", "customer_id": "customerId", "feature_id": "featureId", + "created_at": "createdAt", }); }), ); @@ -698,8 +853,8 @@ export function trialsUsedFromJSON( } /** @internal */ -export const Type$inboundSchema: z.ZodMiniType = openEnums - .inboundSchema(Type); +export const RewardsType$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(RewardsType); /** @internal */ export const CustomerDurationType$inboundSchema: z.ZodMiniType< @@ -710,8 +865,9 @@ export const CustomerDurationType$inboundSchema: z.ZodMiniType< /** @internal */ export const Discount$inboundSchema: z.ZodMiniType = z.pipe( z.object({ + id: types.string(), name: types.string(), - type: Type$inboundSchema, + type: RewardsType$inboundSchema, discount_value: types.number(), duration_type: CustomerDurationType$inboundSchema, duration_value: z.optional(z.nullable(types.number())), @@ -762,6 +918,7 @@ export const ReferralCustomer$inboundSchema: z.ZodMiniType< ReferralCustomer, unknown > = z.object({ + id: types.string(), name: z.optional(z.nullable(types.string())), email: z.optional(z.nullable(types.string())), }); @@ -782,11 +939,13 @@ export const Referral$inboundSchema: z.ZodMiniType = z.pipe( program_id: types.string(), customer: z.lazy(() => ReferralCustomer$inboundSchema), reward_applied: types.boolean(), + created_at: types.number(), }), z.transform((v) => { return remap$(v, { "program_id": "programId", "reward_applied": "rewardApplied", + "created_at": "createdAt", }); }), ); @@ -804,8 +963,10 @@ export function referralFromJSON( /** @internal */ export const Customer$inboundSchema: z.ZodMiniType = z.pipe( z.object({ + id: types.nullable(types.string()), name: types.nullable(types.string()), email: types.nullable(types.string()), + created_at: types.number(), fingerprint: types.nullable(types.string()), stripe_id: types.nullable(types.string()), env: CustomerEnv$inboundSchema, @@ -825,6 +986,7 @@ export const Customer$inboundSchema: z.ZodMiniType = z.pipe( }), z.transform((v) => { return remap$(v, { + "created_at": "createdAt", "stripe_id": "stripeId", "send_email_receipts": "sendEmailReceipts", "trials_used": "trialsUsed", diff --git a/packages/sdk/src/models/delete-customer-op.ts b/packages/sdk/src/models/delete-customer-op.ts new file mode 100644 index 000000000..3b3187da0 --- /dev/null +++ b/packages/sdk/src/models/delete-customer-op.ts @@ -0,0 +1,81 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type DeleteCustomerGlobals = { + xApiVersion?: string | undefined; +}; + +export type DeleteCustomerParams = { + /** + * ID of the customer to delete + */ + customerId: string; + /** + * Whether to also delete the customer in Stripe + */ + deleteInStripe?: boolean | undefined; +}; + +/** + * OK + */ +export type DeleteCustomerResponse = { + success: boolean; +}; + +/** @internal */ +export type DeleteCustomerParams$Outbound = { + customer_id: string; + delete_in_stripe: boolean; +}; + +/** @internal */ +export const DeleteCustomerParams$outboundSchema: z.ZodMiniType< + DeleteCustomerParams$Outbound, + DeleteCustomerParams +> = z.pipe( + z.object({ + customerId: z.string(), + deleteInStripe: z._default(z.boolean(), false), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + deleteInStripe: "delete_in_stripe", + }); + }), +); + +export function deleteCustomerParamsToJSON( + deleteCustomerParams: DeleteCustomerParams, +): string { + return JSON.stringify( + DeleteCustomerParams$outboundSchema.parse(deleteCustomerParams), + ); +} + +/** @internal */ +export const DeleteCustomerResponse$inboundSchema: z.ZodMiniType< + DeleteCustomerResponse, + unknown +> = z.object({ + success: types.boolean(), +}); + +export function deleteCustomerResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteCustomerResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteCustomerResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/get-or-create-op.ts b/packages/sdk/src/models/get-or-create-customer-op.ts similarity index 98% rename from packages/sdk/src/models/get-or-create-op.ts rename to packages/sdk/src/models/get-or-create-customer-op.ts index 6adb75311..438cc17a1 100644 --- a/packages/sdk/src/models/get-or-create-op.ts +++ b/packages/sdk/src/models/get-or-create-customer-op.ts @@ -9,7 +9,7 @@ import { CustomerExpand$outboundSchema, } from "./customer-expand.js"; -export type GetOrCreateGlobals = { +export type GetOrCreateCustomerGlobals = { xApiVersion?: string | undefined; }; diff --git a/packages/sdk/src/models/index.ts b/packages/sdk/src/models/index.ts index 7c2df8876..d67de8030 100644 --- a/packages/sdk/src/models/index.ts +++ b/packages/sdk/src/models/index.ts @@ -7,10 +7,13 @@ export * from "./autumn-default-error.js"; export * from "./autumn-error.js"; export * from "./customer-expand.js"; export * from "./customer.js"; -export * from "./get-or-create-op.js"; +export * from "./delete-customer-op.js"; +export * from "./get-or-create-customer-op.js"; export * from "./http-client-errors.js"; +export * from "./list-customers-op.js"; export * from "./list-op.js"; export * from "./plan.js"; export * from "./response-validation-error.js"; export * from "./sdk-validation-error.js"; export * from "./security.js"; +export * from "./update-customer-op.js"; diff --git a/packages/sdk/src/models/list-customers-op.ts b/packages/sdk/src/models/list-customers-op.ts new file mode 100644 index 000000000..dae93235f --- /dev/null +++ b/packages/sdk/src/models/list-customers-op.ts @@ -0,0 +1,798 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { ClosedEnum, OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { Plan, Plan$inboundSchema } from "./plan.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type ListCustomersGlobals = { + xApiVersion?: string | undefined; +}; + +export type ListCustomersPlan = { + id: string; + versions?: Array | undefined; +}; + +/** + * Filter by customer product status. Defaults to active and scheduled + */ +export const SubscriptionStatus = { + Active: "active", + Scheduled: "scheduled", +} as const; +/** + * Filter by customer product status. Defaults to active and scheduled + */ +export type SubscriptionStatus = ClosedEnum; + +export type ListCustomersParams = { + /** + * Number of items to skip + */ + offset?: number | undefined; + /** + * Number of items to return. Default 10, max 1000. + */ + limit?: number | undefined; + /** + * Filter by plan ID and version. Returns customers with active subscriptions to this plan. + */ + plans?: Array | undefined; + /** + * Filter by customer product status. Defaults to active and scheduled + */ + subscriptionStatus?: SubscriptionStatus | undefined; + /** + * Search customers by id, name, or email + */ + search?: string | undefined; +}; + +/** + * The environment this customer was created in. + */ +export const ListCustomersEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * The environment this customer was created in. + */ +export type ListCustomersEnv = OpenEnum; + +export const ListCustomersStatus = { + Active: "active", + Scheduled: "scheduled", + Expired: "expired", +} as const; +export type ListCustomersStatus = OpenEnum; + +export type ListCustomersSubscription = { + plan?: Plan | undefined; + planId: string; + autoEnable: boolean; + addOn: boolean; + status: ListCustomersStatus; + pastDue: boolean; + canceledAt: number | null; + expiresAt: number | null; + trialEndsAt: number | null; + startedAt: number; + currentPeriodStart: number | null; + currentPeriodEnd: number | null; + quantity: number; +}; + +export type ListCustomersPurchase = { + plan?: Plan | undefined; + planId: string; + expiresAt: number | null; + startedAt: number; + quantity: number; +}; + +export const ListCustomersType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type ListCustomersType = OpenEnum; + +export type ListCustomersCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type ListCustomersDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +export type ListCustomersFeature = { + id: string; + name: string; + type: ListCustomersType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: ListCustomersDisplay | undefined; + archived: boolean; +}; + +export const ListCustomersIntervalEnum = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type ListCustomersIntervalEnum = OpenEnum< + typeof ListCustomersIntervalEnum +>; + +export type ListCustomersIntervalUnion = ListCustomersIntervalEnum | string; + +export type ListCustomersReset = { + interval: ListCustomersIntervalEnum | string; + intervalCount?: number | undefined; + resetsAt: number | null; +}; + +export type ListCustomersTier = { + to?: any | undefined; + amount: number; +}; + +export const ListCustomersBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +export type ListCustomersBillingMethod = OpenEnum< + typeof ListCustomersBillingMethod +>; + +export type ListCustomersPrice = { + amount?: number | undefined; + tiers?: Array | undefined; + billingUnits: number; + billingMethod: ListCustomersBillingMethod; + maxPurchase: number | null; +}; + +export type ListCustomersBreakdown = { + id: string; + planId: string | null; + includedGrant: number; + prepaidGrant: number; + remaining: number; + usage: number; + unlimited: boolean; + reset: ListCustomersReset | null; + price: ListCustomersPrice | null; + expiresAt: number | null; +}; + +export type ListCustomersRollover = { + balance: number; + expiresAt: number; +}; + +export type ListCustomersBalances = { + featureId: string; + feature?: ListCustomersFeature | undefined; + granted: number; + remaining: number; + usage: number; + unlimited: boolean; + overageAllowed: boolean; + maxPurchase: number | null; + nextResetAt: number | null; + breakdown?: Array | undefined; + rollovers?: Array | undefined; +}; + +export type List = { + /** + * Your unique identifier for the customer. + */ + id: string | null; + /** + * The name of the customer. + */ + name: string | null; + /** + * The email address of the customer. + */ + email: string | null; + /** + * Timestamp of customer creation in milliseconds since epoch. + */ + createdAt: number; + /** + * A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + */ + fingerprint: string | null; + /** + * Stripe customer ID. + */ + stripeId: string | null; + /** + * The environment this customer was created in. + */ + env: ListCustomersEnv; + /** + * The metadata for the customer. + */ + metadata: { [k: string]: any }; + /** + * Whether to send email receipts to the customer. + */ + sendEmailReceipts: boolean; + subscriptions: Array; + purchases: Array; + balances: { [k: string]: ListCustomersBalances }; +}; + +/** + * OK + */ +export type ListCustomersResponse = { + /** + * Array of items for current page + */ + list: Array; + /** + * Whether more results exist after this page + */ + hasMore: boolean; + /** + * Current offset position + */ + offset: number; + /** + * Limit passed in the request + */ + limit: number; + /** + * Total number of items returned in the current page + */ + total: number; +}; + +/** @internal */ +export type ListCustomersPlan$Outbound = { + id: string; + versions?: Array | undefined; +}; + +/** @internal */ +export const ListCustomersPlan$outboundSchema: z.ZodMiniType< + ListCustomersPlan$Outbound, + ListCustomersPlan +> = z.object({ + id: z.string(), + versions: z.optional(z.array(z.number())), +}); + +export function listCustomersPlanToJSON( + listCustomersPlan: ListCustomersPlan, +): string { + return JSON.stringify( + ListCustomersPlan$outboundSchema.parse(listCustomersPlan), + ); +} + +/** @internal */ +export const SubscriptionStatus$outboundSchema: z.ZodMiniEnum< + typeof SubscriptionStatus +> = z.enum(SubscriptionStatus); + +/** @internal */ +export type ListCustomersParams$Outbound = { + offset: number; + limit: number; + plans?: Array | undefined; + subscription_status?: string | undefined; + search?: string | undefined; +}; + +/** @internal */ +export const ListCustomersParams$outboundSchema: z.ZodMiniType< + ListCustomersParams$Outbound, + ListCustomersParams +> = z.pipe( + z.object({ + offset: z._default(z.int(), 0), + limit: z._default(z.int(), 10), + plans: z.optional(z.array(z.lazy(() => ListCustomersPlan$outboundSchema))), + subscriptionStatus: z.optional(SubscriptionStatus$outboundSchema), + search: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + subscriptionStatus: "subscription_status", + }); + }), +); + +export function listCustomersParamsToJSON( + listCustomersParams: ListCustomersParams, +): string { + return JSON.stringify( + ListCustomersParams$outboundSchema.parse(listCustomersParams), + ); +} + +/** @internal */ +export const ListCustomersEnv$inboundSchema: z.ZodMiniType< + ListCustomersEnv, + unknown +> = openEnums.inboundSchema(ListCustomersEnv); + +/** @internal */ +export const ListCustomersStatus$inboundSchema: z.ZodMiniType< + ListCustomersStatus, + unknown +> = openEnums.inboundSchema(ListCustomersStatus); + +/** @internal */ +export const ListCustomersSubscription$inboundSchema: z.ZodMiniType< + ListCustomersSubscription, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + auto_enable: types.boolean(), + add_on: types.boolean(), + status: ListCustomersStatus$inboundSchema, + past_due: types.boolean(), + canceled_at: types.nullable(types.number()), + expires_at: types.nullable(types.number()), + trial_ends_at: types.nullable(types.number()), + started_at: types.number(), + current_period_start: types.nullable(types.number()), + current_period_end: types.nullable(types.number()), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "auto_enable": "autoEnable", + "add_on": "addOn", + "past_due": "pastDue", + "canceled_at": "canceledAt", + "expires_at": "expiresAt", + "trial_ends_at": "trialEndsAt", + "started_at": "startedAt", + "current_period_start": "currentPeriodStart", + "current_period_end": "currentPeriodEnd", + }); + }), +); + +export function listCustomersSubscriptionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersSubscription$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersSubscription' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersPurchase$inboundSchema: z.ZodMiniType< + ListCustomersPurchase, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + expires_at: types.nullable(types.number()), + started_at: types.number(), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "expires_at": "expiresAt", + "started_at": "startedAt", + }); + }), +); + +export function listCustomersPurchaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersPurchase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersPurchase' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersType$inboundSchema: z.ZodMiniType< + ListCustomersType, + unknown +> = openEnums.inboundSchema(ListCustomersType); + +/** @internal */ +export const ListCustomersCreditSchema$inboundSchema: z.ZodMiniType< + ListCustomersCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function listCustomersCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersDisplay$inboundSchema: z.ZodMiniType< + ListCustomersDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function listCustomersDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersDisplay' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersFeature$inboundSchema: z.ZodMiniType< + ListCustomersFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: ListCustomersType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => ListCustomersCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => ListCustomersDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function listCustomersFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersFeature' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersIntervalEnum$inboundSchema: z.ZodMiniType< + ListCustomersIntervalEnum, + unknown +> = openEnums.inboundSchema(ListCustomersIntervalEnum); + +/** @internal */ +export const ListCustomersIntervalUnion$inboundSchema: z.ZodMiniType< + ListCustomersIntervalUnion, + unknown +> = smartUnion([ListCustomersIntervalEnum$inboundSchema, types.string()]); + +export function listCustomersIntervalUnionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersIntervalUnion' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersReset$inboundSchema: z.ZodMiniType< + ListCustomersReset, + unknown +> = z.pipe( + z.object({ + interval: smartUnion([ + ListCustomersIntervalEnum$inboundSchema, + types.string(), + ]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), +); + +export function listCustomersResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersReset' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersTier$inboundSchema: z.ZodMiniType< + ListCustomersTier, + unknown +> = z.object({ + to: types.optional(z.any()), + amount: types.number(), +}); + +export function listCustomersTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersTier' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersBillingMethod$inboundSchema: z.ZodMiniType< + ListCustomersBillingMethod, + unknown +> = openEnums.inboundSchema(ListCustomersBillingMethod); + +/** @internal */ +export const ListCustomersPrice$inboundSchema: z.ZodMiniType< + ListCustomersPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => ListCustomersTier$inboundSchema)), + ), + billing_units: types.number(), + billing_method: ListCustomersBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function listCustomersPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersPrice' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersBreakdown$inboundSchema: z.ZodMiniType< + ListCustomersBreakdown, + unknown +> = z.pipe( + z.object({ + id: z._default(types.string(), ""), + plan_id: types.nullable(types.string()), + included_grant: types.number(), + prepaid_grant: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => ListCustomersReset$inboundSchema)), + price: types.nullable(z.lazy(() => ListCustomersPrice$inboundSchema)), + expires_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "included_grant": "includedGrant", + "prepaid_grant": "prepaidGrant", + "expires_at": "expiresAt", + }); + }), +); + +export function listCustomersBreakdownFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersBreakdown' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersRollover$inboundSchema: z.ZodMiniType< + ListCustomersRollover, + unknown +> = z.pipe( + z.object({ + balance: types.number(), + expires_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "expires_at": "expiresAt", + }); + }), +); + +export function listCustomersRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersRollover' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersBalances$inboundSchema: z.ZodMiniType< + ListCustomersBalances, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => ListCustomersFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => ListCustomersBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => ListCustomersRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), +); + +export function listCustomersBalancesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersBalances$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersBalances' from JSON`, + ); +} + +/** @internal */ +export const List$inboundSchema: z.ZodMiniType = z.pipe( + z.object({ + id: types.nullable(types.string()), + name: types.nullable(types.string()), + email: types.nullable(types.string()), + created_at: types.number(), + fingerprint: types.nullable(types.string()), + stripe_id: types.nullable(types.string()), + env: ListCustomersEnv$inboundSchema, + metadata: z.record(z.string(), z.any()), + send_email_receipts: types.boolean(), + subscriptions: z.array( + z.lazy(() => ListCustomersSubscription$inboundSchema), + ), + purchases: z.array(z.lazy(() => ListCustomersPurchase$inboundSchema)), + balances: z.record( + z.string(), + z.lazy(() => ListCustomersBalances$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "created_at": "createdAt", + "stripe_id": "stripeId", + "send_email_receipts": "sendEmailReceipts", + }); + }), +); + +export function listFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => List$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'List' from JSON`, + ); +} + +/** @internal */ +export const ListCustomersResponse$inboundSchema: z.ZodMiniType< + ListCustomersResponse, + unknown +> = z.pipe( + z.object({ + list: z.array(z.lazy(() => List$inboundSchema)), + has_more: types.boolean(), + offset: types.number(), + limit: types.number(), + total: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "has_more": "hasMore", + }); + }), +); + +export function listCustomersResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomersResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomersResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/models/plan.ts b/packages/sdk/src/models/plan.ts index 1e7d7434b..b7f1f9e3e 100644 --- a/packages/sdk/src/models/plan.ts +++ b/packages/sdk/src/models/plan.ts @@ -22,10 +22,80 @@ export const PriceInterval = { } as const; export type PriceInterval = OpenEnum; +export type PriceDisplay = { + primaryText: string; + secondaryText?: string | undefined; +}; + export type PlanPrice = { amount: number; interval: PriceInterval; intervalCount?: number | undefined; + display?: PriceDisplay | undefined; +}; + +/** + * The type of the feature + */ +export const PlanType = { + Static: "static", + Boolean: "boolean", + SingleUse: "single_use", + ContinuousUse: "continuous_use", + CreditSystem: "credit_system", +} as const; +/** + * The type of the feature + */ +export type PlanType = OpenEnum; + +export type ItemFeatureDisplay = { + /** + * The singular display name for the feature. + */ + singular: string; + /** + * The plural display name for the feature. + */ + plural: string; +}; + +export type PlanCreditSchema = { + /** + * The ID of the metered feature (should be a single_use feature). + */ + meteredFeatureId: string; + /** + * The credit cost of the metered feature. + */ + creditCost: number; +}; + +export type PlanFeature = { + /** + * The ID of the feature, used to refer to it in other API calls like /track or /check. + */ + id: string; + /** + * The name of the feature. + */ + name?: string | null | undefined; + /** + * The type of the feature + */ + type: PlanType; + /** + * Singular and plural display names for the feature. + */ + display?: ItemFeatureDisplay | null | undefined; + /** + * Credit cost schema for credit system features. + */ + creditSchema?: Array | null | undefined; + /** + * Whether or not the feature is archived. + */ + archived?: boolean | null | undefined; }; export const PlanResetInterval = { @@ -79,6 +149,11 @@ export type ItemPrice = { maxPurchase: number | null; }; +export type ItemDisplay = { + primaryText: string; + secondaryText?: string | undefined; +}; + export const ExpiryDurationType = { Month: "month", Forever: "forever", @@ -115,10 +190,12 @@ export type Proration = { export type Item = { featureId: string; + feature?: PlanFeature | undefined; included: number; unlimited: boolean; reset: PlanReset | null; price: ItemPrice | null; + display?: ItemDisplay | undefined; rollover?: PlanRollover | undefined; proration?: Proration | undefined; }; @@ -161,6 +238,7 @@ export type CustomerEligibility = { }; export type Plan = { + id: string; name: string; description: string | null; group: string | null; @@ -170,6 +248,7 @@ export type Plan = { price: PlanPrice | null; items: Array; freeTrial?: FreeTrial | undefined; + createdAt: number; env: PlanEnv; archived: boolean; baseVariantId: string | null; @@ -182,6 +261,31 @@ export const PriceInterval$inboundSchema: z.ZodMiniType< unknown > = openEnums.inboundSchema(PriceInterval); +/** @internal */ +export const PriceDisplay$inboundSchema: z.ZodMiniType = + z.pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), + ); + +export function priceDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PriceDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PriceDisplay' from JSON`, + ); +} + /** @internal */ export const PlanPrice$inboundSchema: z.ZodMiniType = z .pipe( @@ -189,6 +293,7 @@ export const PlanPrice$inboundSchema: z.ZodMiniType = z amount: types.number(), interval: PriceInterval$inboundSchema, interval_count: types.optional(types.number()), + display: types.optional(z.lazy(() => PriceDisplay$inboundSchema)), }), z.transform((v) => { return remap$(v, { @@ -207,6 +312,88 @@ export function planPriceFromJSON( ); } +/** @internal */ +export const PlanType$inboundSchema: z.ZodMiniType = + openEnums.inboundSchema(PlanType); + +/** @internal */ +export const ItemFeatureDisplay$inboundSchema: z.ZodMiniType< + ItemFeatureDisplay, + unknown +> = z.object({ + singular: types.string(), + plural: types.string(), +}); + +export function itemFeatureDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ItemFeatureDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ItemFeatureDisplay' from JSON`, + ); +} + +/** @internal */ +export const PlanCreditSchema$inboundSchema: z.ZodMiniType< + PlanCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function planCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PlanCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PlanCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const PlanFeature$inboundSchema: z.ZodMiniType = z + .pipe( + z.object({ + id: types.string(), + name: z.optional(z.nullable(types.string())), + type: PlanType$inboundSchema, + display: z.optional( + z.nullable(z.lazy(() => ItemFeatureDisplay$inboundSchema)), + ), + credit_schema: z.optional( + z.nullable(z.array(z.lazy(() => PlanCreditSchema$inboundSchema))), + ), + archived: z.optional(z.nullable(types.boolean())), + }), + z.transform((v) => { + return remap$(v, { + "credit_schema": "creditSchema", + }); + }), + ); + +export function planFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PlanFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PlanFeature' from JSON`, + ); +} + /** @internal */ export const PlanResetInterval$inboundSchema: z.ZodMiniType< PlanResetInterval, @@ -314,6 +501,31 @@ export function itemPriceFromJSON( ); } +/** @internal */ +export const ItemDisplay$inboundSchema: z.ZodMiniType = z + .pipe( + z.object({ + primary_text: types.string(), + secondary_text: types.optional(types.string()), + }), + z.transform((v) => { + return remap$(v, { + "primary_text": "primaryText", + "secondary_text": "secondaryText", + }); + }), + ); + +export function itemDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ItemDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ItemDisplay' from JSON`, + ); +} + /** @internal */ export const ExpiryDurationType$inboundSchema: z.ZodMiniType< ExpiryDurationType, @@ -383,10 +595,12 @@ export function prorationFromJSON( export const Item$inboundSchema: z.ZodMiniType = z.pipe( z.object({ feature_id: types.string(), + feature: types.optional(z.lazy(() => PlanFeature$inboundSchema)), included: types.number(), unlimited: types.boolean(), reset: types.nullable(z.lazy(() => PlanReset$inboundSchema)), price: types.nullable(z.lazy(() => ItemPrice$inboundSchema)), + display: types.optional(z.lazy(() => ItemDisplay$inboundSchema)), rollover: types.optional(z.lazy(() => PlanRollover$inboundSchema)), proration: types.optional(z.lazy(() => Proration$inboundSchema)), }), @@ -477,6 +691,7 @@ export function customerEligibilityFromJSON( /** @internal */ export const Plan$inboundSchema: z.ZodMiniType = z.pipe( z.object({ + id: types.string(), name: types.string(), description: types.nullable(types.string()), group: types.nullable(types.string()), @@ -486,6 +701,7 @@ export const Plan$inboundSchema: z.ZodMiniType = z.pipe( price: types.nullable(z.lazy(() => PlanPrice$inboundSchema)), items: z.array(z.lazy(() => Item$inboundSchema)), free_trial: types.optional(z.lazy(() => FreeTrial$inboundSchema)), + created_at: types.number(), env: PlanEnv$inboundSchema, archived: types.boolean(), base_variant_id: types.nullable(types.string()), @@ -498,6 +714,7 @@ export const Plan$inboundSchema: z.ZodMiniType = z.pipe( "add_on": "addOn", "auto_enable": "autoEnable", "free_trial": "freeTrial", + "created_at": "createdAt", "base_variant_id": "baseVariantId", "customer_eligibility": "customerEligibility", }); diff --git a/packages/sdk/src/models/update-customer-op.ts b/packages/sdk/src/models/update-customer-op.ts new file mode 100644 index 000000000..249d7b1e7 --- /dev/null +++ b/packages/sdk/src/models/update-customer-op.ts @@ -0,0 +1,743 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod/v4-mini"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import * as types from "../types/primitives.js"; +import { smartUnion } from "../types/smart-union.js"; +import { Plan, Plan$inboundSchema } from "./plan.js"; +import { SDKValidationError } from "./sdk-validation-error.js"; + +export type UpdateCustomerGlobals = { + xApiVersion?: string | undefined; +}; + +export type UpdateCustomerParams = { + /** + * ID of the customer to update + */ + customerId: string; + /** + * Customer's name + */ + name?: string | null | undefined; + /** + * Customer's email address + */ + email?: string | null | undefined; + /** + * Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse + */ + fingerprint?: string | null | undefined; + /** + * Additional metadata for the customer + */ + metadata?: { [k: string]: any } | null | undefined; + /** + * Stripe customer ID if you already have one + */ + stripeId?: string | null | undefined; + /** + * Whether to send email receipts to this customer + */ + sendEmailReceipts?: boolean | undefined; + /** + * Your unique identifier for the customer + */ + newCustomerId?: string | undefined; +}; + +/** + * The environment this customer was created in. + */ +export const UpdateCustomerEnv = { + Sandbox: "sandbox", + Live: "live", +} as const; +/** + * The environment this customer was created in. + */ +export type UpdateCustomerEnv = OpenEnum; + +export const UpdateCustomerStatus = { + Active: "active", + Scheduled: "scheduled", + Expired: "expired", +} as const; +export type UpdateCustomerStatus = OpenEnum; + +export type UpdateCustomerSubscription = { + plan?: Plan | undefined; + planId: string; + autoEnable: boolean; + addOn: boolean; + status: UpdateCustomerStatus; + pastDue: boolean; + canceledAt: number | null; + expiresAt: number | null; + trialEndsAt: number | null; + startedAt: number; + currentPeriodStart: number | null; + currentPeriodEnd: number | null; + quantity: number; +}; + +export type UpdateCustomerPurchase = { + plan?: Plan | undefined; + planId: string; + expiresAt: number | null; + startedAt: number; + quantity: number; +}; + +export const UpdateCustomerType = { + Boolean: "boolean", + Metered: "metered", + CreditSystem: "credit_system", +} as const; +export type UpdateCustomerType = OpenEnum; + +export type UpdateCustomerCreditSchema = { + meteredFeatureId: string; + creditCost: number; +}; + +export type UpdateCustomerDisplay = { + singular?: string | null | undefined; + plural?: string | null | undefined; +}; + +export type UpdateCustomerFeature = { + id: string; + name: string; + type: UpdateCustomerType; + consumable: boolean; + eventNames?: Array | undefined; + creditSchema?: Array | undefined; + display?: UpdateCustomerDisplay | undefined; + archived: boolean; +}; + +export const UpdateCustomerIntervalEnum = { + OneOff: "one_off", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + SemiAnnual: "semi_annual", + Year: "year", +} as const; +export type UpdateCustomerIntervalEnum = OpenEnum< + typeof UpdateCustomerIntervalEnum +>; + +export type UpdateCustomerIntervalUnion = UpdateCustomerIntervalEnum | string; + +export type UpdateCustomerReset = { + interval: UpdateCustomerIntervalEnum | string; + intervalCount?: number | undefined; + resetsAt: number | null; +}; + +export type UpdateCustomerTo = number | string; + +export type UpdateCustomerTier = { + to: number | string; + amount: number; +}; + +export const UpdateCustomerBillingMethod = { + Prepaid: "prepaid", + UsageBased: "usage_based", +} as const; +export type UpdateCustomerBillingMethod = OpenEnum< + typeof UpdateCustomerBillingMethod +>; + +export type UpdateCustomerPrice = { + amount?: number | undefined; + tiers?: Array | undefined; + billingUnits: number; + billingMethod: UpdateCustomerBillingMethod; + maxPurchase: number | null; +}; + +export type UpdateCustomerBreakdown = { + id: string; + planId: string | null; + includedGrant: number; + prepaidGrant: number; + remaining: number; + usage: number; + unlimited: boolean; + reset: UpdateCustomerReset | null; + price: UpdateCustomerPrice | null; + expiresAt: number | null; +}; + +export type UpdateCustomerRollover = { + balance: number; + expiresAt: number; +}; + +export type UpdateCustomerBalances = { + featureId: string; + feature?: UpdateCustomerFeature | undefined; + granted: number; + remaining: number; + usage: number; + unlimited: boolean; + overageAllowed: boolean; + maxPurchase: number | null; + nextResetAt: number | null; + breakdown?: Array | undefined; + rollovers?: Array | undefined; +}; + +/** + * OK + */ +export type UpdateCustomerResponse = { + /** + * Your unique identifier for the customer. + */ + id: string | null; + /** + * The name of the customer. + */ + name: string | null; + /** + * The email address of the customer. + */ + email: string | null; + /** + * Timestamp of customer creation in milliseconds since epoch. + */ + createdAt: number; + /** + * A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID. + */ + fingerprint: string | null; + /** + * Stripe customer ID. + */ + stripeId: string | null; + /** + * The environment this customer was created in. + */ + env: UpdateCustomerEnv; + /** + * The metadata for the customer. + */ + metadata: { [k: string]: any }; + /** + * Whether to send email receipts to the customer. + */ + sendEmailReceipts: boolean; + subscriptions: Array; + purchases: Array; + balances: { [k: string]: UpdateCustomerBalances }; +}; + +/** @internal */ +export type UpdateCustomerParams$Outbound = { + customer_id: string; + name?: string | null | undefined; + email?: string | null | undefined; + fingerprint?: string | null | undefined; + metadata?: { [k: string]: any } | null | undefined; + stripe_id?: string | null | undefined; + send_email_receipts?: boolean | undefined; + new_customer_id?: string | undefined; +}; + +/** @internal */ +export const UpdateCustomerParams$outboundSchema: z.ZodMiniType< + UpdateCustomerParams$Outbound, + UpdateCustomerParams +> = z.pipe( + z.object({ + customerId: z.string(), + name: z.optional(z.nullable(z.string())), + email: z.optional(z.nullable(z.string())), + fingerprint: z.optional(z.nullable(z.string())), + metadata: z.optional(z.nullable(z.record(z.string(), z.any()))), + stripeId: z.optional(z.nullable(z.string())), + sendEmailReceipts: z.optional(z.boolean()), + newCustomerId: z.optional(z.string()), + }), + z.transform((v) => { + return remap$(v, { + customerId: "customer_id", + stripeId: "stripe_id", + sendEmailReceipts: "send_email_receipts", + newCustomerId: "new_customer_id", + }); + }), +); + +export function updateCustomerParamsToJSON( + updateCustomerParams: UpdateCustomerParams, +): string { + return JSON.stringify( + UpdateCustomerParams$outboundSchema.parse(updateCustomerParams), + ); +} + +/** @internal */ +export const UpdateCustomerEnv$inboundSchema: z.ZodMiniType< + UpdateCustomerEnv, + unknown +> = openEnums.inboundSchema(UpdateCustomerEnv); + +/** @internal */ +export const UpdateCustomerStatus$inboundSchema: z.ZodMiniType< + UpdateCustomerStatus, + unknown +> = openEnums.inboundSchema(UpdateCustomerStatus); + +/** @internal */ +export const UpdateCustomerSubscription$inboundSchema: z.ZodMiniType< + UpdateCustomerSubscription, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + auto_enable: types.boolean(), + add_on: types.boolean(), + status: UpdateCustomerStatus$inboundSchema, + past_due: types.boolean(), + canceled_at: types.nullable(types.number()), + expires_at: types.nullable(types.number()), + trial_ends_at: types.nullable(types.number()), + started_at: types.number(), + current_period_start: types.nullable(types.number()), + current_period_end: types.nullable(types.number()), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "auto_enable": "autoEnable", + "add_on": "addOn", + "past_due": "pastDue", + "canceled_at": "canceledAt", + "expires_at": "expiresAt", + "trial_ends_at": "trialEndsAt", + "started_at": "startedAt", + "current_period_start": "currentPeriodStart", + "current_period_end": "currentPeriodEnd", + }); + }), +); + +export function updateCustomerSubscriptionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerSubscription$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerSubscription' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerPurchase$inboundSchema: z.ZodMiniType< + UpdateCustomerPurchase, + unknown +> = z.pipe( + z.object({ + plan: types.optional(Plan$inboundSchema), + plan_id: types.string(), + expires_at: types.nullable(types.number()), + started_at: types.number(), + quantity: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "expires_at": "expiresAt", + "started_at": "startedAt", + }); + }), +); + +export function updateCustomerPurchaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerPurchase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerPurchase' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerType$inboundSchema: z.ZodMiniType< + UpdateCustomerType, + unknown +> = openEnums.inboundSchema(UpdateCustomerType); + +/** @internal */ +export const UpdateCustomerCreditSchema$inboundSchema: z.ZodMiniType< + UpdateCustomerCreditSchema, + unknown +> = z.pipe( + z.object({ + metered_feature_id: types.string(), + credit_cost: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "metered_feature_id": "meteredFeatureId", + "credit_cost": "creditCost", + }); + }), +); + +export function updateCustomerCreditSchemaFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerCreditSchema$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerCreditSchema' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerDisplay$inboundSchema: z.ZodMiniType< + UpdateCustomerDisplay, + unknown +> = z.object({ + singular: z.optional(z.nullable(types.string())), + plural: z.optional(z.nullable(types.string())), +}); + +export function updateCustomerDisplayFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerDisplay$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerDisplay' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerFeature$inboundSchema: z.ZodMiniType< + UpdateCustomerFeature, + unknown +> = z.pipe( + z.object({ + id: types.string(), + name: types.string(), + type: UpdateCustomerType$inboundSchema, + consumable: types.boolean(), + event_names: types.optional(z.array(types.string())), + credit_schema: types.optional( + z.array(z.lazy(() => UpdateCustomerCreditSchema$inboundSchema)), + ), + display: types.optional(z.lazy(() => UpdateCustomerDisplay$inboundSchema)), + archived: types.boolean(), + }), + z.transform((v) => { + return remap$(v, { + "event_names": "eventNames", + "credit_schema": "creditSchema", + }); + }), +); + +export function updateCustomerFeatureFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerFeature$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerFeature' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerIntervalEnum$inboundSchema: z.ZodMiniType< + UpdateCustomerIntervalEnum, + unknown +> = openEnums.inboundSchema(UpdateCustomerIntervalEnum); + +/** @internal */ +export const UpdateCustomerIntervalUnion$inboundSchema: z.ZodMiniType< + UpdateCustomerIntervalUnion, + unknown +> = smartUnion([UpdateCustomerIntervalEnum$inboundSchema, types.string()]); + +export function updateCustomerIntervalUnionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerIntervalUnion$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerIntervalUnion' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerReset$inboundSchema: z.ZodMiniType< + UpdateCustomerReset, + unknown +> = z.pipe( + z.object({ + interval: smartUnion([ + UpdateCustomerIntervalEnum$inboundSchema, + types.string(), + ]), + interval_count: types.optional(types.number()), + resets_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "interval_count": "intervalCount", + "resets_at": "resetsAt", + }); + }), +); + +export function updateCustomerResetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerReset$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerReset' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerTo$inboundSchema: z.ZodMiniType< + UpdateCustomerTo, + unknown +> = smartUnion([types.number(), types.string()]); + +export function updateCustomerToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerTo' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerTier$inboundSchema: z.ZodMiniType< + UpdateCustomerTier, + unknown +> = z.object({ + to: smartUnion([types.number(), types.string()]), + amount: types.number(), +}); + +export function updateCustomerTierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerTier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerTier' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerBillingMethod$inboundSchema: z.ZodMiniType< + UpdateCustomerBillingMethod, + unknown +> = openEnums.inboundSchema(UpdateCustomerBillingMethod); + +/** @internal */ +export const UpdateCustomerPrice$inboundSchema: z.ZodMiniType< + UpdateCustomerPrice, + unknown +> = z.pipe( + z.object({ + amount: types.optional(types.number()), + tiers: types.optional( + z.array(z.lazy(() => UpdateCustomerTier$inboundSchema)), + ), + billing_units: types.number(), + billing_method: UpdateCustomerBillingMethod$inboundSchema, + max_purchase: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "billing_units": "billingUnits", + "billing_method": "billingMethod", + "max_purchase": "maxPurchase", + }); + }), +); + +export function updateCustomerPriceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerPrice$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerPrice' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerBreakdown$inboundSchema: z.ZodMiniType< + UpdateCustomerBreakdown, + unknown +> = z.pipe( + z.object({ + id: z._default(types.string(), ""), + plan_id: types.nullable(types.string()), + included_grant: types.number(), + prepaid_grant: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + reset: types.nullable(z.lazy(() => UpdateCustomerReset$inboundSchema)), + price: types.nullable(z.lazy(() => UpdateCustomerPrice$inboundSchema)), + expires_at: types.nullable(types.number()), + }), + z.transform((v) => { + return remap$(v, { + "plan_id": "planId", + "included_grant": "includedGrant", + "prepaid_grant": "prepaidGrant", + "expires_at": "expiresAt", + }); + }), +); + +export function updateCustomerBreakdownFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerBreakdown$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerBreakdown' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerRollover$inboundSchema: z.ZodMiniType< + UpdateCustomerRollover, + unknown +> = z.pipe( + z.object({ + balance: types.number(), + expires_at: types.number(), + }), + z.transform((v) => { + return remap$(v, { + "expires_at": "expiresAt", + }); + }), +); + +export function updateCustomerRolloverFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerRollover$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerRollover' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerBalances$inboundSchema: z.ZodMiniType< + UpdateCustomerBalances, + unknown +> = z.pipe( + z.object({ + feature_id: types.string(), + feature: types.optional(z.lazy(() => UpdateCustomerFeature$inboundSchema)), + granted: types.number(), + remaining: types.number(), + usage: types.number(), + unlimited: types.boolean(), + overage_allowed: types.boolean(), + max_purchase: types.nullable(types.number()), + next_reset_at: types.nullable(types.number()), + breakdown: types.optional( + z.array(z.lazy(() => UpdateCustomerBreakdown$inboundSchema)), + ), + rollovers: types.optional( + z.array(z.lazy(() => UpdateCustomerRollover$inboundSchema)), + ), + }), + z.transform((v) => { + return remap$(v, { + "feature_id": "featureId", + "overage_allowed": "overageAllowed", + "max_purchase": "maxPurchase", + "next_reset_at": "nextResetAt", + }); + }), +); + +export function updateCustomerBalancesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerBalances$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerBalances' from JSON`, + ); +} + +/** @internal */ +export const UpdateCustomerResponse$inboundSchema: z.ZodMiniType< + UpdateCustomerResponse, + unknown +> = z.pipe( + z.object({ + id: types.nullable(types.string()), + name: types.nullable(types.string()), + email: types.nullable(types.string()), + created_at: types.number(), + fingerprint: types.nullable(types.string()), + stripe_id: types.nullable(types.string()), + env: UpdateCustomerEnv$inboundSchema, + metadata: z.record(z.string(), z.any()), + send_email_receipts: types.boolean(), + subscriptions: z.array( + z.lazy(() => UpdateCustomerSubscription$inboundSchema), + ), + purchases: z.array(z.lazy(() => UpdateCustomerPurchase$inboundSchema)), + balances: z.record( + z.string(), + z.lazy(() => UpdateCustomerBalances$inboundSchema), + ), + }), + z.transform((v) => { + return remap$(v, { + "created_at": "createdAt", + "stripe_id": "stripeId", + "send_email_receipts": "sendEmailReceipts", + }); + }), +); + +export function updateCustomerResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCustomerResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCustomerResponse' from JSON`, + ); +} diff --git a/packages/sdk/src/sdk/customers.ts b/packages/sdk/src/sdk/customers.ts index cc75f3590..3f5a07797 100644 --- a/packages/sdk/src/sdk/customers.ts +++ b/packages/sdk/src/sdk/customers.ts @@ -2,7 +2,10 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +import { customersDelete } from "../funcs/customers-delete.js"; import { customersGetOrCreate } from "../funcs/customers-get-or-create.js"; +import { customersList } from "../funcs/customers-list.js"; +import { customersUpdate } from "../funcs/customers-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; import { unwrapAsync } from "../types/fp.js"; @@ -10,19 +13,6 @@ import { unwrapAsync } from "../types/fp.js"; export class Customers extends ClientSDK { /** * Creates a customer if they do not exist, or returns the existing customer by your external customer ID. - * - * Use this as the primary entrypoint before billing operations so the customer record is always present and up to date. - * - * @example - * ```typescript - * // Create or fetch a customer by external ID - * const response = await client.getOrCreate({ - * - * "id": "cus_123", - * "name": "John Doe", - * "email": "john@example.com" - * }); - * ``` */ async getOrCreate( request: models.GetOrCreateCustomerParams, @@ -34,4 +24,46 @@ export class Customers extends ClientSDK { options, )); } + + /** + * Lists customers with pagination and optional filters. + */ + async list( + request?: models.ListCustomersParams | undefined, + options?: RequestOptions, + ): Promise { + return unwrapAsync(customersList( + this, + request, + options, + )); + } + + /** + * Updates an existing customer by ID. + */ + async update( + request: models.UpdateCustomerParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(customersUpdate( + this, + request, + options, + )); + } + + /** + * Deletes a customer by ID. + */ + async delete( + request: models.DeleteCustomerParams, + options?: RequestOptions, + ): Promise { + return unwrapAsync(customersDelete( + this, + request, + options, + )); + } } diff --git a/server/src/honoMiddlewares/validatorMiddleware.ts b/server/src/honoMiddlewares/validatorMiddleware.ts index a13f518b1..60acbb135 100644 --- a/server/src/honoMiddlewares/validatorMiddleware.ts +++ b/server/src/honoMiddlewares/validatorMiddleware.ts @@ -53,6 +53,11 @@ export const validator = ( body = {}; } + // If body is null/undefined, default to empty object + if (body === null || body === undefined) { + body = {}; + } + const result = schema.safeParse(body); if (!result.success) { throw result.error; diff --git a/server/src/honoMiddlewares/versionedValidator.ts b/server/src/honoMiddlewares/versionedValidator.ts index 6fe897bda..75a63a0e1 100644 --- a/server/src/honoMiddlewares/versionedValidator.ts +++ b/server/src/honoMiddlewares/versionedValidator.ts @@ -98,9 +98,29 @@ export const versionedValidator = ({ } validatedData = result.data as Record; c.req.addValidatedData(target, validatedData); - } else { - // For other targets, use zValidator + } else if (target === "json") { + // For JSON body, handle empty/null body gracefully + let rawBody: unknown; + try { + rawBody = await c.req.json(); + } catch { + // Empty or malformed body - treat as empty object + rawBody = {}; + } + // If body is null/undefined, default to empty object + if (rawBody === null || rawBody === undefined) { + rawBody = {}; + } + + const result = schema.safeParse(rawBody); + if (!result.success) { + throw result.error; + } + validatedData = result.data as Record; + c.req.addValidatedData(target, validatedData); + } else { + // For other targets (param, header, form), use zValidator const validatorMiddleware = zValidator(target, schema, (result, _c) => { if (!result.success) { // Validation errors reference fields from user's version ✅ diff --git a/server/src/internal/customers/actions/update/updateCustomer.ts b/server/src/internal/customers/actions/update/updateCustomer.ts index 3e806fb69..6e121effb 100644 --- a/server/src/internal/customers/actions/update/updateCustomer.ts +++ b/server/src/internal/customers/actions/update/updateCustomer.ts @@ -5,7 +5,7 @@ import { notNullish, ProcessorType, RecaseError, - type UpdateCustomerParams, + type UpdateCustomerParamsV1, } from "@autumn/shared"; import type Stripe from "stripe"; import { createStripeCli } from "@/external/connect/createStripeCli"; @@ -17,10 +17,14 @@ export const updateCustomer = async ({ params, }: { ctx: AutumnContext; - params: UpdateCustomerParams; + params: UpdateCustomerParamsV1; }) => { const { db, org, env, logger } = ctx; - const { customer_id: customerId, ...newCusData } = params; + const { + customer_id: customerId, + new_customer_id: newCustomerId, + ...newCusData + } = params; const originalCustomer = await CusService.get({ db, @@ -33,25 +37,25 @@ export const updateCustomer = async ({ throw new CustomerNotFoundError({ customerId }); } - if (newCusData.id === null) { + if (newCustomerId === null) { throw new RecaseError({ message: `Not allowed to update a customer's ID to null`, }); } - if (notNullish(newCusData.id) && originalCustomer.id !== newCusData.id) { + if (notNullish(newCustomerId) && originalCustomer.id !== newCustomerId) { // Fetch for existing customer const existingCustomer = await CusService.get({ db, - idOrInternalId: newCusData.id, + idOrInternalId: newCustomerId, orgId: org.id, env, }); if (existingCustomer) { throw new CustomerAlreadyExistsError({ - message: `Customer with ID ${newCusData.id} already exists, can't change to this ID`, - customerId: newCusData.id, + message: `Customer with ID ${newCustomerId} already exists, can't change to this ID`, + customerId: newCustomerId, }); } } @@ -100,6 +104,7 @@ export const updateCustomer = async ({ // Prepare update data const updateData: Partial = { ...newCusData, + id: newCustomerId, metadata: { ...oldMetadata, ...newMetadata, @@ -111,7 +116,7 @@ export const updateCustomer = async ({ updateData.processor = { id: newStripeId, type: ProcessorType.Stripe }; } - if (!notNullish(newCusData.id) || originalCustomer.id === newCusData.id) { + if (!notNullish(newCustomerId) || originalCustomer.id === newCustomerId) { // Remove id from update if not changing delete updateData.id; } @@ -124,5 +129,5 @@ export const updateCustomer = async ({ update: updateData, }); - return newCusData.id ?? customerId; + return newCustomerId ?? customerId; }; diff --git a/server/src/internal/customers/handlers/handleListCustomersV2.ts b/server/src/internal/customers/handlers/handleListCustomersV2.ts index 96f305849..dc36e2782 100644 --- a/server/src/internal/customers/handlers/handleListCustomersV2.ts +++ b/server/src/internal/customers/handlers/handleListCustomersV2.ts @@ -1,7 +1,7 @@ import { AffectedResource, ApiVersion, - type BaseApiCustomer, + type BaseApiCustomerV5, ListCustomersV2ParamsSchema, type PagePaginatedResponse, } from "@autumn/shared"; @@ -22,7 +22,7 @@ export const handleListCustomersV2 = createRoute({ const hasMore = customers.length === body.limit; - return c.json>({ + return c.json>({ list: customers, total: customers.length, limit: body.limit, diff --git a/server/src/internal/customers/handlers/handleUpdateCustomer/handleUpdateCustomer.ts b/server/src/internal/customers/handlers/handleUpdateCustomer/handleUpdateCustomer.ts index 38fa6b52b..479553112 100644 --- a/server/src/internal/customers/handlers/handleUpdateCustomer/handleUpdateCustomer.ts +++ b/server/src/internal/customers/handlers/handleUpdateCustomer/handleUpdateCustomer.ts @@ -26,6 +26,7 @@ export const handleUpdateCustomer = createRoute({ ctx, params: { customer_id, + new_customer_id: params.id, ...params, }, }); diff --git a/shared/api/billing/attachV2/attachParamsV1.ts b/shared/api/billing/attachV2/attachParamsV1.ts new file mode 100644 index 000000000..b15cbc32b --- /dev/null +++ b/shared/api/billing/attachV2/attachParamsV1.ts @@ -0,0 +1,52 @@ +import { z } from "zod/v4"; +import { PlanTimingSchema } from "../../../models/billingModels/context/attachBillingContext.js"; +import { ProductItemSchema } from "../../../models/productV2Models/productItemModels/productItemModels.js"; +import { BillingBehaviorSchema } from "../common/billingBehavior.js"; +import { BillingParamsBaseSchema } from "../common/billingParamsBase.js"; + +export const RedirectModeSchema = z.enum(["always", "if_required", "never"]); +export type RedirectMode = z.infer; + +export const ExtAttachParamsV0Schema = BillingParamsBaseSchema.extend({ + // Product identification + product_id: z.string(), + + // Invoice mode + invoice: z.boolean().optional(), + enable_product_immediately: z.boolean().optional(), + finalize_invoice: z.boolean().optional(), + + // Checkout behavior + redirect_mode: RedirectModeSchema.default("always"), + success_url: z.string().optional(), + + new_billing_subscription: z.boolean().optional(), + + plan_schedule: PlanTimingSchema.optional(), + + // Billing behavior for attach operations (product transitions): + // - 'prorate_immediately' (default): Invoice line items are charged immediately + // - 'next_cycle_only': Do NOT create any charges due to the attach + billing_behavior: BillingBehaviorSchema.optional(), + + adjustable_quantity: z.boolean().optional(), +}); + +export const AttachParamsV0Schema = ExtAttachParamsV0Schema.extend({ + // Custom product configuration + items: z.array(ProductItemSchema).optional(), +}).refine( + (data) => { + if (data.items && data.items.length === 0) { + return false; + } + return true; + }, + { + message: "Must provide at least one item when using custom plan", + }, +); + +export type ExtAttachParamsV0 = z.input; +export type AttachParamsV0 = z.infer; +export type AttachParamsV0Input = z.input; diff --git a/shared/api/common/index.ts b/shared/api/common/index.ts new file mode 100644 index 000000000..f0fd49b95 --- /dev/null +++ b/shared/api/common/index.ts @@ -0,0 +1 @@ +export * from "./customerId.js"; diff --git a/shared/api/customers/crud/updateCustomerParams.ts b/shared/api/customers/crud/updateCustomerParams.ts index 884343245..c1d4f8ceb 100644 --- a/shared/api/customers/crud/updateCustomerParams.ts +++ b/shared/api/customers/crud/updateCustomerParams.ts @@ -1,6 +1,5 @@ import { CustomerDataSchema } from "@api/common/customerData.js"; import { CustomerIdSchema } from "@api/common/customerId.js"; -import { CustomerExpandArraySchema } from "@api/customers/components/customerExpand/customerExpand.js"; import { z } from "zod/v4"; export const UpdateCustomerParamsV0Schema = z @@ -8,19 +7,29 @@ export const UpdateCustomerParamsV0Schema = z id: CustomerIdSchema.optional().describe( "New unique identifier for the customer", ), - expand: CustomerExpandArraySchema.optional(), ...CustomerDataSchema.shape, }) - .meta({ - title: "UpdateCustomerParams", - description: "Parameters for updating a customer", + .omit({ + auto_enable_plan_id: true, + create_in_stripe: true, }); -export const UpdateCustomerParamsV1Schema = z.object({ - customer_id: CustomerIdSchema.describe("ID of the customer to update"), - ...UpdateCustomerParamsV0Schema.shape, -}); +export const UpdateCustomerParamsV1Schema = z + .object({ + customer_id: CustomerIdSchema.describe("ID of the customer to update"), + ...UpdateCustomerParamsV0Schema.shape, + new_customer_id: CustomerIdSchema.optional().describe( + "New ID for the customer", + ), + }) + .omit({ + id: true, + }); export type UpdateCustomerParamsV0 = z.infer< typeof UpdateCustomerParamsV0Schema >; + +export type UpdateCustomerParamsV1 = z.infer< + typeof UpdateCustomerParamsV1Schema +>; diff --git a/shared/api/models.ts b/shared/api/models.ts index b7b5cd875..114f0d157 100644 --- a/shared/api/models.ts +++ b/shared/api/models.ts @@ -52,6 +52,7 @@ export * from "./balances/usageModels.js"; export * from "./billing/index.js"; export * from "./common/customerData.js"; export * from "./common/entityData.js"; +export * from "./common/index.js"; export * from "./common/pagePaginationSchemas.js"; export * from "./entities/apiBaseEntity.js"; // Errors