From fb92ea4bd83c973fd04142629f06a439e4f70fe9 Mon Sep 17 00:00:00 2001 From: rolosp <6114043+rolosp@users.noreply.github.com> Date: Wed, 27 May 2026 09:23:32 +0200 Subject: [PATCH] feat: fix type gen for generics and ignores for templates and e2e smoke test with go sdk --- .../components/addonpagepaginatedresponse.go | 36 + .../models/components/addonreference.go | 28 + .../models/components/address.go | 84 + .../components/apppagepaginatedresponse.go | 36 + .../components/billingpartyaddresses.go | 6 +- .../billingprofilepagepaginatedresponse.go | 36 + .../models/components/billingratecard.go | 4 +- .../components/billingratecardtaxconfig.go | 6 +- .../components/chargepagepaginatedresponse.go | 36 + .../costbasispagepaginatedresponse.go | 36 + .../models/components/createaddonrequest.go | 88 + .../models/components/createaddonresponse.go | 20 + .../components/createbillingprofilerequest.go | 87 + .../createbillingprofileresponse.go | 20 + .../components/createcostbasisrequest.go | 53 + .../components/createcostbasisresponse.go | 20 + ...eatestripecheckoutsessionresultresponse.go | 20 + ...ripecustomerportalsessionresultresponse.go | 20 + .../createcreditadjustmentrequest.go | 68 + .../createcreditadjustmentresponse.go | 20 + .../components/createcreditgrantresponse.go | 20 + .../components/createcurrencycustomrequest.go | 57 + .../createcurrencycustomresponse.go | 20 + .../components/createcustomerrequest.go | 94 + .../components/createcustomerresponse.go | 20 + .../models/components/createfeaturerequest.go | 79 + .../components/createfeatureresponse.go | 20 + .../components/createplanaddonrequest.go | 79 + .../components/createplanaddonresponse.go | 20 + .../models/components/createplanrequest.go | 98 + .../models/components/createplanresponse.go | 20 + .../models/components/createpriceresponse.go | 20 + .../components/createsubscriptionresponse.go | 20 + .../models/components/createtaxcoderequest.go | 67 + .../components/createtaxcoderesponse.go | 20 + .../creditgrantpagepaginatedresponse.go | 36 + .../credittransactionpaginatedresponse.go | 36 + .../models/components/currencycode.go | 8 + .../currencypagepaginatedresponse.go | 36 + .../customerpagepaginatedresponse.go | 36 + .../featurepagepaginatedresponse.go | 36 + .../models/components/featurereference.go | 28 + .../models/components/getaddonresponse.go | 20 + .../models/components/getappresponse.go | 20 + .../components/getbillingprofileresponse.go | 20 + .../components/getcreditbalancesresponse.go | 20 + .../components/getcreditgrantresponse.go | 20 + .../getcustomerbillingdataresponse.go | 20 + .../models/components/getcustomerresponse.go | 20 + .../models/components/getfeatureresponse.go | 20 + .../getorganizationdefaulttaxcodesresponse.go | 20 + .../models/components/getplanaddonresponse.go | 20 + .../models/components/getplanresponse.go | 20 + .../components/getsubscriptionresponse.go | 20 + .../models/components/gettaxcoderesponse.go | 20 + .../models/components/llmcostprice.go | 115 + .../components/organizationdefaulttaxcodes.go | 12 +- .../models/components/planaddon.go | 6 +- .../planaddonpagepaginatedresponse.go | 36 + .../components/planpagepaginatedresponse.go | 36 + .../components/pricepagepaginatedresponse.go | 36 + .../models/components/subscriptionaddon.go | 6 +- .../subscriptionaddonpagepaginatedresponse.go | 36 + .../subscriptionpagepaginatedresponse.go | 36 + .../taxcodepagepaginatedresponse.go | 36 + .../models/components/taxcodereference.go | 28 + .../models/components/updateaddonresponse.go | 20 + .../updatebillingprofileresponse.go | 20 + .../components/updatecreditgrantresponse.go | 20 + .../components/updatefeatureresponse.go | 20 + ...pdateorganizationdefaulttaxcodesrequest.go | 38 + .../models/components/updateplanresponse.go | 20 + .../components/updatesubscriptionresponse.go | 20 + .../models/components/upsertaddonrequest.go | 68 + .../models/components/upsertaddonresponse.go | 20 + .../upsertappcustomerdatarequest.go | 38 + .../upsertappcustomerdataresponse.go | 20 + .../components/upsertbillingprofilerequest.go | 78 + .../upsertcustomerbillingdatarequest.go | 40 + .../upsertcustomerbillingdataresponse.go | 20 + ...sertorganizationdefaulttaxcodesresponse.go | 20 + .../components/upsertplanaddonrequest.go | 70 + .../components/upsertplanaddonresponse.go | 20 + .../models/components/upsertplanrequest.go | 69 + .../models/components/upsertplanresponse.go | 20 + .../models/components/upserttaxcoderequest.go | 59 + .../components/upserttaxcoderesponse.go | 20 + .../models/operations/createaddon.go | 2 +- .../models/operations/createbillingprofile.go | 2 +- .../models/operations/createcostbasis.go | 2 +- .../operations/createcreditadjustment.go | 2 +- .../models/operations/createcustomcurrency.go | 2 +- .../models/operations/createcustomer.go | 2 +- .../models/operations/createfeature.go | 2 +- .../operations/createllmcostoverride.go | 2 +- .../models/operations/createplan.go | 2 +- .../models/operations/createplanaddon.go | 2 +- .../models/operations/createtaxcode.go | 2 +- .../models/operations/getllmcostprice.go | 2 +- .../models/operations/updateaddon.go | 2 +- .../models/operations/updatebillingprofile.go | 2 +- .../operations/updatecustomerbilling.go | 2 +- .../updatecustomerbillingappdata.go | 2 +- .../updateorganizationdefaulttaxcodes.go | 2 +- .../models/operations/updateplan.go | 2 +- .../models/operations/updateplanaddon.go | 2 +- .../models/operations/upserttaxcode.go | 2 +- .../openmeterllmcostoverrides.go | 2 +- .../aip-client-go/openmeterllmcostprices.go | 2 +- .../packages/aip-client-javascript/models.ts | 2600 +++++++++-------- .../typespec-go/src/gen/gen_vendor.ts | 14 + .../packages/typespec-go/src/model/builder.ts | 42 +- .../internal/config/sdkconfiguration.go | 2 + .../src/templates/internal/hooks/hooks.go | 2 + .../templates/internal/utils/contenttype.go | 2 + .../src/templates/internal/utils/env.go | 2 + .../src/templates/internal/utils/form.go | 2 + .../src/templates/internal/utils/headers.go | 2 + .../src/templates/internal/utils/json.go | 2 + .../templates/internal/utils/pathparams.go | 2 + .../templates/internal/utils/queryparams.go | 2 + .../templates/internal/utils/requestbody.go | 2 + .../src/templates/internal/utils/retries.go | 2 + .../src/templates/internal/utils/security.go | 2 + .../src/templates/internal/utils/union.go | 2 + .../templates/internal/utils/union_test.go | 2 + .../src/templates/internal/utils/utils.go | 2 + .../templates/models/apierrors/apierror.go | 2 + .../optionalnullable/optionalnullable.go | 2 + .../optionalnullable/optionalnullable_test.go | 2 + .../typespec-go/src/templates/retry/config.go | 2 + .../typespec-go/src/templates/types/bigint.go | 2 + .../typespec-go/src/templates/types/date.go | 2 + .../src/templates/types/datetime.go | 2 + .../src/templates/types/pointers.go | 2 + api/spec/pnpm-lock.yaml | 3 - e2e/productcatalog_smoke_sdk_v3_test.go | 344 +++ go.mod | 6 + 138 files changed, 4830 insertions(+), 1226 deletions(-) create mode 100644 api/spec/packages/aip-client-go/models/components/addonpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/addonreference.go create mode 100644 api/spec/packages/aip-client-go/models/components/address.go create mode 100644 api/spec/packages/aip-client-go/models/components/apppagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/billingprofilepagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/chargepagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/costbasispagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createaddonrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createbillingprofilerequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createbillingprofileresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcostbasisrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcostbasisresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcreatestripecheckoutsessionresultresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcreatestripecustomerportalsessionresultresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcreditadjustmentrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcreditadjustmentresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcreditgrantresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcurrencycustomrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcurrencycustomresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcustomerrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createcustomerresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createfeaturerequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createfeatureresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createplanaddonrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createplanaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createplanrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createplanresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createpriceresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createsubscriptionresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/createtaxcoderequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/createtaxcoderesponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/creditgrantpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/credittransactionpaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/currencycode.go create mode 100644 api/spec/packages/aip-client-go/models/components/currencypagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/customerpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/featurepagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/featurereference.go create mode 100644 api/spec/packages/aip-client-go/models/components/getaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getappresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getbillingprofileresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getcreditbalancesresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getcreditgrantresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getcustomerbillingdataresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getcustomerresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getfeatureresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getorganizationdefaulttaxcodesresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getplanaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getplanresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/getsubscriptionresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/gettaxcoderesponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/llmcostprice.go create mode 100644 api/spec/packages/aip-client-go/models/components/planaddonpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/planpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/pricepagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/subscriptionaddonpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/subscriptionpagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/taxcodepagepaginatedresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/taxcodereference.go create mode 100644 api/spec/packages/aip-client-go/models/components/updateaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/updatebillingprofileresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/updatecreditgrantresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/updatefeatureresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/updateorganizationdefaulttaxcodesrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/updateplanresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/updatesubscriptionresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertaddonrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertappcustomerdatarequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertappcustomerdataresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertbillingprofilerequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdatarequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdataresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertorganizationdefaulttaxcodesresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertplanaddonrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertplanaddonresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertplanrequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upsertplanresponse.go create mode 100644 api/spec/packages/aip-client-go/models/components/upserttaxcoderequest.go create mode 100644 api/spec/packages/aip-client-go/models/components/upserttaxcoderesponse.go create mode 100644 e2e/productcatalog_smoke_sdk_v3_test.go diff --git a/api/spec/packages/aip-client-go/models/components/addonpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/addonpagepaginatedresponse.go new file mode 100644 index 0000000000..bb025502ee --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/addonpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type AddonPagePaginatedResponse struct { + Data []Addon `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (a AddonPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AddonPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { + return err + } + return nil +} + +func (a *AddonPagePaginatedResponse) GetData() []Addon { + if a == nil { + return nil + } + return a.Data +} + +func (a *AddonPagePaginatedResponse) GetMeta() PaginatedMeta { + if a == nil { + return PaginatedMeta{} + } + return a.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/addonreference.go b/api/spec/packages/aip-client-go/models/components/addonreference.go new file mode 100644 index 0000000000..1c2dd3c4de --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/addonreference.go @@ -0,0 +1,28 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon reference. +type AddonReference struct { + Id string `json:"id"` +} + +func (a AddonReference) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AddonReference) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { + return err + } + return nil +} + +func (a *AddonReference) GetId() string { + if a == nil { + return "" + } + return a.Id +} diff --git a/api/spec/packages/aip-client-go/models/components/address.go b/api/spec/packages/aip-client-go/models/components/address.go new file mode 100644 index 0000000000..2513d5bfd9 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/address.go @@ -0,0 +1,84 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Address +type Address struct { + // Country code in [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) + // alpha-2 format. + Country *string `json:"country,omitzero"` + // Postal code. + PostalCode *string `json:"postal_code,omitzero"` + // State or province. + State *string `json:"state,omitzero"` + // City. + City *string `json:"city,omitzero"` + // First line of the address. + Line1 *string `json:"line1,omitzero"` + // Second line of the address. + Line2 *string `json:"line2,omitzero"` + // Phone number. + PhoneNumber *string `json:"phone_number,omitzero"` +} + +func (a Address) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *Address) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { + return err + } + return nil +} + +func (a *Address) GetCountry() *string { + if a == nil { + return nil + } + return a.Country +} + +func (a *Address) GetPostalCode() *string { + if a == nil { + return nil + } + return a.PostalCode +} + +func (a *Address) GetState() *string { + if a == nil { + return nil + } + return a.State +} + +func (a *Address) GetCity() *string { + if a == nil { + return nil + } + return a.City +} + +func (a *Address) GetLine1() *string { + if a == nil { + return nil + } + return a.Line1 +} + +func (a *Address) GetLine2() *string { + if a == nil { + return nil + } + return a.Line2 +} + +func (a *Address) GetPhoneNumber() *string { + if a == nil { + return nil + } + return a.PhoneNumber +} diff --git a/api/spec/packages/aip-client-go/models/components/apppagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/apppagepaginatedresponse.go new file mode 100644 index 0000000000..97efa7d92d --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/apppagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type AppPagePaginatedResponse struct { + Data []BillingApp `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (a AppPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *AppPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { + return err + } + return nil +} + +func (a *AppPagePaginatedResponse) GetData() []BillingApp { + if a == nil { + return nil + } + return a.Data +} + +func (a *AppPagePaginatedResponse) GetMeta() PaginatedMeta { + if a == nil { + return PaginatedMeta{} + } + return a.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/billingpartyaddresses.go b/api/spec/packages/aip-client-go/models/components/billingpartyaddresses.go index 44d1f07c3c..e7e6f18041 100644 --- a/api/spec/packages/aip-client-go/models/components/billingpartyaddresses.go +++ b/api/spec/packages/aip-client-go/models/components/billingpartyaddresses.go @@ -7,7 +7,7 @@ import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/interna // A collection of addresses for the party. type BillingPartyAddresses struct { // Billing address. - BillingAddress BillingAddress `json:"billing_address"` + BillingAddress Address `json:"billing_address"` } func (b BillingPartyAddresses) MarshalJSON() ([]byte, error) { @@ -21,9 +21,9 @@ func (b *BillingPartyAddresses) UnmarshalJSON(data []byte) error { return nil } -func (b *BillingPartyAddresses) GetBillingAddress() BillingAddress { +func (b *BillingPartyAddresses) GetBillingAddress() Address { if b == nil { - return BillingAddress{} + return Address{} } return b.BillingAddress } diff --git a/api/spec/packages/aip-client-go/models/components/billingprofilepagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/billingprofilepagepaginatedresponse.go new file mode 100644 index 0000000000..107c48e359 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/billingprofilepagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type BillingProfilePagePaginatedResponse struct { + Data []BillingProfile `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (b BillingProfilePagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(b, "", false) +} + +func (b *BillingProfilePagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &b, "", false, nil); err != nil { + return err + } + return nil +} + +func (b *BillingProfilePagePaginatedResponse) GetData() []BillingProfile { + if b == nil { + return nil + } + return b.Data +} + +func (b *BillingProfilePagePaginatedResponse) GetMeta() PaginatedMeta { + if b == nil { + return PaginatedMeta{} + } + return b.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/billingratecard.go b/api/spec/packages/aip-client-go/models/components/billingratecard.go index 59e580d43e..5333d4aad0 100644 --- a/api/spec/packages/aip-client-go/models/components/billingratecard.go +++ b/api/spec/packages/aip-client-go/models/components/billingratecard.go @@ -17,7 +17,7 @@ type BillingRateCard struct { Labels *Labels `json:"labels,omitzero"` Key string `json:"key"` // The feature associated with the rate card. - Feature *CustomerReference `json:"feature,omitzero"` + Feature *FeatureReference `json:"feature,omitzero"` // The billing cadence of the rate card. When null, the charge is one-time // (non-recurring). Only valid for flat prices. BillingCadence *string `json:"billing_cadence,omitzero"` @@ -74,7 +74,7 @@ func (b *BillingRateCard) GetKey() string { return b.Key } -func (b *BillingRateCard) GetFeature() *CustomerReference { +func (b *BillingRateCard) GetFeature() *FeatureReference { if b == nil { return nil } diff --git a/api/spec/packages/aip-client-go/models/components/billingratecardtaxconfig.go b/api/spec/packages/aip-client-go/models/components/billingratecardtaxconfig.go index bdbcef8dba..557b281c1d 100644 --- a/api/spec/packages/aip-client-go/models/components/billingratecardtaxconfig.go +++ b/api/spec/packages/aip-client-go/models/components/billingratecardtaxconfig.go @@ -7,7 +7,7 @@ import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/interna // The tax config of the rate card. type BillingRateCardTaxConfig struct { Behavior *BillingTaxBehavior `json:"behavior,omitzero"` - Code CustomerReference `json:"code"` + Code TaxCodeReference `json:"code"` } func (b BillingRateCardTaxConfig) MarshalJSON() ([]byte, error) { @@ -28,9 +28,9 @@ func (b *BillingRateCardTaxConfig) GetBehavior() *BillingTaxBehavior { return b.Behavior } -func (b *BillingRateCardTaxConfig) GetCode() CustomerReference { +func (b *BillingRateCardTaxConfig) GetCode() TaxCodeReference { if b == nil { - return CustomerReference{} + return TaxCodeReference{} } return b.Code } diff --git a/api/spec/packages/aip-client-go/models/components/chargepagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/chargepagepaginatedresponse.go new file mode 100644 index 0000000000..484b3d2d01 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/chargepagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type ChargePagePaginatedResponse struct { + Data []BillingCharge `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (c ChargePagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *ChargePagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *ChargePagePaginatedResponse) GetData() []BillingCharge { + if c == nil { + return nil + } + return c.Data +} + +func (c *ChargePagePaginatedResponse) GetMeta() PaginatedMeta { + if c == nil { + return PaginatedMeta{} + } + return c.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/costbasispagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/costbasispagepaginatedresponse.go new file mode 100644 index 0000000000..5971132eda --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/costbasispagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type CostBasisPagePaginatedResponse struct { + Data []BillingCostBasis `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (c CostBasisPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CostBasisPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CostBasisPagePaginatedResponse) GetData() []BillingCostBasis { + if c == nil { + return nil + } + return c.Data +} + +func (c *CostBasisPagePaginatedResponse) GetMeta() PaginatedMeta { + if c == nil { + return PaginatedMeta{} + } + return c.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/createaddonrequest.go b/api/spec/packages/aip-client-go/models/components/createaddonrequest.go new file mode 100644 index 0000000000..d2bd61e138 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createaddonrequest.go @@ -0,0 +1,88 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon create request. +type CreateAddonRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // A key is a semi-unique string that is used to identify the add-on. It is used to + // reference the latest `active` version of the add-on and is unique with the + // version number. + Key string `json:"key"` + // The InstanceType of the add-ons. Can be "single" or "multiple". + InstanceType AddonInstanceType `json:"instance_type"` + // The currency code of the add-on. + Currency BillingCurrencyCode `json:"currency"` + // The rate cards of the add-on. + RateCards []BillingRateCard `json:"rate_cards,omitzero"` +} + +func (c CreateAddonRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateAddonRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateAddonRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateAddonRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateAddonRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreateAddonRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +func (c *CreateAddonRequest) GetInstanceType() AddonInstanceType { + if c == nil { + return AddonInstanceType("") + } + return c.InstanceType +} + +func (c *CreateAddonRequest) GetCurrency() BillingCurrencyCode { + if c == nil { + return BillingCurrencyCode{} + } + return c.Currency +} + +func (c *CreateAddonRequest) GetRateCards() []BillingRateCard { + if c == nil { + return nil + } + return c.RateCards +} diff --git a/api/spec/packages/aip-client-go/models/components/createaddonresponse.go b/api/spec/packages/aip-client-go/models/components/createaddonresponse.go new file mode 100644 index 0000000000..75c0e9230a --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon created response. +type CreateAddonResponse struct { +} + +func (c CreateAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createbillingprofilerequest.go b/api/spec/packages/aip-client-go/models/components/createbillingprofilerequest.go new file mode 100644 index 0000000000..fac3f28008 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createbillingprofilerequest.go @@ -0,0 +1,87 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// BillingProfile create request. +type CreateBillingProfileRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // The name and contact information for the supplier this billing profile + // represents + Supplier BillingParty `json:"supplier"` + // The billing workflow settings for this profile + Workflow BillingWorkflow `json:"workflow"` + // The applications used by this billing profile. + Apps BillingProfileAppReferences `json:"apps"` + // Whether this is the default profile. + Default bool `json:"default"` +} + +func (c CreateBillingProfileRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateBillingProfileRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateBillingProfileRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateBillingProfileRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateBillingProfileRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreateBillingProfileRequest) GetSupplier() BillingParty { + if c == nil { + return BillingParty{} + } + return c.Supplier +} + +func (c *CreateBillingProfileRequest) GetWorkflow() BillingWorkflow { + if c == nil { + return BillingWorkflow{} + } + return c.Workflow +} + +func (c *CreateBillingProfileRequest) GetApps() BillingProfileAppReferences { + if c == nil { + return BillingProfileAppReferences{} + } + return c.Apps +} + +func (c *CreateBillingProfileRequest) GetDefault() bool { + if c == nil { + return false + } + return c.Default +} diff --git a/api/spec/packages/aip-client-go/models/components/createbillingprofileresponse.go b/api/spec/packages/aip-client-go/models/components/createbillingprofileresponse.go new file mode 100644 index 0000000000..174c2336e4 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createbillingprofileresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// BillingProfile created response. +type CreateBillingProfileResponse struct { +} + +func (c CreateBillingProfileResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateBillingProfileResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcostbasisrequest.go b/api/spec/packages/aip-client-go/models/components/createcostbasisrequest.go new file mode 100644 index 0000000000..0217790233 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcostbasisrequest.go @@ -0,0 +1,53 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import ( + "time" + + "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" +) + +// CostBasis create request. +type CreateCostBasisRequest struct { + // The fiat currency code for the cost basis. + FiatCode string `json:"fiat_code"` + // The cost rate for the currency. + Rate string `json:"rate"` + // An ISO-8601 timestamp representation of the date from which the cost basis is + // effective. If not provided, it will be effective immediately and will be set to + // `now` by the system. + EffectiveFrom *time.Time `json:"effective_from,omitzero"` +} + +func (c CreateCostBasisRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCostBasisRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateCostBasisRequest) GetFiatCode() string { + if c == nil { + return "" + } + return c.FiatCode +} + +func (c *CreateCostBasisRequest) GetRate() string { + if c == nil { + return "" + } + return c.Rate +} + +func (c *CreateCostBasisRequest) GetEffectiveFrom() *time.Time { + if c == nil { + return nil + } + return c.EffectiveFrom +} diff --git a/api/spec/packages/aip-client-go/models/components/createcostbasisresponse.go b/api/spec/packages/aip-client-go/models/components/createcostbasisresponse.go new file mode 100644 index 0000000000..bc4325f5bb --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcostbasisresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CostBasis created response. +type CreateCostBasisResponse struct { +} + +func (c CreateCostBasisResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCostBasisResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcreatestripecheckoutsessionresultresponse.go b/api/spec/packages/aip-client-go/models/components/createcreatestripecheckoutsessionresultresponse.go new file mode 100644 index 0000000000..bf407a8acf --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcreatestripecheckoutsessionresultresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreateStripeCheckoutSessionResult created response. +type CreateCreateStripeCheckoutSessionResultResponse struct { +} + +func (c CreateCreateStripeCheckoutSessionResultResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCreateStripeCheckoutSessionResultResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcreatestripecustomerportalsessionresultresponse.go b/api/spec/packages/aip-client-go/models/components/createcreatestripecustomerportalsessionresultresponse.go new file mode 100644 index 0000000000..1328ada4ba --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcreatestripecustomerportalsessionresultresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreateStripeCustomerPortalSessionResult created response. +type CreateCreateStripeCustomerPortalSessionResultResponse struct { +} + +func (c CreateCreateStripeCustomerPortalSessionResultResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCreateStripeCustomerPortalSessionResultResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcreditadjustmentrequest.go b/api/spec/packages/aip-client-go/models/components/createcreditadjustmentrequest.go new file mode 100644 index 0000000000..306442656f --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcreditadjustmentrequest.go @@ -0,0 +1,68 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreditAdjustment create request. +type CreateCreditAdjustmentRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // The currency of the granted credits. + Currency BillingCurrencyCode `json:"currency"` + // Granted credit amount. + Amount string `json:"amount"` +} + +func (c CreateCreditAdjustmentRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCreditAdjustmentRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateCreditAdjustmentRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateCreditAdjustmentRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateCreditAdjustmentRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreateCreditAdjustmentRequest) GetCurrency() BillingCurrencyCode { + if c == nil { + return BillingCurrencyCode{} + } + return c.Currency +} + +func (c *CreateCreditAdjustmentRequest) GetAmount() string { + if c == nil { + return "" + } + return c.Amount +} diff --git a/api/spec/packages/aip-client-go/models/components/createcreditadjustmentresponse.go b/api/spec/packages/aip-client-go/models/components/createcreditadjustmentresponse.go new file mode 100644 index 0000000000..cc4c8268e0 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcreditadjustmentresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreditAdjustment created response. +type CreateCreditAdjustmentResponse struct { +} + +func (c CreateCreditAdjustmentResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCreditAdjustmentResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcreditgrantresponse.go b/api/spec/packages/aip-client-go/models/components/createcreditgrantresponse.go new file mode 100644 index 0000000000..b1e7bcb7e9 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcreditgrantresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreditGrant created response. +type CreateCreditGrantResponse struct { +} + +func (c CreateCreditGrantResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCreditGrantResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcurrencycustomrequest.go b/api/spec/packages/aip-client-go/models/components/createcurrencycustomrequest.go new file mode 100644 index 0000000000..f5bf60161e --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcurrencycustomrequest.go @@ -0,0 +1,57 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CurrencyCustom create request. +type CreateCurrencyCustomRequest struct { + // The name of the currency. It should be a human-readable string that represents + // the name of the currency, such as "US Dollar" or "Euro". + Name string `json:"name"` + // Description of the currency. + Description *string `json:"description,omitzero"` + // The symbol of the currency. It should be a string that represents the symbol of + // the currency, such as "$" for US Dollar or "€" for Euro. + Symbol *string `json:"symbol,omitzero"` + Code string `json:"code"` +} + +func (c CreateCurrencyCustomRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCurrencyCustomRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateCurrencyCustomRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateCurrencyCustomRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateCurrencyCustomRequest) GetSymbol() *string { + if c == nil { + return nil + } + return c.Symbol +} + +func (c *CreateCurrencyCustomRequest) GetCode() string { + if c == nil { + return "" + } + return c.Code +} diff --git a/api/spec/packages/aip-client-go/models/components/createcurrencycustomresponse.go b/api/spec/packages/aip-client-go/models/components/createcurrencycustomresponse.go new file mode 100644 index 0000000000..b6bc814b72 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcurrencycustomresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CurrencyCustom created response. +type CreateCurrencyCustomResponse struct { +} + +func (c CreateCurrencyCustomResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCurrencyCustomResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createcustomerrequest.go b/api/spec/packages/aip-client-go/models/components/createcustomerrequest.go new file mode 100644 index 0000000000..cdb012bd70 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcustomerrequest.go @@ -0,0 +1,94 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Customer create request. +type CreateCustomerRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + Key string `json:"key"` + // Mapping to attribute metered usage to the customer by the event subject. + UsageAttribution *BillingCustomerUsageAttribution `json:"usage_attribution,omitzero"` + // The primary email address of the customer. + PrimaryEmail *string `json:"primary_email,omitzero"` + // Currency of the customer. Used for billing, tax and invoicing. + Currency *string `json:"currency,omitzero"` + // The billing address of the customer. Used for tax and invoicing. + BillingAddress *BillingAddress `json:"billing_address,omitzero"` +} + +func (c CreateCustomerRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCustomerRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateCustomerRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateCustomerRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateCustomerRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreateCustomerRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +func (c *CreateCustomerRequest) GetUsageAttribution() *BillingCustomerUsageAttribution { + if c == nil { + return nil + } + return c.UsageAttribution +} + +func (c *CreateCustomerRequest) GetPrimaryEmail() *string { + if c == nil { + return nil + } + return c.PrimaryEmail +} + +func (c *CreateCustomerRequest) GetCurrency() *string { + if c == nil { + return nil + } + return c.Currency +} + +func (c *CreateCustomerRequest) GetBillingAddress() *BillingAddress { + if c == nil { + return nil + } + return c.BillingAddress +} diff --git a/api/spec/packages/aip-client-go/models/components/createcustomerresponse.go b/api/spec/packages/aip-client-go/models/components/createcustomerresponse.go new file mode 100644 index 0000000000..94846c5716 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createcustomerresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Customer created response. +type CreateCustomerResponse struct { +} + +func (c CreateCustomerResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateCustomerResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createfeaturerequest.go b/api/spec/packages/aip-client-go/models/components/createfeaturerequest.go new file mode 100644 index 0000000000..b1b92320fd --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createfeaturerequest.go @@ -0,0 +1,79 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Feature create request. +type CreateFeatureRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + Key string `json:"key"` + // The meter that the feature is associated with and based on which usage is + // calculated. If not specified, the feature is static. + Meter *FeatureMeterReference `json:"meter,omitzero"` + // Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or + // "llm" to look up cost from the LLM cost database based on meter group-by + // properties. + UnitCost *BillingFeatureUnitCost `json:"unit_cost,omitzero"` +} + +func (c CreateFeatureRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateFeatureRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateFeatureRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateFeatureRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateFeatureRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreateFeatureRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +func (c *CreateFeatureRequest) GetMeter() *FeatureMeterReference { + if c == nil { + return nil + } + return c.Meter +} + +func (c *CreateFeatureRequest) GetUnitCost() *BillingFeatureUnitCost { + if c == nil { + return nil + } + return c.UnitCost +} diff --git a/api/spec/packages/aip-client-go/models/components/createfeatureresponse.go b/api/spec/packages/aip-client-go/models/components/createfeatureresponse.go new file mode 100644 index 0000000000..74ffdb4bfb --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createfeatureresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Feature created response. +type CreateFeatureResponse struct { +} + +func (c CreateFeatureResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateFeatureResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createplanaddonrequest.go b/api/spec/packages/aip-client-go/models/components/createplanaddonrequest.go new file mode 100644 index 0000000000..5af433f4fc --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createplanaddonrequest.go @@ -0,0 +1,79 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// PlanAddon create request. +type CreatePlanAddonRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // The add-on associated with the plan. + Addon AddonReference `json:"addon"` + // The key of the plan phase from which the add-on becomes available for purchase. + FromPlanPhase string `json:"from_plan_phase"` + // The maximum number of times the add-on can be purchased for the plan. For + // single-instance add-ons this field must be omitted. For multi-instance add-ons + // when omitted, unlimited quantity can be purchased. + MaxQuantity *int64 `json:"max_quantity,omitzero"` +} + +func (c CreatePlanAddonRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreatePlanAddonRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreatePlanAddonRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreatePlanAddonRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreatePlanAddonRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreatePlanAddonRequest) GetAddon() AddonReference { + if c == nil { + return AddonReference{} + } + return c.Addon +} + +func (c *CreatePlanAddonRequest) GetFromPlanPhase() string { + if c == nil { + return "" + } + return c.FromPlanPhase +} + +func (c *CreatePlanAddonRequest) GetMaxQuantity() *int64 { + if c == nil { + return nil + } + return c.MaxQuantity +} diff --git a/api/spec/packages/aip-client-go/models/components/createplanaddonresponse.go b/api/spec/packages/aip-client-go/models/components/createplanaddonresponse.go new file mode 100644 index 0000000000..e2b1203ed8 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createplanaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// PlanAddon created response. +type CreatePlanAddonResponse struct { +} + +func (c CreatePlanAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreatePlanAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createplanrequest.go b/api/spec/packages/aip-client-go/models/components/createplanrequest.go new file mode 100644 index 0000000000..2788cf562d --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createplanrequest.go @@ -0,0 +1,98 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Plan create request. +type CreatePlanRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // A key is a semi-unique string that is used to identify the plan. It is used to + // reference the latest `active` version of the plan and is unique with the version + // number. + Key string `json:"key"` + // The currency code of the plan. + Currency string `json:"currency"` + // The billing cadence for subscriptions using this plan. + BillingCadence string `json:"billing_cadence"` + // Whether pro-rating is enabled for this plan. + ProRatingEnabled *bool `json:"pro_rating_enabled,omitzero"` + // The plan phases define the pricing ramp for a subscription. A phase switch + // occurs only at the end of a billing period. At least one phase is required. + Phases []BillingPlanPhase `json:"phases,omitzero"` +} + +func (c CreatePlanRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreatePlanRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreatePlanRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreatePlanRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreatePlanRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreatePlanRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +func (c *CreatePlanRequest) GetCurrency() string { + if c == nil { + return "" + } + return c.Currency +} + +func (c *CreatePlanRequest) GetBillingCadence() string { + if c == nil { + return "" + } + return c.BillingCadence +} + +func (c *CreatePlanRequest) GetProRatingEnabled() *bool { + if c == nil { + return nil + } + return c.ProRatingEnabled +} + +func (c *CreatePlanRequest) GetPhases() []BillingPlanPhase { + if c == nil { + return nil + } + return c.Phases +} diff --git a/api/spec/packages/aip-client-go/models/components/createplanresponse.go b/api/spec/packages/aip-client-go/models/components/createplanresponse.go new file mode 100644 index 0000000000..e5bdf4237f --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createplanresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Plan created response. +type CreatePlanResponse struct { +} + +func (c CreatePlanResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreatePlanResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createpriceresponse.go b/api/spec/packages/aip-client-go/models/components/createpriceresponse.go new file mode 100644 index 0000000000..6d4bc9f795 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createpriceresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Price created response. +type CreatePriceResponse struct { +} + +func (c CreatePriceResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreatePriceResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createsubscriptionresponse.go b/api/spec/packages/aip-client-go/models/components/createsubscriptionresponse.go new file mode 100644 index 0000000000..39f496ec1b --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createsubscriptionresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Subscription created response. +type CreateSubscriptionResponse struct { +} + +func (c CreateSubscriptionResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateSubscriptionResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/createtaxcoderequest.go b/api/spec/packages/aip-client-go/models/components/createtaxcoderequest.go new file mode 100644 index 0000000000..c1e1713898 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createtaxcoderequest.go @@ -0,0 +1,67 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// TaxCode create request. +type CreateTaxCodeRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + Key string `json:"key"` + // Mapping of app types to tax codes. + AppMappings []BillingTaxCodeAppMapping `json:"app_mappings,omitzero"` +} + +func (c CreateTaxCodeRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateTaxCodeRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreateTaxCodeRequest) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateTaxCodeRequest) GetDescription() *string { + if c == nil { + return nil + } + return c.Description +} + +func (c *CreateTaxCodeRequest) GetLabels() *Labels { + if c == nil { + return nil + } + return c.Labels +} + +func (c *CreateTaxCodeRequest) GetKey() string { + if c == nil { + return "" + } + return c.Key +} + +func (c *CreateTaxCodeRequest) GetAppMappings() []BillingTaxCodeAppMapping { + if c == nil { + return nil + } + return c.AppMappings +} diff --git a/api/spec/packages/aip-client-go/models/components/createtaxcoderesponse.go b/api/spec/packages/aip-client-go/models/components/createtaxcoderesponse.go new file mode 100644 index 0000000000..00ed5466f6 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/createtaxcoderesponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// TaxCode created response. +type CreateTaxCodeResponse struct { +} + +func (c CreateTaxCodeResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreateTaxCodeResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/creditgrantpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/creditgrantpagepaginatedresponse.go new file mode 100644 index 0000000000..4d9ed6a378 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/creditgrantpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type CreditGrantPagePaginatedResponse struct { + Data []BillingCreditGrant `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (c CreditGrantPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreditGrantPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreditGrantPagePaginatedResponse) GetData() []BillingCreditGrant { + if c == nil { + return nil + } + return c.Data +} + +func (c *CreditGrantPagePaginatedResponse) GetMeta() PaginatedMeta { + if c == nil { + return PaginatedMeta{} + } + return c.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/credittransactionpaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/credittransactionpaginatedresponse.go new file mode 100644 index 0000000000..415cf74116 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/credittransactionpaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Cursor paginated response. +type CreditTransactionPaginatedResponse struct { + Data []BillingCreditTransaction `json:"data,omitzero"` + Meta CursorMeta `json:"meta"` +} + +func (c CreditTransactionPaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CreditTransactionPaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CreditTransactionPaginatedResponse) GetData() []BillingCreditTransaction { + if c == nil { + return nil + } + return c.Data +} + +func (c *CreditTransactionPaginatedResponse) GetMeta() CursorMeta { + if c == nil { + return CursorMeta{} + } + return c.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/currencycode.go b/api/spec/packages/aip-client-go/models/components/currencycode.go new file mode 100644 index 0000000000..2c5555ef5d --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/currencycode.go @@ -0,0 +1,8 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +// Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) +// currency code. Custom three-letter currency codes are also supported for +// convenience. +type CurrencyCode = string diff --git a/api/spec/packages/aip-client-go/models/components/currencypagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/currencypagepaginatedresponse.go new file mode 100644 index 0000000000..6a6beb3c36 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/currencypagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type CurrencyPagePaginatedResponse struct { + Data []BillingCurrency `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (c CurrencyPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CurrencyPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CurrencyPagePaginatedResponse) GetData() []BillingCurrency { + if c == nil { + return nil + } + return c.Data +} + +func (c *CurrencyPagePaginatedResponse) GetMeta() PaginatedMeta { + if c == nil { + return PaginatedMeta{} + } + return c.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/customerpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/customerpagepaginatedresponse.go new file mode 100644 index 0000000000..e0632ee7d2 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/customerpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type CustomerPagePaginatedResponse struct { + Data []BillingCustomer `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (c CustomerPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(c, "", false) +} + +func (c *CustomerPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &c, "", false, nil); err != nil { + return err + } + return nil +} + +func (c *CustomerPagePaginatedResponse) GetData() []BillingCustomer { + if c == nil { + return nil + } + return c.Data +} + +func (c *CustomerPagePaginatedResponse) GetMeta() PaginatedMeta { + if c == nil { + return PaginatedMeta{} + } + return c.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/featurepagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/featurepagepaginatedresponse.go new file mode 100644 index 0000000000..f51195d9c4 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/featurepagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type FeaturePagePaginatedResponse struct { + Data []Feature `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (f FeaturePagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(f, "", false) +} + +func (f *FeaturePagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &f, "", false, nil); err != nil { + return err + } + return nil +} + +func (f *FeaturePagePaginatedResponse) GetData() []Feature { + if f == nil { + return nil + } + return f.Data +} + +func (f *FeaturePagePaginatedResponse) GetMeta() PaginatedMeta { + if f == nil { + return PaginatedMeta{} + } + return f.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/featurereference.go b/api/spec/packages/aip-client-go/models/components/featurereference.go new file mode 100644 index 0000000000..df3d9fd8b3 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/featurereference.go @@ -0,0 +1,28 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Feature reference. +type FeatureReference struct { + Id string `json:"id"` +} + +func (f FeatureReference) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(f, "", false) +} + +func (f *FeatureReference) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &f, "", false, nil); err != nil { + return err + } + return nil +} + +func (f *FeatureReference) GetId() string { + if f == nil { + return "" + } + return f.Id +} diff --git a/api/spec/packages/aip-client-go/models/components/getaddonresponse.go b/api/spec/packages/aip-client-go/models/components/getaddonresponse.go new file mode 100644 index 0000000000..05f353301a --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon response. +type GetAddonResponse struct { +} + +func (g GetAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getappresponse.go b/api/spec/packages/aip-client-go/models/components/getappresponse.go new file mode 100644 index 0000000000..884a55b560 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getappresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// App response. +type GetAppResponse struct { +} + +func (g GetAppResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetAppResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getbillingprofileresponse.go b/api/spec/packages/aip-client-go/models/components/getbillingprofileresponse.go new file mode 100644 index 0000000000..a96738751b --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getbillingprofileresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// BillingProfile response. +type GetBillingProfileResponse struct { +} + +func (g GetBillingProfileResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetBillingProfileResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getcreditbalancesresponse.go b/api/spec/packages/aip-client-go/models/components/getcreditbalancesresponse.go new file mode 100644 index 0000000000..0956e566bb --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getcreditbalancesresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreditBalances response. +type GetCreditBalancesResponse struct { +} + +func (g GetCreditBalancesResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetCreditBalancesResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getcreditgrantresponse.go b/api/spec/packages/aip-client-go/models/components/getcreditgrantresponse.go new file mode 100644 index 0000000000..9f2907d809 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getcreditgrantresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreditGrant response. +type GetCreditGrantResponse struct { +} + +func (g GetCreditGrantResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetCreditGrantResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getcustomerbillingdataresponse.go b/api/spec/packages/aip-client-go/models/components/getcustomerbillingdataresponse.go new file mode 100644 index 0000000000..5f91a94c96 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getcustomerbillingdataresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CustomerBillingData response. +type GetCustomerBillingDataResponse struct { +} + +func (g GetCustomerBillingDataResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetCustomerBillingDataResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getcustomerresponse.go b/api/spec/packages/aip-client-go/models/components/getcustomerresponse.go new file mode 100644 index 0000000000..48b104bcac --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getcustomerresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Customer response. +type GetCustomerResponse struct { +} + +func (g GetCustomerResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetCustomerResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getfeatureresponse.go b/api/spec/packages/aip-client-go/models/components/getfeatureresponse.go new file mode 100644 index 0000000000..f1babd9ac8 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getfeatureresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Feature response. +type GetFeatureResponse struct { +} + +func (g GetFeatureResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetFeatureResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getorganizationdefaulttaxcodesresponse.go b/api/spec/packages/aip-client-go/models/components/getorganizationdefaulttaxcodesresponse.go new file mode 100644 index 0000000000..879bacf683 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getorganizationdefaulttaxcodesresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// OrganizationDefaultTaxCodes response. +type GetOrganizationDefaultTaxCodesResponse struct { +} + +func (g GetOrganizationDefaultTaxCodesResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetOrganizationDefaultTaxCodesResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getplanaddonresponse.go b/api/spec/packages/aip-client-go/models/components/getplanaddonresponse.go new file mode 100644 index 0000000000..bfb4501a60 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getplanaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// PlanAddon response. +type GetPlanAddonResponse struct { +} + +func (g GetPlanAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetPlanAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getplanresponse.go b/api/spec/packages/aip-client-go/models/components/getplanresponse.go new file mode 100644 index 0000000000..137d7742cc --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getplanresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Plan response. +type GetPlanResponse struct { +} + +func (g GetPlanResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetPlanResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/getsubscriptionresponse.go b/api/spec/packages/aip-client-go/models/components/getsubscriptionresponse.go new file mode 100644 index 0000000000..c9fa57fe14 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/getsubscriptionresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Subscription response. +type GetSubscriptionResponse struct { +} + +func (g GetSubscriptionResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetSubscriptionResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/gettaxcoderesponse.go b/api/spec/packages/aip-client-go/models/components/gettaxcoderesponse.go new file mode 100644 index 0000000000..45474b0a42 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/gettaxcoderesponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// TaxCode response. +type GetTaxCodeResponse struct { +} + +func (g GetTaxCodeResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetTaxCodeResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/llmcostprice.go b/api/spec/packages/aip-client-go/models/components/llmcostprice.go new file mode 100644 index 0000000000..42c6947623 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/llmcostprice.go @@ -0,0 +1,115 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import ( + "time" + + "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" +) + +// An LLM cost price record, representing the cost per token for a specific model +// from a specific provider. +type LlmCostPrice struct { + // Unique identifier. + Id string `json:"id"` + // Provider of the model. + Provider LlmCostProvider `json:"provider"` + // The model. + Model LlmCostModel `json:"model"` + // Token pricing data. + Pricing LlmCostModelPricing `json:"pricing"` + // Currency code (currently always "USD"). + Currency string `json:"currency"` + // Where this price came from. + Source LlmCostPriceSource `json:"source"` + // When this price becomes effective. + EffectiveFrom time.Time `json:"effective_from"` + // When this price expires. Omitted when the price is currently effective. + EffectiveTo *time.Time `json:"effective_to,omitzero"` + // Creation timestamp. + CreatedAt time.Time `json:"created_at"` + // Last update timestamp. + UpdatedAt time.Time `json:"updated_at"` +} + +func (l LlmCostPrice) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(l, "", false) +} + +func (l *LlmCostPrice) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &l, "", false, nil); err != nil { + return err + } + return nil +} + +func (l *LlmCostPrice) GetId() string { + if l == nil { + return "" + } + return l.Id +} + +func (l *LlmCostPrice) GetProvider() LlmCostProvider { + if l == nil { + return LlmCostProvider{} + } + return l.Provider +} + +func (l *LlmCostPrice) GetModel() LlmCostModel { + if l == nil { + return LlmCostModel{} + } + return l.Model +} + +func (l *LlmCostPrice) GetPricing() LlmCostModelPricing { + if l == nil { + return LlmCostModelPricing{} + } + return l.Pricing +} + +func (l *LlmCostPrice) GetCurrency() string { + if l == nil { + return "" + } + return l.Currency +} + +func (l *LlmCostPrice) GetSource() LlmCostPriceSource { + if l == nil { + return LlmCostPriceSource("") + } + return l.Source +} + +func (l *LlmCostPrice) GetEffectiveFrom() time.Time { + if l == nil { + return time.Time{} + } + return l.EffectiveFrom +} + +func (l *LlmCostPrice) GetEffectiveTo() *time.Time { + if l == nil { + return nil + } + return l.EffectiveTo +} + +func (l *LlmCostPrice) GetCreatedAt() time.Time { + if l == nil { + return time.Time{} + } + return l.CreatedAt +} + +func (l *LlmCostPrice) GetUpdatedAt() time.Time { + if l == nil { + return time.Time{} + } + return l.UpdatedAt +} diff --git a/api/spec/packages/aip-client-go/models/components/organizationdefaulttaxcodes.go b/api/spec/packages/aip-client-go/models/components/organizationdefaulttaxcodes.go index 764c75bce8..63b452699e 100644 --- a/api/spec/packages/aip-client-go/models/components/organizationdefaulttaxcodes.go +++ b/api/spec/packages/aip-client-go/models/components/organizationdefaulttaxcodes.go @@ -14,9 +14,9 @@ import ( // organization. Provisioned automatically when the organization is created. type OrganizationDefaultTaxCodes struct { // Default tax code for invoicing. - InvoicingTaxCode CustomerReference `json:"invoicing_tax_code"` + InvoicingTaxCode TaxCodeReference `json:"invoicing_tax_code"` // Default tax code for credit grants. - CreditGrantTaxCode CustomerReference `json:"credit_grant_tax_code"` + CreditGrantTaxCode TaxCodeReference `json:"credit_grant_tax_code"` // Timestamp of creation. CreatedAt time.Time `json:"created_at"` // Timestamp of last update. @@ -34,16 +34,16 @@ func (o *OrganizationDefaultTaxCodes) UnmarshalJSON(data []byte) error { return nil } -func (o *OrganizationDefaultTaxCodes) GetInvoicingTaxCode() CustomerReference { +func (o *OrganizationDefaultTaxCodes) GetInvoicingTaxCode() TaxCodeReference { if o == nil { - return CustomerReference{} + return TaxCodeReference{} } return o.InvoicingTaxCode } -func (o *OrganizationDefaultTaxCodes) GetCreditGrantTaxCode() CustomerReference { +func (o *OrganizationDefaultTaxCodes) GetCreditGrantTaxCode() TaxCodeReference { if o == nil { - return CustomerReference{} + return TaxCodeReference{} } return o.CreditGrantTaxCode } diff --git a/api/spec/packages/aip-client-go/models/components/planaddon.go b/api/spec/packages/aip-client-go/models/components/planaddon.go index c365148aea..b53fab54f9 100644 --- a/api/spec/packages/aip-client-go/models/components/planaddon.go +++ b/api/spec/packages/aip-client-go/models/components/planaddon.go @@ -28,7 +28,7 @@ type PlanAddon struct { // An ISO-8601 timestamp representation of entity deletion date. DeletedAt *time.Time `json:"deleted_at,omitzero"` // The add-on associated with the plan. - Addon CustomerReference `json:"addon"` + Addon AddonReference `json:"addon"` // The key of the plan phase from which the add-on becomes available for purchase. FromPlanPhase string `json:"from_plan_phase"` // The maximum number of times the add-on can be purchased for the plan. For @@ -99,9 +99,9 @@ func (p *PlanAddon) GetDeletedAt() *time.Time { return p.DeletedAt } -func (p *PlanAddon) GetAddon() CustomerReference { +func (p *PlanAddon) GetAddon() AddonReference { if p == nil { - return CustomerReference{} + return AddonReference{} } return p.Addon } diff --git a/api/spec/packages/aip-client-go/models/components/planaddonpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/planaddonpagepaginatedresponse.go new file mode 100644 index 0000000000..1afaa0d8ab --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/planaddonpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type PlanAddonPagePaginatedResponse struct { + Data []PlanAddon `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (p PlanAddonPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlanAddonPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { + return err + } + return nil +} + +func (p *PlanAddonPagePaginatedResponse) GetData() []PlanAddon { + if p == nil { + return nil + } + return p.Data +} + +func (p *PlanAddonPagePaginatedResponse) GetMeta() PaginatedMeta { + if p == nil { + return PaginatedMeta{} + } + return p.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/planpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/planpagepaginatedresponse.go new file mode 100644 index 0000000000..ddb37f8bab --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/planpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type PlanPagePaginatedResponse struct { + Data []BillingPlan `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (p PlanPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlanPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { + return err + } + return nil +} + +func (p *PlanPagePaginatedResponse) GetData() []BillingPlan { + if p == nil { + return nil + } + return p.Data +} + +func (p *PlanPagePaginatedResponse) GetMeta() PaginatedMeta { + if p == nil { + return PaginatedMeta{} + } + return p.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/pricepagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/pricepagepaginatedresponse.go new file mode 100644 index 0000000000..e87a37e3bc --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/pricepagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type PricePagePaginatedResponse struct { + Data []LlmCostPrice `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (p PricePagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PricePagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, nil); err != nil { + return err + } + return nil +} + +func (p *PricePagePaginatedResponse) GetData() []LlmCostPrice { + if p == nil { + return nil + } + return p.Data +} + +func (p *PricePagePaginatedResponse) GetMeta() PaginatedMeta { + if p == nil { + return PaginatedMeta{} + } + return p.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/subscriptionaddon.go b/api/spec/packages/aip-client-go/models/components/subscriptionaddon.go index 1a2a9388fd..ceaea38f54 100644 --- a/api/spec/packages/aip-client-go/models/components/subscriptionaddon.go +++ b/api/spec/packages/aip-client-go/models/components/subscriptionaddon.go @@ -27,7 +27,7 @@ type SubscriptionAddon struct { // An ISO-8601 timestamp representation of entity deletion date. DeletedAt *time.Time `json:"deleted_at,omitzero"` // The add-on associated with the subscription. - Addon CustomerReference `json:"addon"` + Addon AddonReference `json:"addon"` // The quantity of the add-on. Always 1 for single instance add-ons. Quantity int64 `json:"quantity"` // An ISO-8601 timestamp representation of which point in time the quantity was @@ -99,9 +99,9 @@ func (s *SubscriptionAddon) GetDeletedAt() *time.Time { return s.DeletedAt } -func (s *SubscriptionAddon) GetAddon() CustomerReference { +func (s *SubscriptionAddon) GetAddon() AddonReference { if s == nil { - return CustomerReference{} + return AddonReference{} } return s.Addon } diff --git a/api/spec/packages/aip-client-go/models/components/subscriptionaddonpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/subscriptionaddonpagepaginatedresponse.go new file mode 100644 index 0000000000..c411b6dece --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/subscriptionaddonpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type SubscriptionAddonPagePaginatedResponse struct { + Data []SubscriptionAddon `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (s SubscriptionAddonPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SubscriptionAddonPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, nil); err != nil { + return err + } + return nil +} + +func (s *SubscriptionAddonPagePaginatedResponse) GetData() []SubscriptionAddon { + if s == nil { + return nil + } + return s.Data +} + +func (s *SubscriptionAddonPagePaginatedResponse) GetMeta() PaginatedMeta { + if s == nil { + return PaginatedMeta{} + } + return s.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/subscriptionpagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/subscriptionpagepaginatedresponse.go new file mode 100644 index 0000000000..b032e99d4a --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/subscriptionpagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type SubscriptionPagePaginatedResponse struct { + Data []BillingSubscription `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (s SubscriptionPagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *SubscriptionPagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, nil); err != nil { + return err + } + return nil +} + +func (s *SubscriptionPagePaginatedResponse) GetData() []BillingSubscription { + if s == nil { + return nil + } + return s.Data +} + +func (s *SubscriptionPagePaginatedResponse) GetMeta() PaginatedMeta { + if s == nil { + return PaginatedMeta{} + } + return s.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/taxcodepagepaginatedresponse.go b/api/spec/packages/aip-client-go/models/components/taxcodepagepaginatedresponse.go new file mode 100644 index 0000000000..374ee5ae35 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/taxcodepagepaginatedresponse.go @@ -0,0 +1,36 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Page paginated response. +type TaxCodePagePaginatedResponse struct { + Data []BillingTaxCode `json:"data,omitzero"` + Meta PaginatedMeta `json:"meta"` +} + +func (t TaxCodePagePaginatedResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *TaxCodePagePaginatedResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, nil); err != nil { + return err + } + return nil +} + +func (t *TaxCodePagePaginatedResponse) GetData() []BillingTaxCode { + if t == nil { + return nil + } + return t.Data +} + +func (t *TaxCodePagePaginatedResponse) GetMeta() PaginatedMeta { + if t == nil { + return PaginatedMeta{} + } + return t.Meta +} diff --git a/api/spec/packages/aip-client-go/models/components/taxcodereference.go b/api/spec/packages/aip-client-go/models/components/taxcodereference.go new file mode 100644 index 0000000000..fed9fc0a3e --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/taxcodereference.go @@ -0,0 +1,28 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// TaxCode reference. +type TaxCodeReference struct { + Id string `json:"id"` +} + +func (t TaxCodeReference) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(t, "", false) +} + +func (t *TaxCodeReference) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &t, "", false, nil); err != nil { + return err + } + return nil +} + +func (t *TaxCodeReference) GetId() string { + if t == nil { + return "" + } + return t.Id +} diff --git a/api/spec/packages/aip-client-go/models/components/updateaddonresponse.go b/api/spec/packages/aip-client-go/models/components/updateaddonresponse.go new file mode 100644 index 0000000000..94fcf3551c --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updateaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon updated response. +type UpdateAddonResponse struct { +} + +func (u UpdateAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/updatebillingprofileresponse.go b/api/spec/packages/aip-client-go/models/components/updatebillingprofileresponse.go new file mode 100644 index 0000000000..b5de794467 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updatebillingprofileresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// BillingProfile updated response. +type UpdateBillingProfileResponse struct { +} + +func (u UpdateBillingProfileResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateBillingProfileResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/updatecreditgrantresponse.go b/api/spec/packages/aip-client-go/models/components/updatecreditgrantresponse.go new file mode 100644 index 0000000000..a0eda7fa3a --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updatecreditgrantresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CreditGrant updated response. +type UpdateCreditGrantResponse struct { +} + +func (u UpdateCreditGrantResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateCreditGrantResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/updatefeatureresponse.go b/api/spec/packages/aip-client-go/models/components/updatefeatureresponse.go new file mode 100644 index 0000000000..81161977b8 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updatefeatureresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Feature updated response. +type UpdateFeatureResponse struct { +} + +func (u UpdateFeatureResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateFeatureResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/updateorganizationdefaulttaxcodesrequest.go b/api/spec/packages/aip-client-go/models/components/updateorganizationdefaulttaxcodesrequest.go new file mode 100644 index 0000000000..7c2f2bf280 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updateorganizationdefaulttaxcodesrequest.go @@ -0,0 +1,38 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// OrganizationDefaultTaxCodes update request. +type UpdateOrganizationDefaultTaxCodesRequest struct { + // Default tax code for invoicing. + InvoicingTaxCode *TaxCodeReference `json:"invoicing_tax_code,omitzero"` + // Default tax code for credit grants. + CreditGrantTaxCode *TaxCodeReference `json:"credit_grant_tax_code,omitzero"` +} + +func (u UpdateOrganizationDefaultTaxCodesRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateOrganizationDefaultTaxCodesRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpdateOrganizationDefaultTaxCodesRequest) GetInvoicingTaxCode() *TaxCodeReference { + if u == nil { + return nil + } + return u.InvoicingTaxCode +} + +func (u *UpdateOrganizationDefaultTaxCodesRequest) GetCreditGrantTaxCode() *TaxCodeReference { + if u == nil { + return nil + } + return u.CreditGrantTaxCode +} diff --git a/api/spec/packages/aip-client-go/models/components/updateplanresponse.go b/api/spec/packages/aip-client-go/models/components/updateplanresponse.go new file mode 100644 index 0000000000..68acd32349 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updateplanresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Plan updated response. +type UpdatePlanResponse struct { +} + +func (u UpdatePlanResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdatePlanResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/updatesubscriptionresponse.go b/api/spec/packages/aip-client-go/models/components/updatesubscriptionresponse.go new file mode 100644 index 0000000000..ddfaef8f14 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/updatesubscriptionresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Subscription updated response. +type UpdateSubscriptionResponse struct { +} + +func (u UpdateSubscriptionResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpdateSubscriptionResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertaddonrequest.go b/api/spec/packages/aip-client-go/models/components/upsertaddonrequest.go new file mode 100644 index 0000000000..2c5c0abe71 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertaddonrequest.go @@ -0,0 +1,68 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon upsert request. +type UpsertAddonRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // The InstanceType of the add-ons. Can be "single" or "multiple". + InstanceType AddonInstanceType `json:"instance_type"` + // The rate cards of the add-on. + RateCards []BillingRateCard `json:"rate_cards,omitzero"` +} + +func (u UpsertAddonRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertAddonRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertAddonRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +func (u *UpsertAddonRequest) GetDescription() *string { + if u == nil { + return nil + } + return u.Description +} + +func (u *UpsertAddonRequest) GetLabels() *Labels { + if u == nil { + return nil + } + return u.Labels +} + +func (u *UpsertAddonRequest) GetInstanceType() AddonInstanceType { + if u == nil { + return AddonInstanceType("") + } + return u.InstanceType +} + +func (u *UpsertAddonRequest) GetRateCards() []BillingRateCard { + if u == nil { + return nil + } + return u.RateCards +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertaddonresponse.go b/api/spec/packages/aip-client-go/models/components/upsertaddonresponse.go new file mode 100644 index 0000000000..b541bf3a3c --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Addon upsert response. +type UpsertAddonResponse struct { +} + +func (u UpsertAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertappcustomerdatarequest.go b/api/spec/packages/aip-client-go/models/components/upsertappcustomerdatarequest.go new file mode 100644 index 0000000000..57a62bf6fb --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertappcustomerdatarequest.go @@ -0,0 +1,38 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// AppCustomerData upsert request. +type UpsertAppCustomerDataRequest struct { + // Used if the customer has a linked Stripe app. + Stripe *BillingAppCustomerDataStripe `json:"stripe,omitzero"` + // Used if the customer has a linked external invoicing app. + ExternalInvoicing *BillingAppCustomerDataExternalInvoicing `json:"external_invoicing,omitzero"` +} + +func (u UpsertAppCustomerDataRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertAppCustomerDataRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertAppCustomerDataRequest) GetStripe() *BillingAppCustomerDataStripe { + if u == nil { + return nil + } + return u.Stripe +} + +func (u *UpsertAppCustomerDataRequest) GetExternalInvoicing() *BillingAppCustomerDataExternalInvoicing { + if u == nil { + return nil + } + return u.ExternalInvoicing +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertappcustomerdataresponse.go b/api/spec/packages/aip-client-go/models/components/upsertappcustomerdataresponse.go new file mode 100644 index 0000000000..7bf9e4cdd3 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertappcustomerdataresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// AppCustomerData upsert response. +type UpsertAppCustomerDataResponse struct { +} + +func (u UpsertAppCustomerDataResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertAppCustomerDataResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertbillingprofilerequest.go b/api/spec/packages/aip-client-go/models/components/upsertbillingprofilerequest.go new file mode 100644 index 0000000000..0214ddc93e --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertbillingprofilerequest.go @@ -0,0 +1,78 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// BillingProfile upsert request. +type UpsertBillingProfileRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // The name and contact information for the supplier this billing profile + // represents + Supplier BillingParty `json:"supplier"` + // The billing workflow settings for this profile + Workflow BillingWorkflow `json:"workflow"` + // Whether this is the default profile. + Default bool `json:"default"` +} + +func (u UpsertBillingProfileRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertBillingProfileRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertBillingProfileRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +func (u *UpsertBillingProfileRequest) GetDescription() *string { + if u == nil { + return nil + } + return u.Description +} + +func (u *UpsertBillingProfileRequest) GetLabels() *Labels { + if u == nil { + return nil + } + return u.Labels +} + +func (u *UpsertBillingProfileRequest) GetSupplier() BillingParty { + if u == nil { + return BillingParty{} + } + return u.Supplier +} + +func (u *UpsertBillingProfileRequest) GetWorkflow() BillingWorkflow { + if u == nil { + return BillingWorkflow{} + } + return u.Workflow +} + +func (u *UpsertBillingProfileRequest) GetDefault() bool { + if u == nil { + return false + } + return u.Default +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdatarequest.go b/api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdatarequest.go new file mode 100644 index 0000000000..56a652923d --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdatarequest.go @@ -0,0 +1,40 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CustomerBillingData upsert request. +type UpsertCustomerBillingDataRequest struct { + // The billing profile for the customer. + // + // If not provided, the default billing profile will be used. + BillingProfile *BillingProfileReference `json:"billing_profile,omitzero"` + // App customer data. + AppData *BillingAppCustomerData `json:"app_data,omitzero"` +} + +func (u UpsertCustomerBillingDataRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertCustomerBillingDataRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertCustomerBillingDataRequest) GetBillingProfile() *BillingProfileReference { + if u == nil { + return nil + } + return u.BillingProfile +} + +func (u *UpsertCustomerBillingDataRequest) GetAppData() *BillingAppCustomerData { + if u == nil { + return nil + } + return u.AppData +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdataresponse.go b/api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdataresponse.go new file mode 100644 index 0000000000..5a3a694d97 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertcustomerbillingdataresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// CustomerBillingData upsert response. +type UpsertCustomerBillingDataResponse struct { +} + +func (u UpsertCustomerBillingDataResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertCustomerBillingDataResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertorganizationdefaulttaxcodesresponse.go b/api/spec/packages/aip-client-go/models/components/upsertorganizationdefaulttaxcodesresponse.go new file mode 100644 index 0000000000..058328ce53 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertorganizationdefaulttaxcodesresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// OrganizationDefaultTaxCodes upsert response. +type UpsertOrganizationDefaultTaxCodesResponse struct { +} + +func (u UpsertOrganizationDefaultTaxCodesResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertOrganizationDefaultTaxCodesResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertplanaddonrequest.go b/api/spec/packages/aip-client-go/models/components/upsertplanaddonrequest.go new file mode 100644 index 0000000000..b8edd07b27 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertplanaddonrequest.go @@ -0,0 +1,70 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// PlanAddon upsert request. +type UpsertPlanAddonRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // The key of the plan phase from which the add-on becomes available for purchase. + FromPlanPhase string `json:"from_plan_phase"` + // The maximum number of times the add-on can be purchased for the plan. For + // single-instance add-ons this field must be omitted. For multi-instance add-ons + // when omitted, unlimited quantity can be purchased. + MaxQuantity *int64 `json:"max_quantity,omitzero"` +} + +func (u UpsertPlanAddonRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertPlanAddonRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertPlanAddonRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +func (u *UpsertPlanAddonRequest) GetDescription() *string { + if u == nil { + return nil + } + return u.Description +} + +func (u *UpsertPlanAddonRequest) GetLabels() *Labels { + if u == nil { + return nil + } + return u.Labels +} + +func (u *UpsertPlanAddonRequest) GetFromPlanPhase() string { + if u == nil { + return "" + } + return u.FromPlanPhase +} + +func (u *UpsertPlanAddonRequest) GetMaxQuantity() *int64 { + if u == nil { + return nil + } + return u.MaxQuantity +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertplanaddonresponse.go b/api/spec/packages/aip-client-go/models/components/upsertplanaddonresponse.go new file mode 100644 index 0000000000..452b6121a2 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertplanaddonresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// PlanAddon upsert response. +type UpsertPlanAddonResponse struct { +} + +func (u UpsertPlanAddonResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertPlanAddonResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertplanrequest.go b/api/spec/packages/aip-client-go/models/components/upsertplanrequest.go new file mode 100644 index 0000000000..42d46d0cf6 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertplanrequest.go @@ -0,0 +1,69 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Plan upsert request. +type UpsertPlanRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // Whether pro-rating is enabled for this plan. + ProRatingEnabled *bool `json:"pro_rating_enabled,omitzero"` + // The plan phases define the pricing ramp for a subscription. A phase switch + // occurs only at the end of a billing period. At least one phase is required. + Phases []BillingPlanPhase `json:"phases,omitzero"` +} + +func (u UpsertPlanRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertPlanRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertPlanRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +func (u *UpsertPlanRequest) GetDescription() *string { + if u == nil { + return nil + } + return u.Description +} + +func (u *UpsertPlanRequest) GetLabels() *Labels { + if u == nil { + return nil + } + return u.Labels +} + +func (u *UpsertPlanRequest) GetProRatingEnabled() *bool { + if u == nil { + return nil + } + return u.ProRatingEnabled +} + +func (u *UpsertPlanRequest) GetPhases() []BillingPlanPhase { + if u == nil { + return nil + } + return u.Phases +} diff --git a/api/spec/packages/aip-client-go/models/components/upsertplanresponse.go b/api/spec/packages/aip-client-go/models/components/upsertplanresponse.go new file mode 100644 index 0000000000..2d0c85265d --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upsertplanresponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// Plan upsert response. +type UpsertPlanResponse struct { +} + +func (u UpsertPlanResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertPlanResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/components/upserttaxcoderequest.go b/api/spec/packages/aip-client-go/models/components/upserttaxcoderequest.go new file mode 100644 index 0000000000..4abc58156e --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upserttaxcoderequest.go @@ -0,0 +1,59 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// TaxCode upsert request. +type UpsertTaxCodeRequest struct { + // Display name of the resource. + // + // Between 1 and 256 characters. + Name string `json:"name"` + // Optional description of the resource. + // + // Maximum 1024 characters. + Description *string `json:"description,omitzero"` + Labels *Labels `json:"labels,omitzero"` + // Mapping of app types to tax codes. + AppMappings []BillingTaxCodeAppMapping `json:"app_mappings,omitzero"` +} + +func (u UpsertTaxCodeRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertTaxCodeRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} + +func (u *UpsertTaxCodeRequest) GetName() string { + if u == nil { + return "" + } + return u.Name +} + +func (u *UpsertTaxCodeRequest) GetDescription() *string { + if u == nil { + return nil + } + return u.Description +} + +func (u *UpsertTaxCodeRequest) GetLabels() *Labels { + if u == nil { + return nil + } + return u.Labels +} + +func (u *UpsertTaxCodeRequest) GetAppMappings() []BillingTaxCodeAppMapping { + if u == nil { + return nil + } + return u.AppMappings +} diff --git a/api/spec/packages/aip-client-go/models/components/upserttaxcoderesponse.go b/api/spec/packages/aip-client-go/models/components/upserttaxcoderesponse.go new file mode 100644 index 0000000000..79e64cae88 --- /dev/null +++ b/api/spec/packages/aip-client-go/models/components/upserttaxcoderesponse.go @@ -0,0 +1,20 @@ +// Code generated by @openmeter/typespec-go. DO NOT EDIT. + +package components + +import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/internal/utils" + +// TaxCode upsert response. +type UpsertTaxCodeResponse struct { +} + +func (u UpsertTaxCodeResponse) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UpsertTaxCodeResponse) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, nil); err != nil { + return err + } + return nil +} diff --git a/api/spec/packages/aip-client-go/models/operations/createaddon.go b/api/spec/packages/aip-client-go/models/operations/createaddon.go index be4e0b6573..f348fe5dde 100644 --- a/api/spec/packages/aip-client-go/models/operations/createaddon.go +++ b/api/spec/packages/aip-client-go/models/operations/createaddon.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateAddonRequest struct { - Addon components.CreateMeterRequest `request:"mediaType=application/json"` + Addon components.CreateAddonRequest `request:"mediaType=application/json"` } type CreateAddonResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createbillingprofile.go b/api/spec/packages/aip-client-go/models/operations/createbillingprofile.go index aa78f06d28..9afa69fc2f 100644 --- a/api/spec/packages/aip-client-go/models/operations/createbillingprofile.go +++ b/api/spec/packages/aip-client-go/models/operations/createbillingprofile.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateBillingProfileRequest struct { - Profile components.CreateMeterRequest `request:"mediaType=application/json"` + Profile components.CreateBillingProfileRequest `request:"mediaType=application/json"` } type CreateBillingProfileResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createcostbasis.go b/api/spec/packages/aip-client-go/models/operations/createcostbasis.go index 10177926d1..4ec1688a9b 100644 --- a/api/spec/packages/aip-client-go/models/operations/createcostbasis.go +++ b/api/spec/packages/aip-client-go/models/operations/createcostbasis.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateCostBasisRequest struct { - Body components.CreateMeterRequest `request:"mediaType=application/json"` + Body components.CreateCostBasisRequest `request:"mediaType=application/json"` } type CreateCostBasisResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createcreditadjustment.go b/api/spec/packages/aip-client-go/models/operations/createcreditadjustment.go index 2408c04d2a..727844f2a3 100644 --- a/api/spec/packages/aip-client-go/models/operations/createcreditadjustment.go +++ b/api/spec/packages/aip-client-go/models/operations/createcreditadjustment.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateCreditAdjustmentRequest struct { - CreditAdjustment components.CreateMeterRequest `request:"mediaType=application/json"` + CreditAdjustment components.CreateCreditAdjustmentRequest `request:"mediaType=application/json"` } type CreateCreditAdjustmentResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createcustomcurrency.go b/api/spec/packages/aip-client-go/models/operations/createcustomcurrency.go index 22af872158..21ab1d378c 100644 --- a/api/spec/packages/aip-client-go/models/operations/createcustomcurrency.go +++ b/api/spec/packages/aip-client-go/models/operations/createcustomcurrency.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateCustomCurrencyRequest struct { - Body components.CreateMeterRequest `request:"mediaType=application/json"` + Body components.CreateCurrencyCustomRequest `request:"mediaType=application/json"` } type CreateCustomCurrencyResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createcustomer.go b/api/spec/packages/aip-client-go/models/operations/createcustomer.go index e69ed23dd4..e7cf505169 100644 --- a/api/spec/packages/aip-client-go/models/operations/createcustomer.go +++ b/api/spec/packages/aip-client-go/models/operations/createcustomer.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateCustomerRequest struct { - Customer components.CreateMeterRequest `request:"mediaType=application/json"` + Customer components.CreateCustomerRequest `request:"mediaType=application/json"` } type CreateCustomerResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createfeature.go b/api/spec/packages/aip-client-go/models/operations/createfeature.go index fc428a531e..643d4e1ca6 100644 --- a/api/spec/packages/aip-client-go/models/operations/createfeature.go +++ b/api/spec/packages/aip-client-go/models/operations/createfeature.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateFeatureRequest struct { - Feature components.CreateMeterRequest `request:"mediaType=application/json"` + Feature components.CreateFeatureRequest `request:"mediaType=application/json"` } type CreateFeatureResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createllmcostoverride.go b/api/spec/packages/aip-client-go/models/operations/createllmcostoverride.go index a489f208e7..f6309fa150 100644 --- a/api/spec/packages/aip-client-go/models/operations/createllmcostoverride.go +++ b/api/spec/packages/aip-client-go/models/operations/createllmcostoverride.go @@ -10,5 +10,5 @@ type CreateLlmCostOverrideRequest struct { type CreateLlmCostOverrideResponse struct { HTTPMeta components.HTTPMetadata - Body *components.BillingPrice + Body *components.LlmCostPrice } diff --git a/api/spec/packages/aip-client-go/models/operations/createplan.go b/api/spec/packages/aip-client-go/models/operations/createplan.go index 28df79b4ea..dbe30a9849 100644 --- a/api/spec/packages/aip-client-go/models/operations/createplan.go +++ b/api/spec/packages/aip-client-go/models/operations/createplan.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreatePlanRequest struct { - Plan components.CreateMeterRequest `request:"mediaType=application/json"` + Plan components.CreatePlanRequest `request:"mediaType=application/json"` } type CreatePlanResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createplanaddon.go b/api/spec/packages/aip-client-go/models/operations/createplanaddon.go index 6698be1f80..bffa39e768 100644 --- a/api/spec/packages/aip-client-go/models/operations/createplanaddon.go +++ b/api/spec/packages/aip-client-go/models/operations/createplanaddon.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreatePlanAddonRequest struct { - PlanAddon components.CreateMeterRequest `request:"mediaType=application/json"` + PlanAddon components.CreatePlanAddonRequest `request:"mediaType=application/json"` } type CreatePlanAddonResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/createtaxcode.go b/api/spec/packages/aip-client-go/models/operations/createtaxcode.go index e444ad504c..8ef185c7da 100644 --- a/api/spec/packages/aip-client-go/models/operations/createtaxcode.go +++ b/api/spec/packages/aip-client-go/models/operations/createtaxcode.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type CreateTaxCodeRequest struct { - TaxCode components.CreateMeterRequest `request:"mediaType=application/json"` + TaxCode components.CreateTaxCodeRequest `request:"mediaType=application/json"` } type CreateTaxCodeResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/getllmcostprice.go b/api/spec/packages/aip-client-go/models/operations/getllmcostprice.go index 02d7d68df8..d38cf4c1f1 100644 --- a/api/spec/packages/aip-client-go/models/operations/getllmcostprice.go +++ b/api/spec/packages/aip-client-go/models/operations/getllmcostprice.go @@ -8,5 +8,5 @@ type GetLlmCostPriceRequest struct{} type GetLlmCostPriceResponse struct { HTTPMeta components.HTTPMetadata - Body *components.BillingPrice + Body *components.LlmCostPrice } diff --git a/api/spec/packages/aip-client-go/models/operations/updateaddon.go b/api/spec/packages/aip-client-go/models/operations/updateaddon.go index d203b7fd35..a9a172abea 100644 --- a/api/spec/packages/aip-client-go/models/operations/updateaddon.go +++ b/api/spec/packages/aip-client-go/models/operations/updateaddon.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdateAddonRequest struct { - Addon components.UpsertCustomerRequest `request:"mediaType=application/json"` + Addon components.UpsertAddonRequest `request:"mediaType=application/json"` } type UpdateAddonResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/updatebillingprofile.go b/api/spec/packages/aip-client-go/models/operations/updatebillingprofile.go index 6919a5b03a..9319b56737 100644 --- a/api/spec/packages/aip-client-go/models/operations/updatebillingprofile.go +++ b/api/spec/packages/aip-client-go/models/operations/updatebillingprofile.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdateBillingProfileRequest struct { - Profile components.UpsertCustomerRequest `request:"mediaType=application/json"` + Profile components.UpsertBillingProfileRequest `request:"mediaType=application/json"` } type UpdateBillingProfileResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/updatecustomerbilling.go b/api/spec/packages/aip-client-go/models/operations/updatecustomerbilling.go index 178436a6ab..63f34698ce 100644 --- a/api/spec/packages/aip-client-go/models/operations/updatecustomerbilling.go +++ b/api/spec/packages/aip-client-go/models/operations/updatecustomerbilling.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdateCustomerBillingRequest struct { - Body components.UpsertCustomerRequest `request:"mediaType=application/json"` + Body components.UpsertCustomerBillingDataRequest `request:"mediaType=application/json"` } type UpdateCustomerBillingResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/updatecustomerbillingappdata.go b/api/spec/packages/aip-client-go/models/operations/updatecustomerbillingappdata.go index 16a04b3047..47cd0f78fe 100644 --- a/api/spec/packages/aip-client-go/models/operations/updatecustomerbillingappdata.go +++ b/api/spec/packages/aip-client-go/models/operations/updatecustomerbillingappdata.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdateCustomerBillingAppDataRequest struct { - Body components.UpsertCustomerRequest `request:"mediaType=application/json"` + Body components.UpsertAppCustomerDataRequest `request:"mediaType=application/json"` } type UpdateCustomerBillingAppDataResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/updateorganizationdefaulttaxcodes.go b/api/spec/packages/aip-client-go/models/operations/updateorganizationdefaulttaxcodes.go index 67f525f83f..28f59db30f 100644 --- a/api/spec/packages/aip-client-go/models/operations/updateorganizationdefaulttaxcodes.go +++ b/api/spec/packages/aip-client-go/models/operations/updateorganizationdefaulttaxcodes.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdateOrganizationDefaultTaxCodesRequest struct { - Body components.UpdateMeterRequest `request:"mediaType=application/json"` + Body components.UpdateOrganizationDefaultTaxCodesRequest `request:"mediaType=application/json"` } type UpdateOrganizationDefaultTaxCodesResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/updateplan.go b/api/spec/packages/aip-client-go/models/operations/updateplan.go index c49e11be92..df4474fbcf 100644 --- a/api/spec/packages/aip-client-go/models/operations/updateplan.go +++ b/api/spec/packages/aip-client-go/models/operations/updateplan.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdatePlanRequest struct { - Plan components.UpsertCustomerRequest `request:"mediaType=application/json"` + Plan components.UpsertPlanRequest `request:"mediaType=application/json"` } type UpdatePlanResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/updateplanaddon.go b/api/spec/packages/aip-client-go/models/operations/updateplanaddon.go index 8129925559..c24e217b61 100644 --- a/api/spec/packages/aip-client-go/models/operations/updateplanaddon.go +++ b/api/spec/packages/aip-client-go/models/operations/updateplanaddon.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpdatePlanAddonRequest struct { - PlanAddon components.UpsertCustomerRequest `request:"mediaType=application/json"` + PlanAddon components.UpsertPlanAddonRequest `request:"mediaType=application/json"` } type UpdatePlanAddonResponse struct { diff --git a/api/spec/packages/aip-client-go/models/operations/upserttaxcode.go b/api/spec/packages/aip-client-go/models/operations/upserttaxcode.go index 7a0cd67a2e..a121093b08 100644 --- a/api/spec/packages/aip-client-go/models/operations/upserttaxcode.go +++ b/api/spec/packages/aip-client-go/models/operations/upserttaxcode.go @@ -5,7 +5,7 @@ package operations import "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" type UpsertTaxCodeRequest struct { - TaxCode components.UpsertCustomerRequest `request:"mediaType=application/json"` + TaxCode components.UpsertTaxCodeRequest `request:"mediaType=application/json"` } type UpsertTaxCodeResponse struct { diff --git a/api/spec/packages/aip-client-go/openmeterllmcostoverrides.go b/api/spec/packages/aip-client-go/openmeterllmcostoverrides.go index 1b1d609911..7d84d1b551 100644 --- a/api/spec/packages/aip-client-go/openmeterllmcostoverrides.go +++ b/api/spec/packages/aip-client-go/openmeterllmcostoverrides.go @@ -181,7 +181,7 @@ func (s *OpenMeterLlmCostOverrides) CreateLlmCostOverride(ctx context.Context, r if err != nil { return nil, err } - var out components.BillingPrice + var out components.LlmCostPrice if err := json.Unmarshal(body, &out); err != nil { return nil, err } diff --git a/api/spec/packages/aip-client-go/openmeterllmcostprices.go b/api/spec/packages/aip-client-go/openmeterllmcostprices.go index 10c3ddb60d..25c2b4399c 100644 --- a/api/spec/packages/aip-client-go/openmeterllmcostprices.go +++ b/api/spec/packages/aip-client-go/openmeterllmcostprices.go @@ -175,7 +175,7 @@ func (s *OpenMeterLlmCostPrices) GetLlmCostPrice(ctx context.Context, priceId st if err != nil { return nil, err } - var out components.BillingPrice + var out components.LlmCostPrice if err := json.Unmarshal(body, &out); err != nil { return nil, err } diff --git a/api/spec/packages/aip-client-javascript/models.ts b/api/spec/packages/aip-client-javascript/models.ts index 25775f2212..67fe31eadf 100644 --- a/api/spec/packages/aip-client-javascript/models.ts +++ b/api/spec/packages/aip-client-javascript/models.ts @@ -1,41 +1,45 @@ -import { z } from "zod"; +import { z } from 'zod' export const labels = z .object({}) - - .describe("Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with \"kong\", \"konnect\", \"mesh\", \"kic\", or \"\_\"."); + .describe( + 'Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\_".', + ) export const currencyCode = z .string() .min(3) .max(3) .regex(/^[A-Z]{3}$/) - - .describe("Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience."); + .describe( + 'Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.', + ) export const numeric = z .string() .regex(/^\-?[0-9]+(\.[0-9]+)?$/) - .describe("Numeric represents an arbitrary precision number."); + .describe('Numeric represents an arbitrary precision number.') export const cursorPaginationQueryPage = z .object({ size: z .bigint() .optional() - .describe("The number of items to include per page."), + .describe('The number of items to include per page.'), after: z .string() .optional() - - .describe("Request the next page of data, starting with the item after this parameter."), + .describe( + 'Request the next page of data, starting with the item after this parameter.', + ), before: z .string() .optional() - - .describe("Request the previous page of data, starting with the item before this parameter."), + .describe( + 'Request the previous page of data, starting with the item before this parameter.', + ), }) - .describe("Determines which page of the collection to retrieve."); + .describe('Determines which page of the collection to retrieve.') export const stringFieldFilter = z .union([ @@ -44,260 +48,281 @@ export const stringFieldFilter = z eq: z .string() .optional() - .describe("Value strictly equals the given string value."), + .describe('Value strictly equals the given string value.'), neq: z .string() .optional() - .describe("Value does not equal the given string value."), + .describe('Value does not equal the given string value.'), contains: z .string() .optional() - .describe("Value contains the given string value (fuzzy match)."), + .describe('Value contains the given string value (fuzzy match).'), ocontains: z .array(z.string()) .optional() - - .describe("Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string."), + .describe( + 'Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string.', + ), oeq: z .array(z.string()) .optional() - - .describe("Returns entities that exact match any of the comma-delimited phrases in the filter string."), + .describe( + 'Returns entities that exact match any of the comma-delimited phrases in the filter string.', + ), gt: z .string() .optional() - - .describe("Value is greater than the given string value (lexicographic compare)."), + .describe( + 'Value is greater than the given string value (lexicographic compare).', + ), gte: z .string() .optional() - - .describe("Value is greater than or equal to the given string value (lexicographic compare)."), + .describe( + 'Value is greater than or equal to the given string value (lexicographic compare).', + ), lt: z .string() .optional() - - .describe("Value is less than the given string value (lexicographic compare)."), + .describe( + 'Value is less than the given string value (lexicographic compare).', + ), lte: z .string() .optional() - - .describe("Value is less than or equal to the given string value (lexicographic compare)."), + .describe( + 'Value is less than or equal to the given string value (lexicographic compare).', + ), exists: z .boolean() .optional() - - .describe("When true, the field must be present (non-null); when false, the field must be absent (null)."), - }) + .describe( + 'When true, the field must be present (non-null); when false, the field must be absent (null).', + ), + }), ]) - - .describe("Filters on the given string field value by either exact or fuzzy match. All properties are optional; provide exactly one to specify the comparison."); + .describe( + 'Filters on the given string field value by either exact or fuzzy match. All properties are optional; provide exactly one to specify the comparison.', + ) export const ulid = z .string() .regex(/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/) - .describe("ULID (Universally Unique Lexicographically Sortable Identifier)."); + .describe('ULID (Universally Unique Lexicographically Sortable Identifier).') export const dateTime = z .string() .datetime() - - .describe("[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC."); + .describe( + '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.', + ) export const sortQuery = z .object({}) - - .describe("Sort query. The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order."); + .describe( + 'Sort query. The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.', + ) export const ingestedEventValidationError = z .object({ - code: z.string().describe("The machine readable code of the error."), + code: z.string().describe('The machine readable code of the error.'), message: z .string() - .describe("The human readable description of the error."), + .describe('The human readable description of the error.'), attributes: z .record(z.string(), z.unknown()) .optional() - .describe("Additional attributes."), + .describe('Additional attributes.'), }) - .describe("Event validation errors."); + .describe('Event validation errors.') export const cursorMetaPage = z .object({ - first: z.string().url().optional().describe("URI to the first page."), - last: z.string().url().optional().describe("URI to the last page."), - next: z.string().url().optional().describe("URI to the next page."), - previous: z.string().url().optional().describe("URI to the previous page."), - size: z.bigint().optional().describe("Requested page size."), + first: z.string().url().optional().describe('URI to the first page.'), + last: z.string().url().optional().describe('URI to the last page.'), + next: z.string().url().optional().describe('URI to the next page.'), + previous: z.string().url().optional().describe('URI to the previous page.'), + size: z.bigint().optional().describe('Requested page size.'), }) - .describe("Cursor pagination metadata."); + .describe('Cursor pagination metadata.') export const badRequest = z .object({ _: z.literal(400), }) - .describe("Bad Request."); + .describe('Bad Request.') export const unauthorized = z .object({ _: z.literal(401), }) - .describe("Unauthorized."); + .describe('Unauthorized.') export const forbidden = z .object({ _: z.literal(403), }) - .describe("Forbidden."); + .describe('Forbidden.') export const ingestEventsResponse = z .object({ _: z.literal(202), }) - - .describe("The events have been ingested and are being processed asynchronously."); + .describe( + 'The events have been ingested and are being processed asynchronously.', + ) export const resourceKey = z .string() .min(1) .max(64) .regex(/^[a-z0-9]+(?:_[a-z0-9]+)*$/) - .describe("A key is a unique string that is used to identify a resource."); + .describe('A key is a unique string that is used to identify a resource.') export const meterAggregation = z .union([ - z.literal("sum"), - z.literal("count"), - z.literal("unique_count"), - z.literal("avg"), - z.literal("min"), - z.literal("max"), - z.literal("latest") + z.literal('sum'), + z.literal('count'), + z.literal('unique_count'), + z.literal('avg'), + z.literal('min'), + z.literal('max'), + z.literal('latest'), ]) - .describe("The aggregation type to use for the meter."); + .describe('The aggregation type to use for the meter.') export const notFound = z .object({ _: z.literal(404), }) - .describe("Not Found."); + .describe('Not Found.') export const pagePaginatedMeta = z .object({ - number: z.bigint().describe("Page number."), - size: z.bigint().describe("Page size."), - total: z.bigint().describe("Total number of items in the collection."), + number: z.bigint().describe('Page number.'), + size: z.bigint().describe('Page size.'), + total: z.bigint().describe('Total number of items in the collection.'), }) - .describe("Pagination information."); + .describe('Pagination information.') export const deleteResponse = z .object({ _: z.literal(204), }) - .describe("Deleted response."); + .describe('Deleted response.') export const meterQueryGranularity = z .union([ - z.literal("PT1M"), - z.literal("PT1H"), - z.literal("P1D"), - z.literal("P1M") + z.literal('PT1M'), + z.literal('PT1H'), + z.literal('P1D'), + z.literal('P1M'), ]) - - .describe("The granularity of the time grouping. Time durations are specified in ISO 8601 format."); + .describe( + 'The granularity of the time grouping. Time durations are specified in ISO 8601 format.', + ) export const queryFilterString = z .object({ eq: z .string() .optional() - .describe("The attribute equals the provided value."), + .describe('The attribute equals the provided value.'), neq: z .string() .optional() - .describe("The attribute does not equal the provided value."), + .describe('The attribute does not equal the provided value.'), in: z .array(z.string()) .min(1) .max(100) .optional() - .describe("The attribute is one of the provided values."), + .describe('The attribute is one of the provided values.'), nin: z .array(z.string()) .min(1) .max(100) .optional() - .describe("The attribute is not one of the provided values."), + .describe('The attribute is not one of the provided values.'), contains: z .string() .optional() - .describe("The attribute contains the provided value."), + .describe('The attribute contains the provided value.'), ncontains: z .string() .optional() - .describe("The attribute does not contain the provided value."), - get and() { return z - .array(queryFilterString) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical AND."); }, - get or() { return z - .array(queryFilterString) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical OR."); }, + .describe('The attribute does not contain the provided value.'), + get and() { + return z + .array(queryFilterString) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical AND.') + }, + get or() { + return z + .array(queryFilterString) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical OR.') + }, }) - - .describe("A query filter for a string attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for a string attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const externalResourceKey = z .string() .min(1) .max(256) - - .describe("ExternalResourceKey is a unique string that is used to identify a resource in an external system."); + .describe( + 'ExternalResourceKey is a unique string that is used to identify a resource in an external system.', + ) export const usageAttributionSubjectKey = z .string() .min(1) - .describe("Subject key."); + .describe('Subject key.') export const countryCode = z .string() .min(2) .max(2) .regex(/^[A-Z]{2}$/) - - .describe("[ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 country code. Custom two-letter country codes are also supported for convenience."); + .describe( + '[ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 country code. Custom two-letter country codes are also supported for convenience.', + ) export const gone = z .object({ _: z.literal(410), }) - .describe("Gone."); + .describe('Gone.') export const createStripeCheckoutSessionBillingAddressCollection = z - .enum(["auto", "required"]) - - .describe("Controls whether Checkout collects the customer's billing address."); + .enum(['auto', 'required']) + .describe( + "Controls whether Checkout collects the customer's billing address.", + ) export const createStripeCheckoutSessionCustomerUpdateBehavior = z - .enum(["auto", "never"]) - .describe("Behavior for updating customer fields from checkout session."); + .enum(['auto', 'never']) + .describe('Behavior for updating customer fields from checkout session.') -export const createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition = z - .enum(["auto", "hidden"]) - .describe("Position of payment method reuse agreement in the UI."); +export const createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition = + z + .enum(['auto', 'hidden']) + .describe('Position of payment method reuse agreement in the UI.') export const createStripeCheckoutSessionConsentCollectionPromotions = z - .enum(["auto", "none"]) - .describe("Promotional communication consent collection setting."); + .enum(['auto', 'none']) + .describe('Promotional communication consent collection setting.') export const createStripeCheckoutSessionConsentCollectionTermsOfService = z - .enum(["none", "required"]) - .describe("Terms of service acceptance requirement."); + .enum(['none', 'required']) + .describe('Terms of service acceptance requirement.') export const checkoutSessionCustomTextParams = z .object({ @@ -307,113 +332,123 @@ export const checkoutSessionCustomTextParams = z .string() .max(1200) .optional() - .describe("The custom message text (max 1200 characters)."), + .describe('The custom message text (max 1200 characters).'), }) .optional() - .describe("Text displayed after the payment confirmation button."), + .describe('Text displayed after the payment confirmation button.'), shipping_address: z .object({ message: z .string() .max(1200) .optional() - .describe("The custom message text (max 1200 characters)."), + .describe('The custom message text (max 1200 characters).'), }) .optional() - .describe("Text displayed alongside shipping address collection."), + .describe('Text displayed alongside shipping address collection.'), submit: z .object({ message: z .string() .max(1200) .optional() - .describe("The custom message text (max 1200 characters)."), + .describe('The custom message text (max 1200 characters).'), }) .optional() - .describe("Text displayed alongside the payment confirmation button."), + .describe('Text displayed alongside the payment confirmation button.'), terms_of_service_acceptance: z .object({ message: z .string() .max(1200) .optional() - .describe("The custom message text (max 1200 characters)."), + .describe('The custom message text (max 1200 characters).'), }) .optional() - .describe("Text replacing the default terms of service agreement text."), + .describe('Text replacing the default terms of service agreement text.'), }) - .describe("Custom text displayed at various stages of the checkout flow."); + .describe('Custom text displayed at various stages of the checkout flow.') export const checkoutSessionUiMode = z - .enum(["embedded", "hosted"]) - .describe("Checkout Session UI mode."); + .enum(['embedded', 'hosted']) + .describe('Checkout Session UI mode.') export const createStripeCheckoutSessionRedirectOnCompletion = z - .enum(["always", "if_required", "never"]) - .describe("Redirect behavior for embedded checkout sessions."); + .enum(['always', 'if_required', 'never']) + .describe('Redirect behavior for embedded checkout sessions.') export const createCheckoutSessionTaxIdCollectionRequired = z - .enum(["if_supported", "never"]) - .describe("Tax ID collection requirement level."); + .enum(['if_supported', 'never']) + .describe('Tax ID collection requirement level.') export const stripeCheckoutSessionMode = z - .enum(["setup"]) - - .describe("Stripe Checkout Session mode. Determines the primary purpose of the checkout session."); + .enum(['setup']) + .describe( + 'Stripe Checkout Session mode. Determines the primary purpose of the checkout session.', + ) export const createStripeCustomerPortalSessionOptions = z .object({ configuration_id: z .string() .optional() - - .describe("The ID of an existing [Stripe configuration](https://docs.stripe.com/api/customer_portal/configurations) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration."), + .describe( + 'The ID of an existing [Stripe configuration](https://docs.stripe.com/api/customer_portal/configurations) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.', + ), locale: z .string() .optional() - - .describe("The IETF [language tag](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-locale) of the locale customer portal is displayed in. If blank or `auto`, the customer's preferred_locales or browser's locale is used."), + .describe( + "The IETF [language tag](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-locale) of the locale customer portal is displayed in. If blank or `auto`, the customer's preferred_locales or browser's locale is used.", + ), return_url: z .string() .optional() - - .describe("The [URL to redirect](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url) the customer to after they have completed their requested actions."), + .describe( + 'The [URL to redirect](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url) the customer to after they have completed their requested actions.', + ), }) - .describe("Request to create a Stripe Customer Portal Session."); + .describe('Request to create a Stripe Customer Portal Session.') export const entitlementType = z - .enum(["metered", "static", "boolean"]) - .describe("The type of the entitlement."); + .enum(['metered', 'static', 'boolean']) + .describe('The type of the entitlement.') export const creditFundingMethod = z - .enum(["none", "invoice", "external"]) - - .describe("The funding method describes how the grant is funded. - `none`: No funding workflow applies, for example promotional grants - `invoice`: The grant is funded by an in-system invoice flow - `external`: The grant is funded outside the system (e.g., wire transfer, external invoice, or manual reconciliation)"); + .enum(['none', 'invoice', 'external']) + .describe( + 'The funding method describes how the grant is funded. - `none`: No funding workflow applies, for example promotional grants - `invoice`: The grant is funded by an in-system invoice flow - `external`: The grant is funded outside the system (e.g., wire transfer, external invoice, or manual reconciliation)', + ) export const creditAvailabilityPolicy = z - .enum(["on_creation"]) - - .describe("When credits become available for consumption. - `on_creation`: Credits are available as soon as the grant is created. - `on_authorization`: Credits are available once the payment is authorized. - `on_settlement`: Credits are available once the payment is settled."); + .enum(['on_creation']) + .describe( + 'When credits become available for consumption. - `on_creation`: Credits are available as soon as the grant is created. - `on_authorization`: Credits are available once the payment is authorized. - `on_settlement`: Credits are available once the payment is settled.', + ) export const taxBehavior = z - .enum(["inclusive", "exclusive"]) - - .describe("Tax behavior. This enum is used to specify whether tax is included in the price or excluded from the price."); + .enum(['inclusive', 'exclusive']) + .describe( + 'Tax behavior. This enum is used to specify whether tax is included in the price or excluded from the price.', + ) export const creditPurchasePaymentSettlementStatus = z - .enum(["pending", "authorized", "settled"]) - - .describe("Credit purchase payment settlement status. - `pending`: Payment has been initiated and is not yet authorized. - `authorized`: Payment has been authorized. - `settled`: Payment has been settled."); + .enum(['pending', 'authorized', 'settled']) + .describe( + 'Credit purchase payment settlement status. - `pending`: Payment has been initiated and is not yet authorized. - `authorized`: Payment has been authorized. - `settled`: Payment has been settled.', + ) export const creditGrantStatus = z - .enum(["pending", "active", "expired", "voided"]) - - .describe("Credit grant lifecycle status. - `pending`: The credit block has been created but is not yet valid. (`effective_at` is in the future or availability_policy is not met) - `active`: The credit block is currently valid and eligible for consumption. (`effective_at` is in the past, `expires_at` is in the future and availability_policy is met) - `expired`: The credit block expired with remaining unused balance, `expires_at` time has passed. - `voided`: The credit block was voided. Remaining balance is forfeited."); + .enum(['pending', 'active', 'expired', 'voided']) + .describe( + 'Credit grant lifecycle status. - `pending`: The credit block has been created but is not yet valid. (`effective_at` is in the future or availability_policy is not met) - `active`: The credit block is currently valid and eligible for consumption. (`effective_at` is in the past, `expires_at` is in the future and availability_policy is met) - `expired`: The credit block expired with remaining unused balance, `expires_at` time has passed. - `voided`: The credit block was voided. Remaining balance is forfeited.', + ) export const creditTransactionType = z - .enum(["funded", "consumed"]) - - .describe("The type of the credit transaction. - `funded`: Credit granted and available for consumption. - `consumed`: Credit consumed by usage or fees."); + .enum(['funded', 'consumed']) + .describe( + 'The type of the credit transaction. - `funded`: Credit granted and available for consumption. - `consumed`: Credit consumed by usage or fees.', + ) export const stringFieldFilterExact = z .union([ @@ -422,69 +457,76 @@ export const stringFieldFilterExact = z eq: z .string() .optional() - .describe("Value strictly equals the given string value."), + .describe('Value strictly equals the given string value.'), oeq: z .array(z.string()) .optional() - - .describe("Returns entities that exact match any of the comma-delimited phrases in the filter string."), + .describe( + 'Returns entities that exact match any of the comma-delimited phrases in the filter string.', + ), neq: z .string() .optional() - .describe("Value does not equal the given string value."), - }) + .describe('Value does not equal the given string value.'), + }), ]) - - .describe("Filters on the given string field value by exact match. All properties are optional; provide exactly one to specify the comparison."); + .describe( + 'Filters on the given string field value by exact match. All properties are optional; provide exactly one to specify the comparison.', + ) export const chargesExpand = z - .enum(["real_time_usage"]) - - .describe("Expands for customer charges. Values: - `real_time_usage`: The charge's real-time usage."); + .enum(['real_time_usage']) + .describe( + "Expands for customer charges. Values: - `real_time_usage`: The charge's real-time usage.", + ) export const resourceManagedBy = z - .enum(["manual", "system", "subscription"]) - - .describe("Identifies which system manages a resource. Values: - `manual`: The resource is managed manually (overridden by our API users). - `system`: The resource is managed by the system. - `subscription`: The resource is managed by the subscription."); + .enum(['manual', 'system', 'subscription']) + .describe( + 'Identifies which system manages a resource. Values: - `manual`: The resource is managed manually (overridden by our API users). - `system`: The resource is managed by the system. - `subscription`: The resource is managed by the subscription.', + ) export const chargeStatus = z - .enum(["created", "active", "final", "deleted"]) - - .describe("Lifecycle status of a charge. Values: - `created`: The charge has been created but is not active yet. - `active`: The charge is active. - `final`: The charge is fully finalized and no further changes are expected. - `deleted`: The charge has been deleted."); + .enum(['created', 'active', 'final', 'deleted']) + .describe( + 'Lifecycle status of a charge. Values: - `created`: The charge has been created but is not active yet. - `active`: The charge is active. - `final`: The charge is fully finalized and no further changes are expected. - `deleted`: The charge has been deleted.', + ) export const priceFree = z .object({ - type: z.literal("free").describe("The type of the price."), + type: z.literal('free').describe('The type of the price.'), }) - .describe("Free price."); + .describe('Free price.') export const settlementMode = z - .enum(["credit_then_invoice", "credit_only"]) - - .describe("Settlement mode for billing. Values: - `credit_then_invoice`: Credits are applied first, then any remainder is invoiced. - `credit_only`: Usage is settled exclusively against credits."); + .enum(['credit_then_invoice', 'credit_only']) + .describe( + 'Settlement mode for billing. Values: - `credit_then_invoice`: Credits are applied first, then any remainder is invoiced. - `credit_only`: Usage is settled exclusively against credits.', + ) export const taxConfigStripe = z .object({ code: z .string() .regex(/^txcd_\d{8}$/) - .describe("Product [tax code](https://docs.stripe.com/tax/tax-codes)."), + .describe('Product [tax code](https://docs.stripe.com/tax/tax-codes).'), }) - .describe("The tax config for Stripe."); + .describe('The tax config for Stripe.') export const taxConfigExternalInvoicing = z .object({ code: z .string() .max(64) - - .describe("The tax code should be interpreted by the external invoicing provider."), + .describe( + 'The tax code should be interpreted by the external invoicing provider.', + ), }) - .describe("External invoicing tax config."); + .describe('External invoicing tax config.') export const pricePaymentTerm = z - .union([z.literal("in_advance"), z.literal("in_arrears")]) - .describe("The payment term of a flat price."); + .union([z.literal('in_advance'), z.literal('in_arrears')]) + .describe('The payment term of a flat price.') export const flatFeeDiscounts = z .object({ @@ -493,59 +535,66 @@ export const flatFeeDiscounts = z .nonnegative() .lte(100) .optional() - .describe("Percentage discount applied to the price (0–100)."), + .describe('Percentage discount applied to the price (0–100).'), }) - - .describe("Discounts applicable to flat fee charges. This is the same as `ProductCatalog.Discounts` but without the `usage` field, which is not applicable to flat fee charges."); + .describe( + 'Discounts applicable to flat fee charges. This is the same as `ProductCatalog.Discounts` but without the `usage` field, which is not applicable to flat fee charges.', + ) export const prorationMode = z - .enum(["no_proration", "prorate_prices"]) - - .describe("The proration mode of the rate card. Values: - `no_proration`: No proration. - `prorate_prices`: Prorate the price based on the time remaining in the billing period."); + .enum(['no_proration', 'prorate_prices']) + .describe( + 'The proration mode of the rate card. Values: - `no_proration`: No proration. - `prorate_prices`: Prorate the price based on the time remaining in the billing period.', + ) export const subscriptionStatus = z - .enum(["active", "inactive", "canceled", "scheduled"]) - .describe("Subscription status."); + .enum(['active', 'inactive', 'canceled', 'scheduled']) + .describe('Subscription status.') export const conflict = z .object({ _: z.literal(409), }) - .describe("Conflict."); + .describe('Conflict.') export const subscriptionEditTimingEnum = z - .enum(["immediate", "next_billing_cycle"]) - - .describe("Subscription edit timing. When immediate, the requested changes take effect immediately. When next_billing_cycle, the requested changes take effect at the next billing cycle."); + .enum(['immediate', 'next_billing_cycle']) + .describe( + 'Subscription edit timing. When immediate, the requested changes take effect immediately. When next_billing_cycle, the requested changes take effect at the next billing cycle.', + ) export const appType = z - .enum(["sandbox", "stripe", "external_invoicing"]) - .describe("The type of the app."); + .enum(['sandbox', 'stripe', 'external_invoicing']) + .describe('The type of the app.') export const appStatus = z - .enum(["ready", "unauthorized"]) - .describe("Connection status of an installed app."); + .enum(['ready', 'unauthorized']) + .describe('Connection status of an installed app.') export const taxIdentificationCode = z .string() .min(1) .max(32) - - .describe("Tax identifier code is a normalized tax code shown on the original identity document."); + .describe( + 'Tax identifier code is a normalized tax code shown on the original identity document.', + ) export const billingWorkflowCollectionAlignmentSubscription = z .object({ - type: z.literal("subscription").describe("The type of alignment."), + type: z.literal('subscription').describe('The type of alignment.'), }) - - .describe("BillingWorkflowCollectionAlignmentSubscription specifies the alignment for collecting the pending line items into an invoice."); + .describe( + 'BillingWorkflowCollectionAlignmentSubscription specifies the alignment for collecting the pending line items into an invoice.', + ) export const iso8601Duration = z .string() - - .regex(/^P(?:\d+(?:\.\d+)?Y)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?W)?(?:\d+(?:\.\d+)?D)?(?:T(?:\d+(?:\.\d+)?H)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?S)?)?$/) - - .describe("[ISO 8601 Duration](https://docs.digi.com/resources/documentation/digidocs/90001488-13/reference/r_iso_8601_duration_format.htm) string."); + .regex( + /^P(?:\d+(?:\.\d+)?Y)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?W)?(?:\d+(?:\.\d+)?D)?(?:T(?:\d+(?:\.\d+)?H)?(?:\d+(?:\.\d+)?M)?(?:\d+(?:\.\d+)?S)?)?$/, + ) + .describe( + '[ISO 8601 Duration](https://docs.digi.com/resources/documentation/digidocs/90001488-13/reference/r_iso_8601_duration_format.htm) string.', + ) export const billingWorkflowInvoicingSettings = z .object({ @@ -553,123 +602,132 @@ export const billingWorkflowInvoicingSettings = z .boolean() .optional() .default(true) - - .describe("Whether to automatically issue the invoice after the draftPeriod has passed."), + .describe( + 'Whether to automatically issue the invoice after the draftPeriod has passed.', + ), draft_period: z .string() .optional() - .default("P0D") - - .describe("The period for the invoice to be kept in draft status for manual reviews."), + .default('P0D') + .describe( + 'The period for the invoice to be kept in draft status for manual reviews.', + ), progressive_billing: z .boolean() .optional() .default(true) - .describe("Should progressive billing be allowed for this workflow?"), + .describe('Should progressive billing be allowed for this workflow?'), }) - .describe("Invoice settings for a billing workflow."); + .describe('Invoice settings for a billing workflow.') export const billingWorkflowPaymentChargeAutomaticallySettings = z .object({ collection_method: z - .literal("charge_automatically") - .describe("The collection method for the invoice."), + .literal('charge_automatically') + .describe('The collection method for the invoice.'), }) - - .describe("Payment settings for a billing workflow when the collection method is charge automatically."); + .describe( + 'Payment settings for a billing workflow when the collection method is charge automatically.', + ) export const billingWorkflowPaymentSendInvoiceSettings = z .object({ collection_method: z - .literal("send_invoice") - .describe("The collection method for the invoice."), + .literal('send_invoice') + .describe('The collection method for the invoice.'), due_after: z .string() .optional() - .default("P30D") - - .describe("The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method."), + .default('P30D') + .describe( + "The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method.", + ), }) - - .describe("Payment settings for a billing workflow when the collection method is send invoice."); + .describe( + 'Payment settings for a billing workflow when the collection method is send invoice.', + ) export const currencyType = z - .enum(["fiat", "custom"]) - - .describe("Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes."); + .enum(['fiat', 'custom']) + .describe( + 'Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.', + ) export const currencyCodeCustom = z .string() .min(3) .max(24) - - .describe("Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes."); + .describe( + 'Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.', + ) export const featureLlmTokenType = z .enum([ - "input", - "output", - "cache_read", - "cache_write", - "reasoning", - "request", - "response" + 'input', + 'output', + 'cache_read', + 'cache_write', + 'reasoning', + 'request', + 'response', ]) - .describe("Token type for LLM cost lookup."); + .describe('Token type for LLM cost lookup.') export const provider = z .object({ id: z .string() - .describe("Identifier of the provider, e.g., \"openai\", \"anthropic\"."), + .describe('Identifier of the provider, e.g., "openai", "anthropic".'), name: z .string() - .describe("Name of the provider, e.g., \"OpenAI\", \"Anthropic\"."), + .describe('Name of the provider, e.g., "OpenAI", "Anthropic".'), }) - .describe("LLM Provider"); + .describe('LLM Provider') export const model = z .object({ id: z .string() - - .describe("Identifier of the model, e.g., \"gpt-4\", \"claude-3-5-sonnet\"."), + .describe('Identifier of the model, e.g., "gpt-4", "claude-3-5-sonnet".'), name: z .string() - .describe("Name of the model, e.g., \"GPT-4\", \"Claude 3.5 Sonnet\"."), + .describe('Name of the model, e.g., "GPT-4", "Claude 3.5 Sonnet".'), }) - .describe("LLM Model"); + .describe('LLM Model') export const priceSource = z - .enum(["manual", "system"]) - .describe("Identifies where an LLM cost price came from."); + .enum(['manual', 'system']) + .describe('Identifies where an LLM cost price came from.') export const planStatus = z - .enum(["draft", "active", "archived", "scheduled"]) - - .describe("The status of a plan. - `draft`: The plan has not yet been published and can be edited. - `active`: The plan is published and can be used in subscriptions. - `archived`: The plan is no longer available for use. - `scheduled`: The plan is scheduled to be published at a future date."); + .enum(['draft', 'active', 'archived', 'scheduled']) + .describe( + 'The status of a plan. - `draft`: The plan has not yet been published and can be edited. - `active`: The plan is published and can be used in subscriptions. - `archived`: The plan is no longer available for use. - `scheduled`: The plan is scheduled to be published at a future date.', + ) export const productCatalogValidationError = z .object({ - code: z.string().describe("Machine-readable error code."), - message: z.string().describe("Human-readable description of the error."), + code: z.string().describe('Machine-readable error code.'), + message: z.string().describe('Human-readable description of the error.'), attributes: z .record(z.string(), z.unknown()) .optional() - .describe("Additional structured context."), - field: z.string().describe("The path to the field."), + .describe('Additional structured context.'), + field: z.string().describe('The path to the field.'), }) - .describe("Validation errors providing detailed description of the issue."); + .describe('Validation errors providing detailed description of the issue.') export const addonInstanceType = z - .enum(["single", "multiple"]) - - .describe("The instanceType of the add-on. - `single`: Can be added to a subscription only once. - `multiple`: Can be added to a subscription more than once."); + .enum(['single', 'multiple']) + .describe( + 'The instanceType of the add-on. - `single`: Can be added to a subscription only once. - `multiple`: Can be added to a subscription more than once.', + ) export const addonStatus = z - .enum(["draft", "active", "archived"]) - - .describe("The status of the add-on defined by the `effective_from` and `effective_to` properties. - `draft`: The add-on has not yet been published and can be edited. - `active`: The add-on is published and available for use. - `archived`: The add-on is no longer available for use."); + .enum(['draft', 'active', 'archived']) + .describe( + 'The status of the add-on defined by the `effective_from` and `effective_to` properties. - `draft`: The add-on has not yet been published and can be edited. - `active`: The add-on is published and available for use. - `archived`: The add-on is no longer available for use.', + ) export const governanceQueryRequestCustomers = z .object({ @@ -677,10 +735,11 @@ export const governanceQueryRequestCustomers = z .array(z.string()) .min(1) .max(100) - - .describe("Each entry can be a customer `key` or a usage-attribution subject `key`. Identifiers that cannot be resolved to a customer are reported in the response `errors` array."), + .describe( + 'Each entry can be a customer `key` or a usage-attribution subject `key`. Identifiers that cannot be resolved to a customer are reported in the response `errors` array.', + ), }) - .describe("List of customer identifiers to evaluate access for."); + .describe('List of customer identifiers to evaluate access for.') export const governanceQueryRequestFeatures = z .object({ @@ -688,124 +747,138 @@ export const governanceQueryRequestFeatures = z .array(z.string()) .min(1) .max(100) - .describe("List of feature keys to evaluate access for."), + .describe('List of feature keys to evaluate access for.'), }) - - .describe("Optional list of feature keys to evaluate access for. If omitted, all features available in the organization are returned. Providing this list is recommended to reduce the response size and the load on the backend services."); + .describe( + 'Optional list of feature keys to evaluate access for. If omitted, all features available in the organization are returned. Providing this list is recommended to reduce the response size and the load on the backend services.', + ) export const governanceFeatureAccessReasonCode = z .enum([ - "unknown", - "usage_limit_reached", - "feature_unavailable", - "feature_not_found", - "no_credit_available" + 'unknown', + 'usage_limit_reached', + 'feature_unavailable', + 'feature_not_found', + 'no_credit_available', ]) - .describe("Machine-readable reason code for denied feature access."); + .describe('Machine-readable reason code for denied feature access.') export const governanceQueryErrorCode = z - .enum(["unknown", "customer_not_found"]) - .describe("Error code for a governance query failure."); + .enum(['unknown', 'customer_not_found']) + .describe('Error code for a governance query failure.') export const queryFilterInteger = z .object({ eq: z .bigint() .optional() - .describe("The attribute equals the provided value."), + .describe('The attribute equals the provided value.'), neq: z .bigint() .optional() - .describe("The attribute does not equal the provided value."), + .describe('The attribute does not equal the provided value.'), in: z .array(z.bigint()) .min(1) .max(100) .optional() - .describe("The attribute is one of the provided values."), + .describe('The attribute is one of the provided values.'), nin: z .array(z.bigint()) .min(1) .max(100) .optional() - .describe("The attribute is not one of the provided values."), + .describe('The attribute is not one of the provided values.'), gt: z .bigint() .optional() - .describe("The attribute is greater than the provided value."), + .describe('The attribute is greater than the provided value.'), gte: z .bigint() .optional() - - .describe("The attribute is greater than or equal to the provided value."), + .describe( + 'The attribute is greater than or equal to the provided value.', + ), lt: z .bigint() .optional() - .describe("The attribute is less than the provided value."), + .describe('The attribute is less than the provided value.'), lte: z .bigint() .optional() - .describe("The attribute is less than or equal to the provided value."), - get and() { return z - .array(queryFilterInteger) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical AND."); }, - get or() { return z - .array(queryFilterInteger) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical OR."); }, + .describe('The attribute is less than or equal to the provided value.'), + get and() { + return z + .array(queryFilterInteger) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical AND.') + }, + get or() { + return z + .array(queryFilterInteger) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical OR.') + }, }) - - .describe("A query filter for an integer attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for an integer attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const queryFilterFloat = z .object({ gt: z .number() .optional() - .describe("The attribute is greater than the provided value."), + .describe('The attribute is greater than the provided value.'), gte: z .number() .optional() - - .describe("The attribute is greater than or equal to the provided value."), + .describe( + 'The attribute is greater than or equal to the provided value.', + ), lt: z .number() .optional() - .describe("The attribute is less than the provided value."), + .describe('The attribute is less than the provided value.'), lte: z .number() .optional() - .describe("The attribute is less than or equal to the provided value."), - get and() { return z - .array(queryFilterFloat) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical AND."); }, - get or() { return z - .array(queryFilterFloat) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical OR."); }, + .describe('The attribute is less than or equal to the provided value.'), + get and() { + return z + .array(queryFilterFloat) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical AND.') + }, + get or() { + return z + .array(queryFilterFloat) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical OR.') + }, }) - - .describe("A query filter for a float attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for a float attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const queryFilterBoolean = z .object({ eq: z .boolean() .optional() - .describe("The attribute equals the provided value."), + .describe('The attribute equals the provided value.'), }) - - .describe("A query filter for a boolean attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for a boolean attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const pagePaginationQuery = z .object({ @@ -814,60 +887,61 @@ export const pagePaginationQuery = z size: z .bigint() .optional() - .describe("The number of items to include per page."), - number: z.bigint().optional().describe("The page number."), + .describe('The number of items to include per page.'), + number: z.bigint().optional().describe('The page number.'), }) .optional() - .describe("Determines which page of the collection to retrieve."), + .describe('Determines which page of the collection to retrieve.'), }) - .describe("Page pagination query."); + .describe('Page pagination query.') export const publicLabels = z .object({}) - - .describe("Public labels store information about an entity that can be used for filtering a list of objects."); + .describe( + 'Public labels store information about an entity that can be used for filtering a list of objects.', + ) export const payloadTooLarge = z .object({ _: z.literal(413), }) - .describe("Payload Too Large."); + .describe('Payload Too Large.') export const unsupportedMediaType = z .object({ _: z.literal(415), }) - .describe("Unsupported Media Type."); + .describe('Unsupported Media Type.') export const unprocessableContent = z .object({ _: z.literal(422), }) - .describe("Unprocessable Content."); + .describe('Unprocessable Content.') export const tooManyRequests = z .object({ _: z.literal(429), }) - .describe("Too Many Requests."); + .describe('Too Many Requests.') export const internal = z .object({ _: z.literal(500), }) - .describe("Internal Server Error."); + .describe('Internal Server Error.') export const notImplemented = z .object({ _: z.literal(501), }) - .describe("Not Implemented."); + .describe('Not Implemented.') export const notAvailable = z .object({ _: z.literal(503), }) - .describe("Not Available."); + .describe('Not Available.') export const booleanFieldFilter = z .union([ @@ -875,10 +949,10 @@ export const booleanFieldFilter = z z.object({ eq: z .boolean() - .describe("Value strictly equals the given boolean value."), - }) + .describe('Value strictly equals the given boolean value.'), + }), ]) - .describe("Filter by a boolean value (true/false)."); + .describe('Filter by a boolean value (true/false).') export const numericFieldFilter = z .union([ @@ -887,101 +961,113 @@ export const numericFieldFilter = z eq: z .number() .optional() - .describe("Value strictly equals the given numeric value."), + .describe('Value strictly equals the given numeric value.'), neq: z .number() .optional() - .describe("Value does not equal the given numeric value."), + .describe('Value does not equal the given numeric value.'), oeq: z .array(z.number()) .optional() - - .describe("Returns entities that match any of the comma-delimited numeric values."), + .describe( + 'Returns entities that match any of the comma-delimited numeric values.', + ), lt: z .number() .optional() - .describe("Value is less than the given numeric value."), + .describe('Value is less than the given numeric value.'), lte: z .number() .optional() - .describe("Value is less than or equal to the given numeric value."), + .describe('Value is less than or equal to the given numeric value.'), gt: z .number() .optional() - .describe("Value is greater than the given numeric value."), + .describe('Value is greater than the given numeric value.'), gte: z .number() .optional() - .describe("Value is greater than or equal to the given numeric value."), - }) + .describe('Value is greater than or equal to the given numeric value.'), + }), ]) - - .describe("Filter by a numeric value. All properties are optional; provide exactly one to specify the comparison."); + .describe( + 'Filter by a numeric value. All properties are optional; provide exactly one to specify the comparison.', + ) export const chargeType = z - .enum(["flat_fee", "usage_based"]) - - .describe("Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge."); + .enum(['flat_fee', 'usage_based']) + .describe( + 'Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge.', + ) export const invoiceNumber = z .string() .min(1) .max(256) - - .describe("InvoiceNumber is a unique identifier for the invoice, generated by the invoicing app. The uniqueness depends on a lot of factors: - app setting (unique per app or unique per customer) - multiple app scenarios (multiple apps generating invoices with the same prefix)"); + .describe( + 'InvoiceNumber is a unique identifier for the invoice, generated by the invoicing app. The uniqueness depends on a lot of factors: - app setting (unique per app or unique per customer) - multiple app scenarios (multiple apps generating invoices with the same prefix)', + ) export const billingCollectionAlignmentType = z - .enum(["subscription", "anchored"]) - - .describe("BillingCollectionAlignment specifies when the pending line items should be collected into an invoice."); + .enum(['subscription', 'anchored']) + .describe( + 'BillingCollectionAlignment specifies when the pending line items should be collected into an invoice.', + ) export const collectionMethod = z - .enum(["charge_automatically", "send_invoice"]) - - .describe("Collection method specifies how the invoice should be collected (automatic or manual)."); + .enum(['charge_automatically', 'send_invoice']) + .describe( + 'Collection method specifies how the invoice should be collected (automatic or manual).', + ) export const unitConfigOperation = z - .enum(["divide", "multiply"]) - - .describe("The arithmetic operation used to convert raw metered units into billing units. - `divide`: Divide the metered quantity by the conversion factor (e.g., bytes ÷ 1e9 = GB). - `multiply`: Multiply the metered quantity by the conversion factor (e.g., cost × 1.2 = cost + 20% margin)."); + .enum(['divide', 'multiply']) + .describe( + 'The arithmetic operation used to convert raw metered units into billing units. - `divide`: Divide the metered quantity by the conversion factor (e.g., bytes ÷ 1e9 = GB). - `multiply`: Multiply the metered quantity by the conversion factor (e.g., cost × 1.2 = cost + 20% margin).', + ) export const unitConfigRoundingMode = z - .enum(["ceiling", "floor", "half_up", "none"]) - - .describe("The rounding mode applied to the converted quantity for invoicing. Rounding is applied only to the invoiced quantity. Entitlement balance checks use the precise decimal value after conversion. - `ceiling`: Round up to the next integer (typical for package-style billing). - `floor`: Round down to the previous integer. - `half_up`: Round to the nearest integer, with 0.5 rounding up. - `none`: No rounding; the converted value is used as-is."); + .enum(['ceiling', 'floor', 'half_up', 'none']) + .describe( + 'The rounding mode applied to the converted quantity for invoicing. Rounding is applied only to the invoiced quantity. Entitlement balance checks use the precise decimal value after conversion. - `ceiling`: Round up to the next integer (typical for package-style billing). - `floor`: Round down to the previous integer. - `half_up`: Round to the nearest integer, with 0.5 rounding up. - `none`: No rounding; the converted value is used as-is.', + ) export const priceType = z - .enum(["free", "flat", "unit", "graduated", "volume"]) - - .describe("The type of the price. - `free`: No charge, the rate card is included at no cost. - `flat`: A fixed amount charged once per billing period, regardless of usage. - `unit`: A fixed rate charged per billing unit consumed. - `graduated`: Tiered pricing where each tier's rate applies only to usage within that tier. - `volume`: Tiered pricing where the rate for the highest tier reached applies to all units in the period."); + .enum(['free', 'flat', 'unit', 'graduated', 'volume']) + .describe( + "The type of the price. - `free`: No charge, the rate card is included at no cost. - `flat`: A fixed amount charged once per billing period, regardless of usage. - `unit`: A fixed rate charged per billing unit consumed. - `graduated`: Tiered pricing where each tier's rate applies only to usage within that tier. - `volume`: Tiered pricing where the rate for the highest tier reached applies to all units in the period.", + ) export const featureUnitCostType = z - .enum(["llm", "manual"]) - .describe("The type of unit cost."); + .enum(['llm', 'manual']) + .describe('The type of unit cost.') export const systemAccountAccessToken = z .object({ - type: z.literal("http").describe("Http authentication"), - scheme: z.literal("Bearer").describe("bearer auth scheme"), + type: z.literal('http').describe('Http authentication'), + scheme: z.literal('Bearer').describe('bearer auth scheme'), }) - - .describe("The system account access token is meant for automations and integrations that are not directly associated with a human identity."); + .describe( + 'The system account access token is meant for automations and integrations that are not directly associated with a human identity.', + ) export const personalAccessToken = z .object({ - type: z.literal("http").describe("Http authentication"), - scheme: z.literal("Bearer").describe("bearer auth scheme"), + type: z.literal('http').describe('Http authentication'), + scheme: z.literal('Bearer').describe('bearer auth scheme'), }) - - .describe("The personal access token is meant to be used as an alternative to basic-auth when accessing Konnect via APIs."); + .describe( + 'The personal access token is meant to be used as an alternative to basic-auth when accessing Konnect via APIs.', + ) export const konnectAccessToken = z .object({ - type: z.literal("http").describe("Http authentication"), - scheme: z.literal("Bearer").describe("bearer auth scheme"), + type: z.literal('http').describe('Http authentication'), + scheme: z.literal('Bearer').describe('bearer auth scheme'), }) - - .describe("The Konnect access token is meant to be used by the Konnect dashboard and the decK CLI authenticate with."); + .describe( + 'The Konnect access token is meant to be used by the Konnect dashboard and the decK CLI authenticate with.', + ) export const updateRequest = z .object({ @@ -990,70 +1076,73 @@ export const updateRequest = z .min(1) .max(256) .optional() - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), dimensions: z .record(z.string(), z.string()) .optional() - - .describe("Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters."), + .describe( + 'Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters.', + ), }) - .describe("Meter update request."); + .describe('Meter update request.') export const appCustomerDataStripe = z .object({ - customer_id: z.string().optional().describe("The Stripe customer ID used."), + customer_id: z.string().optional().describe('The Stripe customer ID used.'), default_payment_method_id: z .string() .optional() - .describe("The Stripe default payment method ID."), + .describe('The Stripe default payment method ID.'), labels: labels.optional(), }) - .describe("Stripe customer data."); + .describe('Stripe customer data.') export const appCustomerDataExternalInvoicing = z .object({ labels: labels.optional(), }) - .describe("External invoicing customer data."); + .describe('External invoicing customer data.') export const currencyCode_2 = z .union([currencyCode]) - .describe("Fiat or custom currency code."); + .describe('Fiat or custom currency code.') export const listCostBasesParamsFilter = z .object({ fiat_code: currencyCode.optional(), }) - .describe("Filter options for listing cost bases."); + .describe('Filter options for listing cost bases.') export const priceFlat = z .object({ - type: z.literal("flat").describe("The type of the price."), + type: z.literal('flat').describe('The type of the price.'), amount: numeric, }) - .describe("Flat price."); + .describe('Flat price.') export const priceUnit = z .object({ - type: z.literal("unit").describe("The type of the price."), + type: z.literal('unit').describe('The type of the price.'), amount: numeric, }) - - .describe("Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the rate card, billing units are the converted quantities (e.g. GB instead of bytes)."); + .describe( + 'Unit price. Charges a fixed rate per billing unit. When UnitConfig is present on the rate card, billing units are the converted quantities (e.g. GB instead of bytes).', + ) export const currencyAmount = z .object({ amount: numeric, currency: currencyCode, }) - .describe("Monetary amount in a specific currency."); + .describe('Monetary amount in a specific currency.') export const discounts = z .object({ @@ -1062,10 +1151,10 @@ export const discounts = z .nonnegative() .lte(100) .optional() - .describe("Percentage discount applied to the price (0–100)."), + .describe('Percentage discount applied to the price (0–100).'), usage: numeric.optional(), }) - .describe("Discount configuration for a rate card."); + .describe('Discount configuration for a rate card.') export const billingTotals = z .object({ @@ -1078,17 +1167,18 @@ export const billingTotals = z credits_total: numeric, total: numeric, }) - - .describe("Totals contains the summaries of all calculations for a billing resource."); + .describe( + 'Totals contains the summaries of all calculations for a billing resource.', + ) export const featureManualUnitCost = z .object({ type: z - .literal("manual") - .describe("The type discriminator for manual unit cost."), + .literal('manual') + .describe('The type discriminator for manual unit cost.'), amount: numeric, }) - .describe("A fixed per-unit cost amount."); + .describe('A fixed per-unit cost amount.') export const featureLlmUnitCostPricing = z .object({ @@ -1098,7 +1188,7 @@ export const featureLlmUnitCostPricing = z reasoning_per_token: numeric.optional(), cache_write_per_token: numeric.optional(), }) - .describe("Resolved per-token pricing from the LLM cost database."); + .describe('Resolved per-token pricing from the LLM cost database.') export const modelPricing = z .object({ @@ -1108,15 +1198,16 @@ export const modelPricing = z cache_write_per_token: numeric.optional(), reasoning_per_token: numeric.optional(), }) - .describe("Token pricing for an LLM model, denominated per token."); + .describe('Token pricing for an LLM model, denominated per token.') export const spendCommitments = z .object({ minimum_amount: numeric.optional(), maximum_amount: numeric.optional(), }) - - .describe("Spend commitments for a rate card. The customer is committed to spend at least the minimum amount and at most the maximum amount."); + .describe( + 'Spend commitments for a rate card. The customer is committed to spend at least the minimum amount and at most the maximum amount.', + ) export const queryFilterNumeric = z .object({ @@ -1124,34 +1215,39 @@ export const queryFilterNumeric = z gte: numeric.optional(), lt: numeric.optional(), lte: numeric.optional(), - get and() { return z - .array(queryFilterNumeric) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical AND."); }, - get or() { return z - .array(queryFilterNumeric) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical OR."); }, + get and() { + return z + .array(queryFilterNumeric) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical AND.') + }, + get or() { + return z + .array(queryFilterNumeric) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical OR.') + }, }) - - .describe("A query filter for a numeric attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for a numeric attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const cursorPaginationQuery = z .object({ page: cursorPaginationQueryPage.optional(), }) - .describe("Cursor page query."); + .describe('Cursor page query.') export const listMetersParamsFilter = z .object({ key: stringFieldFilter.optional(), name: stringFieldFilter.optional(), }) - .describe("Filter options for listing meters."); + .describe('Filter options for listing meters.') export const listPricesParamsFilter = z .object({ @@ -1161,12 +1257,13 @@ export const listPricesParamsFilter = z currency: stringFieldFilter.optional(), source: stringFieldFilter.optional(), }) - .describe("Filter options for listing LLM cost prices."); + .describe('Filter options for listing LLM cost prices.') export const labelsFieldFilter = z .record(z.string(), stringFieldFilter) - - .describe("Filters on the resource's `labels` field. The schema is a map keyed by the label name; each value is a `StringFieldFilter`. Both deepObject forms are accepted: `filter[labels][key]=value` (nested) and `filter[labels.key]=value` (dot-notation)."); + .describe( + "Filters on the resource's `labels` field. The schema is a map keyed by the label name; each value is a `StringFieldFilter`. Both deepObject forms are accepted: `filter[labels][key]=value` (nested) and `filter[labels.key]=value` (dot-notation).", + ) export const ulidFieldFilter = z .union([ @@ -1176,37 +1273,39 @@ export const ulidFieldFilter = z oeq: z .array(ulid) .optional() - - .describe("Returns entities that exact match any of the comma-delimited ULIDs in the filter string."), + .describe( + 'Returns entities that exact match any of the comma-delimited ULIDs in the filter string.', + ), neq: ulid.optional(), - }) + }), ]) - - .describe("Filters on the given ULID field value by exact match. All properties are optional; provide exactly one to specify the comparison."); + .describe( + 'Filters on the given ULID field value by exact match. All properties are optional; provide exactly one to specify the comparison.', + ) export const resourceReference = z .object({ id: ulid, }) - .describe("Customer reference."); + .describe('Customer reference.') export const billingProfileReference = z .object({ id: ulid, }) - .describe("Billing profile reference."); + .describe('Billing profile reference.') export const resourceReference_2 = z .object({ id: ulid, }) - .describe("TaxCode reference."); + .describe('TaxCode reference.') export const customerReference = z .object({ id: ulid, }) - .describe("Customer reference."); + .describe('Customer reference.') export const subscriptionReference = z .object({ @@ -1218,56 +1317,59 @@ export const subscriptionReference = z .object({ id: ulid, }) - .describe("The item of the phase."), + .describe('The item of the phase.'), }) - .describe("The phase of the subscription."), + .describe('The phase of the subscription.'), }) - - .describe("Subscription reference represents a reference to the specific subscription item this entity represents."); + .describe( + 'Subscription reference represents a reference to the specific subscription item this entity represents.', + ) export const resourceReference_3 = z .object({ id: ulid, }) - .describe("Addon reference."); + .describe('Addon reference.') export const appReference = z .object({ id: ulid, }) - .describe("App reference."); + .describe('App reference.') export const currencyFiat = z .object({ id: ulid, - type: z.literal("fiat").describe("The type of the currency."), + type: z.literal('fiat').describe('The type of the currency.'), name: z .string() .min(1) .max(256) - - .describe("The name of the currency. It should be a human-readable string that represents the name of the currency, such as \"US Dollar\" or \"Euro\"."), + .describe( + 'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".', + ), description: z .string() .min(1) .max(256) .optional() - .describe("Description of the currency."), + .describe('Description of the currency.'), symbol: z .string() .min(1) .optional() - - .describe("The symbol of the currency. It should be a string that represents the symbol of the currency, such as \"$\" for US Dollar or \"€\" for Euro."), + .describe( + 'The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.', + ), code: currencyCode, }) - .describe("Currency describes a currency supported by the billing system."); + .describe('Currency describes a currency supported by the billing system.') export const resourceReference_4 = z .object({ id: ulid, }) - .describe("Feature reference."); + .describe('Feature reference.') export const dateTimeFieldFilter = z .union([ @@ -1278,55 +1380,62 @@ export const dateTimeFieldFilter = z lte: dateTime.optional(), gt: dateTime.optional(), gte: dateTime.optional(), - }) + }), ]) - - .describe("Filters on the given datetime (RFC-3339) field value. All properties are optional; provide exactly one to specify the comparison."); + .describe( + 'Filters on the given datetime (RFC-3339) field value. All properties are optional; provide exactly one to specify the comparison.', + ) export const meteringEvent = z .object({ - id: z.string().min(1).describe("Identifies the event."), + id: z.string().min(1).describe('Identifies the event.'), source: z .string() .min(1) - .describe("Identifies the context in which an event happened."), + .describe('Identifies the context in which an event happened.'), specversion: z .string() .min(1) - .default("1.0") - - .describe("The version of the CloudEvents specification which the event uses."), + .default('1.0') + .describe( + 'The version of the CloudEvents specification which the event uses.', + ), type: z .string() .min(1) - - .describe("Contains a value describing the type of event related to the originating occurrence."), + .describe( + 'Contains a value describing the type of event related to the originating occurrence.', + ), datacontenttype: z - .union([z.literal("application/json"), z.null()]) + .union([z.literal('application/json'), z.null()]) .optional() - - .describe("Content type of the CloudEvents data value. Only the value \"application/json\" is allowed over HTTP."), + .describe( + 'Content type of the CloudEvents data value. Only the value "application/json" is allowed over HTTP.', + ), dataschema: z .union([z.string().url(), z.null()]) .optional() - .describe("Identifies the schema that data adheres to."), + .describe('Identifies the schema that data adheres to.'), subject: z .string() .min(1) - - .describe("Describes the subject of the event in the context of the event producer (identified by source)."), + .describe( + 'Describes the subject of the event in the context of the event producer (identified by source).', + ), time: z .union([dateTime, z.null()]) .optional() - - .describe("Timestamp of when the occurrence happened. Must adhere to RFC 3339."), + .describe( + 'Timestamp of when the occurrence happened. Must adhere to RFC 3339.', + ), data: z .union([z.record(z.string(), z.unknown()), z.null()]) .optional() - - .describe("The event payload. Optional, if present it must be a JSON object."), + .describe( + 'The event payload. Optional, if present it must be a JSON object.', + ), }) - .describe("Metering event following the CloudEvents specification."); + .describe('Metering event following the CloudEvents specification.') export const meterQueryRow = z .object({ @@ -1335,50 +1444,59 @@ export const meterQueryRow = z to: dateTime, dimensions: z .record(z.string(), z.string()) - - .describe("The dimensions the value is aggregated over. `subject` and `customer_id` are reserved dimensions."), + .describe( + 'The dimensions the value is aggregated over. `subject` and `customer_id` are reserved dimensions.', + ), }) - .describe("A row in the result of a meter query."); + .describe('A row in the result of a meter query.') export const createStripeCustomerPortalSessionResult = z .object({ id: z .string() - - .describe("The ID of the customer portal session. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-id"), - stripe_customer_id: z.string().describe("The ID of the stripe customer."), + .describe( + 'The ID of the customer portal session. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-id', + ), + stripe_customer_id: z.string().describe('The ID of the stripe customer.'), configuration_id: z .string() - - .describe("Configuration used to customize the customer portal. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-configuration"), + .describe( + 'Configuration used to customize the customer portal. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-configuration', + ), livemode: z .boolean() - - .describe("Livemode. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-livemode"), + .describe( + 'Livemode. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-livemode', + ), created_at: dateTime, return_url: z .string() - - .describe("Return URL. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-return_url"), + .describe( + 'Return URL. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-return_url', + ), locale: z .string() - - .describe("The IETF language tag of the locale customer portal is displayed in. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-locale"), + .describe( + 'The IETF language tag of the locale customer portal is displayed in. See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-locale', + ), url: z .string() - - .describe("The URL to redirect the customer to after they have completed their requested actions."), + .describe( + 'The URL to redirect the customer to after they have completed their requested actions.', + ), }) - - .describe("Result of creating a [Stripe Customer Portal Session](https://docs.stripe.com/api/customer_portal/sessions/object). Contains all the information needed to redirect the customer to the Stripe Customer Portal."); + .describe( + 'Result of creating a [Stripe Customer Portal Session](https://docs.stripe.com/api/customer_portal/sessions/object). Contains all the information needed to redirect the customer to the Stripe Customer Portal.', + ) export const closedPeriod = z .object({ from: dateTime, to: dateTime, }) - - .describe("A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end."); + .describe( + 'A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end.', + ) export const costBasis = z .object({ @@ -1388,7 +1506,7 @@ export const costBasis = z effective_from: dateTime.optional(), created_at: dateTime, }) - .describe("Describes currency basis supported by billing system."); + .describe('Describes currency basis supported by billing system.') export const createRequest = z .object({ @@ -1396,29 +1514,32 @@ export const createRequest = z rate: numeric, effective_from: dateTime.optional(), }) - .describe("CostBasis create request."); + .describe('CostBasis create request.') export const featureCostQueryRow = z .object({ usage: numeric, cost: z .union([numeric, z.null()]) - - .describe("The computed cost amount (usage × unit cost). Null when pricing is not available for the given combination of dimensions."), + .describe( + 'The computed cost amount (usage × unit cost). Null when pricing is not available for the given combination of dimensions.', + ), currency: currencyCode, detail: z .string() .optional() - - .describe("Detail message when cost amount is null, explaining why the cost could not be resolved."), + .describe( + 'Detail message when cost amount is null, explaining why the cost could not be resolved.', + ), from: dateTime, to: dateTime, dimensions: z .record(z.string(), z.string()) - - .describe("The dimensions the value is aggregated over. `subject` and `customer_id` are reserved dimensions."), + .describe( + 'The dimensions the value is aggregated over. `subject` and `customer_id` are reserved dimensions.', + ), }) - .describe("A row in the result of a feature cost query."); + .describe('A row in the result of a feature cost query.') export const resource = z .object({ @@ -1427,19 +1548,20 @@ export const resource = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), }) - .describe("Represents common fields of resources."); + .describe('Represents common fields of resources.') export const resourceImmutable = z .object({ @@ -1448,17 +1570,18 @@ export const resourceImmutable = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, }) - .describe("Represents common fields of immutable resources."); + .describe('Represents common fields of immutable resources.') export const queryFilterDateTime = z .object({ @@ -1466,27 +1589,32 @@ export const queryFilterDateTime = z gte: dateTime.optional(), lt: dateTime.optional(), lte: dateTime.optional(), - get and() { return z - .array(queryFilterDateTime) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical AND."); }, - get or() { return z - .array(queryFilterDateTime) - .min(1) - .max(10) - .optional() - .describe("Combines the provided filters with a logical OR."); }, + get and() { + return z + .array(queryFilterDateTime) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical AND.') + }, + get or() { + return z + .array(queryFilterDateTime) + .min(1) + .max(10) + .optional() + .describe('Combines the provided filters with a logical OR.') + }, }) - - .describe("A query filter for a time attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for a time attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const cursorMeta = z .object({ page: cursorMetaPage, }) - .describe("Cursor pagination metadata."); + .describe('Cursor pagination metadata.') export const upsertRequest = z .object({ @@ -1494,23 +1622,25 @@ export const upsertRequest = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), from_plan_phase: resourceKey, max_quantity: z .bigint() .gte(1n) .optional() - - .describe("The maximum number of times the add-on can be purchased for the plan. For single-instance add-ons this field must be omitted. For multi-instance add-ons when omitted, unlimited quantity can be purchased."), + .describe( + 'The maximum number of times the add-on can be purchased for the plan. For single-instance add-ons this field must be omitted. For multi-instance add-ons when omitted, unlimited quantity can be purchased.', + ), }) - .describe("PlanAddon upsert request."); + .describe('PlanAddon upsert request.') export const resourceWithKey = z .object({ @@ -1519,24 +1649,25 @@ export const resourceWithKey = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), key: resourceKey, }) - .describe("Represents common fields of resources with a key."); + .describe('Represents common fields of resources with a key.') export const ulidOrResourceKey = z .union([ulid, resourceKey]) - .describe("ULID ID or Resource Key."); + .describe('ULID ID or Resource Key.') export const createRequest_2 = z .object({ @@ -1544,34 +1675,37 @@ export const createRequest_2 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, aggregation: meterAggregation, event_type: z .string() .min(1) - .describe("The event type to include in the aggregation."), + .describe('The event type to include in the aggregation.'), events_from: dateTime.optional(), value_property: z .string() .min(1) .optional() - - .describe("JSONPath expression to extract the value from the ingested event's data property. The ingested value for sum, avg, min, and max aggregations is a number or a string that can be parsed to a number. For unique_count aggregation, the ingested value must be a string. For count aggregation the value_property is ignored."), + .describe( + "JSONPath expression to extract the value from the ingested event's data property. The ingested value for sum, avg, min, and max aggregations is a number or a string that can be parsed to a number. For unique_count aggregation, the ingested value must be a string. For count aggregation the value_property is ignored.", + ), dimensions: z .record(z.string(), z.string()) .optional() - - .describe("Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters."), + .describe( + 'Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters.', + ), }) - .describe("Meter create request."); + .describe('Meter create request.') export const meter = z .object({ @@ -1580,13 +1714,14 @@ export const meter = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -1596,75 +1731,79 @@ export const meter = z event_type: z .string() .min(1) - .describe("The event type to include in the aggregation."), + .describe('The event type to include in the aggregation.'), events_from: dateTime.optional(), value_property: z .string() .min(1) .optional() - - .describe("JSONPath expression to extract the value from the ingested event's data property. The ingested value for sum, avg, min, and max aggregations is a number or a string that can be parsed to a number. For unique_count aggregation, the ingested value must be a string. For count aggregation the value_property is ignored."), + .describe( + "JSONPath expression to extract the value from the ingested event's data property. The ingested value for sum, avg, min, and max aggregations is a number or a string that can be parsed to a number. For unique_count aggregation, the ingested value must be a string. For count aggregation the value_property is ignored.", + ), dimensions: z .record(z.string(), z.string()) .optional() - - .describe("Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters."), + .describe( + 'Named JSONPath expressions to extract the group by values from the event data. Keys must be unique and consist only alphanumeric and underscore characters.', + ), }) - - .describe("A meter is a configuration that defines how to match and aggregate events."); + .describe( + 'A meter is a configuration that defines how to match and aggregate events.', + ) export const pageMeta = z .object({ page: pagePaginatedMeta, }) - .describe("Pagination metadata."); + .describe('Pagination metadata.') export const queryFilterStringMapItem = z .object({ - exists: z.boolean().optional().describe("The attribute exists."), + exists: z.boolean().optional().describe('The attribute exists.'), eq: z .string() .optional() - .describe("The attribute equals the provided value."), + .describe('The attribute equals the provided value.'), neq: z .string() .optional() - .describe("The attribute does not equal the provided value."), + .describe('The attribute does not equal the provided value.'), in: z .array(z.string()) .min(1) .max(100) .optional() - .describe("The attribute is one of the provided values."), + .describe('The attribute is one of the provided values.'), nin: z .array(z.string()) .min(1) .max(100) .optional() - .describe("The attribute is not one of the provided values."), + .describe('The attribute is not one of the provided values.'), contains: z .string() .optional() - .describe("The attribute contains the provided value."), + .describe('The attribute contains the provided value.'), ncontains: z .string() .optional() - .describe("The attribute does not contain the provided value."), + .describe('The attribute does not contain the provided value.'), and: z .array(queryFilterString) .min(1) .max(10) .optional() - .describe("Combines the provided filters with a logical AND."), + .describe('Combines the provided filters with a logical AND.'), or: z .array(queryFilterString) .min(1) .max(10) .optional() - .describe("Combines the provided filters with a logical OR."), + .describe('Combines the provided filters with a logical OR.'), }) - - .describe("A query filter for an item in a string map attribute. Operators are mutually exclusive, only one operator is allowed at a time."); + .describe( + 'A query filter for an item in a string map attribute. Operators are mutually exclusive, only one operator is allowed at a time.', + ) export const subscriptionCreate = z .object({ @@ -1674,7 +1813,7 @@ export const subscriptionCreate = z id: ulid.optional(), key: externalResourceKey.optional(), }) - .describe("The customer to create the subscription for."), + .describe('The customer to create the subscription for.'), plan: z .object({ id: ulid.optional(), @@ -1682,79 +1821,84 @@ export const subscriptionCreate = z version: z .bigint() .optional() - - .describe("The plan version of the subscription, if any. If not provided, the latest version of the plan will be used."), + .describe( + 'The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.', + ), }) - .describe("The plan reference of the subscription."), + .describe('The plan reference of the subscription.'), billing_anchor: dateTime.optional(), }) - .describe("Subscription create request."); + .describe('Subscription create request.') export const ulidOrExternalResourceKey = z .union([ulid, externalResourceKey]) - .describe("ULID ID or External Resource Key."); + .describe('ULID ID or External Resource Key.') export const customerKeyReference = z .object({ key: externalResourceKey, }) - .describe("Customer reference by external key."); + .describe('Customer reference by external key.') export const customerUsageAttribution = z .object({ subject_keys: z .array(usageAttributionSubjectKey) - - .describe("The subjects that are attributed to the customer. Can be empty when no usage event subjects are associated with the customer."), + .describe( + 'The subjects that are attributed to the customer. Can be empty when no usage event subjects are associated with the customer.', + ), }) - - .describe("Mapping to attribute metered usage to the customer. One customer can have zero or more subjects, but one subject can only belong to one customer."); + .describe( + 'Mapping to attribute metered usage to the customer. One customer can have zero or more subjects, but one subject can only belong to one customer.', + ) export const address = z .object({ country: countryCode.optional(), - postal_code: z.string().optional().describe("Postal code."), - state: z.string().optional().describe("State or province."), - city: z.string().optional().describe("City."), - line1: z.string().optional().describe("First line of the address."), - line2: z.string().optional().describe("Second line of the address."), - phone_number: z.string().optional().describe("Phone number."), + postal_code: z.string().optional().describe('Postal code.'), + state: z.string().optional().describe('State or province.'), + city: z.string().optional().describe('City.'), + line1: z.string().optional().describe('First line of the address.'), + line2: z.string().optional().describe('Second line of the address.'), + phone_number: z.string().optional().describe('Phone number.'), }) - .describe("Address"); + .describe('Address') export const address_2 = z .object({ country: countryCode.optional(), - postal_code: z.string().optional().describe("Postal code."), - state: z.string().optional().describe("State or province."), - city: z.string().optional().describe("City."), - line1: z.string().optional().describe("First line of the address."), - line2: z.string().optional().describe("Second line of the address."), - phone_number: z.string().optional().describe("Phone number."), + postal_code: z.string().optional().describe('Postal code.'), + state: z.string().optional().describe('State or province.'), + city: z.string().optional().describe('City.'), + line1: z.string().optional().describe('First line of the address.'), + line2: z.string().optional().describe('Second line of the address.'), + phone_number: z.string().optional().describe('Phone number.'), }) - .describe("Address"); + .describe('Address') export const createStripeCheckoutSessionCustomerUpdate = z .object({ address: createStripeCheckoutSessionCustomerUpdateBehavior .optional() - .default("never"), + .default('never'), name: createStripeCheckoutSessionCustomerUpdateBehavior .optional() - .default("never"), + .default('never'), shipping: createStripeCheckoutSessionCustomerUpdateBehavior .optional() - .default("never"), + .default('never'), }) + .describe( + 'Controls which customer fields can be updated by the checkout session.', + ) - .describe("Controls which customer fields can be updated by the checkout session."); - -export const createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreement = z - .object({ - position: createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition - .optional(), - }) - .describe("Payment method reuse agreement configuration."); +export const createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreement = + z + .object({ + position: + createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition.optional(), + }) + .describe('Payment method reuse agreement configuration.') export const createCheckoutSessionTaxIdCollection = z .object({ @@ -1762,32 +1906,35 @@ export const createCheckoutSessionTaxIdCollection = z .boolean() .optional() .default(false) - .describe("Enable tax ID collection during checkout. Defaults to false."), + .describe('Enable tax ID collection during checkout. Defaults to false.'), required: createCheckoutSessionTaxIdCollectionRequired .optional() - .default("never"), + .default('never'), }) - .describe("Tax ID collection configuration for checkout sessions."); + .describe('Tax ID collection configuration for checkout sessions.') export const createStripeCheckoutSessionResult = z .object({ customer_id: ulid, - stripe_customer_id: z.string().describe("The Stripe customer ID."), - session_id: z.string().describe("The Stripe checkout session ID."), + stripe_customer_id: z.string().describe('The Stripe customer ID.'), + session_id: z.string().describe('The Stripe checkout session ID.'), setup_intent_id: z .string() - - .describe("The setup intent ID created for collecting the payment method."), + .describe( + 'The setup intent ID created for collecting the payment method.', + ), client_secret: z .string() .optional() - - .describe("Client secret for initializing Stripe.js on the client side. Required for embedded checkout sessions. See: https://docs.stripe.com/payments/checkout/custom-success-page"), + .describe( + 'Client secret for initializing Stripe.js on the client side. Required for embedded checkout sessions. See: https://docs.stripe.com/payments/checkout/custom-success-page', + ), client_reference_id: z .string() .optional() - - .describe("The client reference ID provided in the request. Useful for reconciling the session with your internal systems."), + .describe( + 'The client reference ID provided in the request. Useful for reconciling the session with your internal systems.', + ), customer_email: z .string() .optional() @@ -1798,42 +1945,48 @@ export const createStripeCheckoutSessionResult = z metadata: z .record(z.string(), z.string()) .optional() - .describe("Metadata attached to the checkout session."), + .describe('Metadata attached to the checkout session.'), status: z .string() .optional() - - .describe("The status of the checkout session. See: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-status"), + .describe( + 'The status of the checkout session. See: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-status', + ), url: z .string() .optional() - - .describe("URL to redirect customers to the checkout page (for hosted mode)."), + .describe( + 'URL to redirect customers to the checkout page (for hosted mode).', + ), mode: stripeCheckoutSessionMode, cancel_url: z .string() .optional() - - .describe("The cancel URL where customers are redirected if they cancel."), + .describe( + 'The cancel URL where customers are redirected if they cancel.', + ), success_url: z .string() .optional() - - .describe("The success URL where customers are redirected after completion."), + .describe( + 'The success URL where customers are redirected after completion.', + ), return_url: z .string() .optional() - .describe("The return URL for embedded sessions after authentication."), + .describe('The return URL for embedded sessions after authentication.'), }) - - .describe("Result of creating a Stripe Checkout Session. Contains all the information needed to redirect customers to the checkout or initialize an embedded checkout flow."); + .describe( + 'Result of creating a Stripe Checkout Session. Contains all the information needed to redirect customers to the checkout or initialize an embedded checkout flow.', + ) export const customerBillingStripeCreateCustomerPortalSessionRequest = z .object({ stripe_options: createStripeCustomerPortalSessionOptions, }) - - .describe("Request to create a Stripe Customer Portal Session for the customer. Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods, change their billing address and access their invoice history. Only returns URL if the customer billing profile is linked to a stripe app and customer."); + .describe( + 'Request to create a Stripe Customer Portal Session for the customer. Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods, change their billing address and access their invoice history. Only returns URL if the customer billing profile is linked to a stripe app and customer.', + ) export const entitlementAccessResult = z .object({ @@ -1841,35 +1994,38 @@ export const entitlementAccessResult = z feature_key: resourceKey, has_access: z .boolean() - - .describe("Whether the customer has access to the feature. Always true for `boolean` and `static` entitlements. Depends on balance for `metered` entitlements."), + .describe( + 'Whether the customer has access to the feature. Always true for `boolean` and `static` entitlements. Depends on balance for `metered` entitlements.', + ), config: z .string() .optional() - - .describe("Only available for static entitlements. Config is the JSON parsable configuration of the entitlement. Useful to describe per customer configuration."), + .describe( + 'Only available for static entitlements. Config is the JSON parsable configuration of the entitlement. Useful to describe per customer configuration.', + ), }) - .describe("Entitlement access result."); + .describe('Entitlement access result.') export const updateCreditGrantExternalSettlementRequest = z .object({ status: creditPurchasePaymentSettlementStatus, }) - - .describe("Request body for updating the external payment settlement status of a credit grant."); + .describe( + 'Request body for updating the external payment settlement status of a credit grant.', + ) export const listCreditGrantsParamsFilter = z .object({ status: creditGrantStatus.optional(), currency: currencyCode.optional(), }) - .describe("Filter options for listing credit grants."); + .describe('Filter options for listing credit grants.') export const listCustomerChargesParamsFilter = z .object({ status: stringFieldFilterExact.optional(), }) - .describe("Filter options for listing charges."); + .describe('Filter options for listing charges.') export const listPlansParamsFilter = z .object({ @@ -1878,13 +2034,13 @@ export const listPlansParamsFilter = z status: stringFieldFilterExact.optional(), currency: stringFieldFilterExact.optional(), }) - .describe("Filter options for listing plans."); + .describe('Filter options for listing plans.') export const prorationConfiguration = z .object({ mode: prorationMode, }) - .describe("The proration configuration of the rate card."); + .describe('The proration configuration of the rate card.') export const subscription = z .object({ @@ -1898,85 +2054,87 @@ export const subscription = z billing_anchor: dateTime, status: subscriptionStatus, }) - .describe("Subscription."); + .describe('Subscription.') export const subscriptionEditTiming = z .union([subscriptionEditTimingEnum, dateTime]) - - .describe("Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned."); + .describe( + 'Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned.', + ) export const appCatalogItem = z .object({ type: appType, - name: z.string().describe("Name of the app."), - description: z.string().describe("Description of the app."), + name: z.string().describe('Name of the app.'), + description: z.string().describe('Description of the app.'), }) - - .describe("Available apps for billing integrations to connect with third-party services. Apps can have various capabilities like syncing data from or to external systems, integrating with third-party services for tax calculation, delivery of invoices, collection of payments, etc."); + .describe( + 'Available apps for billing integrations to connect with third-party services. Apps can have various capabilities like syncing data from or to external systems, integrating with third-party services for tax calculation, delivery of invoices, collection of payments, etc.', + ) export const taxCodeAppMapping = z .object({ app_type: appType, - tax_code: z.string().describe("Tax code."), + tax_code: z.string().describe('Tax code.'), }) - .describe("Mapping of app types to tax codes."); + .describe('Mapping of app types to tax codes.') export const billingPartyTaxIdentity = z .object({ code: taxIdentificationCode.optional(), }) - - .describe("Identity stores the details required to identify an entity for tax purposes in a specific country."); + .describe( + 'Identity stores the details required to identify an entity for tax purposes in a specific country.', + ) export const recurringPeriod = z .object({ anchor: dateTime, interval: iso8601Duration, }) - .describe("Recurring period with an anchor and an interval."); + .describe('Recurring period with an anchor and an interval.') export const billingWorkflowPaymentSettings = z - .discriminatedUnion( - "collection_method", - [ - billingWorkflowPaymentChargeAutomaticallySettings, - billingWorkflowPaymentSendInvoiceSettings - ] - ) - .describe("Payment settings for a billing workflow."); + .discriminatedUnion('collection_method', [ + billingWorkflowPaymentChargeAutomaticallySettings, + billingWorkflowPaymentSendInvoiceSettings, + ]) + .describe('Payment settings for a billing workflow.') export const listCurrenciesParamsFilter = z .object({ type: currencyType.optional(), }) - .describe("Filter options for listing currencies."); + .describe('Filter options for listing currencies.') export const currencyCustom = z .object({ id: ulid, - type: z.literal("custom").describe("The type of the currency."), + type: z.literal('custom').describe('The type of the currency.'), name: z .string() .min(1) .max(256) - - .describe("The name of the currency. It should be a human-readable string that represents the name of the currency, such as \"US Dollar\" or \"Euro\"."), + .describe( + 'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".', + ), description: z .string() .min(1) .max(256) .optional() - .describe("Description of the currency."), + .describe('Description of the currency.'), symbol: z .string() .min(1) .optional() - - .describe("The symbol of the currency. It should be a string that represents the symbol of the currency, such as \"$\" for US Dollar or \"€\" for Euro."), + .describe( + 'The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.', + ), code: currencyCodeCustom, created_at: dateTime, }) - .describe("Describes custom currency."); + .describe('Describes custom currency.') export const createRequest_3 = z .object({ @@ -1984,23 +2142,25 @@ export const createRequest_3 = z .string() .min(1) .max(256) - - .describe("The name of the currency. It should be a human-readable string that represents the name of the currency, such as \"US Dollar\" or \"Euro\"."), + .describe( + 'The name of the currency. It should be a human-readable string that represents the name of the currency, such as "US Dollar" or "Euro".', + ), description: z .string() .min(1) .max(256) .optional() - .describe("Description of the currency."), + .describe('Description of the currency.'), symbol: z .string() .min(1) .optional() - - .describe("The symbol of the currency. It should be a string that represents the symbol of the currency, such as \"$\" for US Dollar or \"€\" for Euro."), + .describe( + 'The symbol of the currency. It should be a string that represents the symbol of the currency, such as "$" for US Dollar or "€" for Euro.', + ), code: currencyCodeCustom, }) - .describe("CurrencyCustom create request."); + .describe('CurrencyCustom create request.') export const governanceQueryRequest = z .object({ @@ -2008,74 +2168,80 @@ export const governanceQueryRequest = z .boolean() .optional() .default(false) - - .describe("Whether to include credit balance availability for each resolved customer. When true, each feature evaluation includes credit balance checks. Defaults to `false`."), + .describe( + 'Whether to include credit balance availability for each resolved customer. When true, each feature evaluation includes credit balance checks. Defaults to `false`.', + ), customer: governanceQueryRequestCustomers, feature: governanceQueryRequestFeatures.optional(), }) - .describe("Query to evaluate feature access for a list of customers."); + .describe('Query to evaluate feature access for a list of customers.') export const governanceFeatureAccessReason = z .object({ code: governanceFeatureAccessReasonCode, - message: z.string().describe("Human-readable description of the error."), + message: z.string().describe('Human-readable description of the error.'), attributes: z .record(z.string(), z.unknown()) .optional() - .describe("Additional structured context."), + .describe('Additional structured context.'), }) - .describe("Reason a feature is not accessible to a customer."); + .describe('Reason a feature is not accessible to a customer.') export const governanceQueryError = z .object({ code: governanceQueryErrorCode, - message: z.string().describe("Human-readable description of the error."), + message: z.string().describe('Human-readable description of the error.'), attributes: z .record(z.string(), z.unknown()) .optional() - .describe("Additional structured context."), + .describe('Additional structured context.'), customer: z .string() .optional() - - .describe("The customer identifier from the request that produced this error."), + .describe( + 'The customer identifier from the request that produced this error.', + ), }) - - .describe("Query error within a partially successful governance query response."); + .describe( + 'Query error within a partially successful governance query response.', + ) export const unitConfig = z .object({ operation: unitConfigOperation, conversion_factor: numeric, - rounding: unitConfigRoundingMode.optional().default("none"), + rounding: unitConfigRoundingMode.optional().default('none'), precision: z .bigint() .optional() .default(0n) - - .describe("The number of decimal places to retain after rounding. Only meaningful when rounding is not \"none\". Defaults to 0 (round to whole numbers)."), + .describe( + 'The number of decimal places to retain after rounding. Only meaningful when rounding is not "none". Defaults to 0 (round to whole numbers).', + ), display_unit: z .string() .optional() - - .describe("A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., \"GB\", \"hours\", \"M tokens\"). Optional. When omitted, no unit label is rendered."), + .describe( + 'A human-readable label for the converted unit shown on invoices and in the customer portal (e.g., "GB", "hours", "M tokens"). Optional. When omitted, no unit label is rendered.', + ), }) - - .describe("Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit=\"GB\" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit=\"hours\" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit=\"M\" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)"); + .describe( + 'Unit conversion configuration. Transforms raw metered quantities into billing-ready units before pricing and entitlement evaluation. Applied at the rate card level so the same feature can be billed in different units across plans. Examples: - Meter bytes, bill GB: operation=divide, conversionFactor=1e9, rounding=ceiling, displayUnit="GB" - Meter seconds, bill hours: operation=divide, conversionFactor=3600, rounding=ceiling, displayUnit="hours" - Cost + 20% margin: operation=multiply, conversionFactor=1.2 - Bill per million tokens: operation=divide, conversionFactor=1e6, rounding=ceiling, displayUnit="M" v1 equivalents: - DynamicPrice(multiplier): operation=multiply, conversionFactor=multiplier + UnitPrice(amount=1) - PackagePrice(amount, quantityPerPkg): operation=divide, conversionFactor=quantityPerPkg, rounding=ceiling + UnitPrice(amount)', + ) export const appCustomerData = z .object({ stripe: appCustomerDataStripe.optional(), external_invoicing: appCustomerDataExternalInvoicing.optional(), }) - .describe("App customer data."); + .describe('App customer data.') export const upsertRequest_2 = z .object({ stripe: appCustomerDataStripe.optional(), external_invoicing: appCustomerDataExternalInvoicing.optional(), }) - .describe("AppCustomerData upsert request."); + .describe('AppCustomerData upsert request.') export const creditAdjustment = z .object({ @@ -2083,25 +2249,27 @@ export const creditAdjustment = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), currency: currencyCode_2, amount: numeric, }) - - .describe("A credit adjustment can be used to make manual adjustments to a customer's credit balance. Supported use-cases: - Usage correction"); + .describe( + "A credit adjustment can be used to make manual adjustments to a customer's credit balance. Supported use-cases: - Usage correction", + ) export const getCreditBalanceParamsFilter = z .object({ currency: currencyCode_2.optional(), }) - .describe("Filter options for getting a credit balance."); + .describe('Filter options for getting a credit balance.') export const creditBalance = z .object({ @@ -2109,7 +2277,7 @@ export const creditBalance = z pending: numeric, available: numeric, }) - .describe("The credit balance by currency."); + .describe('The credit balance by currency.') export const createRequest_4 = z .object({ @@ -2117,25 +2285,26 @@ export const createRequest_4 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), currency: currencyCode_2, amount: numeric, }) - .describe("CreditAdjustment create request."); + .describe('CreditAdjustment create request.') export const listCreditTransactionsParamsFilter = z .object({ type: creditTransactionType.optional(), currency: currencyCode_2.optional(), }) - .describe("Filter options for listing credit transactions."); + .describe('Filter options for listing credit transactions.') export const creditTransaction = z .object({ @@ -2144,13 +2313,14 @@ export const creditTransaction = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, booked_at: dateTime, @@ -2162,10 +2332,11 @@ export const creditTransaction = z before: numeric, after: numeric, }) - .describe("The available balance before and after the transaction."), + .describe('The available balance before and after the transaction.'), }) - - .describe("A credit transaction represents a single credit movement on the customer's balance. Credit transactions are immutable."); + .describe( + "A credit transaction represents a single credit movement on the customer's balance. Credit transactions are immutable.", + ) export const priceTier = z .object({ @@ -2173,52 +2344,60 @@ export const priceTier = z flat_price: priceFlat.optional(), unit_price: priceUnit.optional(), }) - - .describe("A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the rate card, up_to_amount is expressed in converted billing units."); + .describe( + 'A price tier used in graduated and volume pricing. At least one price component (flat_price or unit_price) must be set. When UnitConfig is present on the rate card, up_to_amount is expressed in converted billing units.', + ) export const chargeTotals = z .object({ booked: billingTotals, realtime: billingTotals.optional(), }) - - .describe("The totals of a change. RealTime is only expanded when the `real_time_usage` expand is used."); + .describe( + 'The totals of a change. RealTime is only expanded when the `real_time_usage` expand is used.', + ) export const featureLlmUnitCost = z .object({ type: z - .literal("llm") - .describe("The type discriminator for LLM unit cost."), + .literal('llm') + .describe('The type discriminator for LLM unit cost.'), provider_property: z .string() .optional() - - .describe("Meter group-by property that holds the LLM provider. Use this when the meter has a group-by dimension for provider. Mutually exclusive with `provider`."), + .describe( + 'Meter group-by property that holds the LLM provider. Use this when the meter has a group-by dimension for provider. Mutually exclusive with `provider`.', + ), provider: z .string() .optional() - - .describe("Static LLM provider value (e.g., \"openai\", \"anthropic\"). Use this when the feature tracks a single provider. Mutually exclusive with `provider_property`."), + .describe( + 'Static LLM provider value (e.g., "openai", "anthropic"). Use this when the feature tracks a single provider. Mutually exclusive with `provider_property`.', + ), model_property: z .string() .optional() - - .describe("Meter group-by property that holds the model ID. Use this when the meter has a group-by dimension for model. Mutually exclusive with `model`."), + .describe( + 'Meter group-by property that holds the model ID. Use this when the meter has a group-by dimension for model. Mutually exclusive with `model`.', + ), model: z .string() .optional() - - .describe("Static model ID value (e.g., \"gpt-4\", \"claude-3-5-sonnet\"). Use this when the feature tracks a single model. Mutually exclusive with `model_property`."), + .describe( + 'Static model ID value (e.g., "gpt-4", "claude-3-5-sonnet"). Use this when the feature tracks a single model. Mutually exclusive with `model_property`.', + ), token_type_property: z .string() .optional() - - .describe("Meter group-by property that holds the token type. Use this when the meter has a group-by dimension for token type. Mutually exclusive with `token_type`."), + .describe( + 'Meter group-by property that holds the token type. Use this when the meter has a group-by dimension for token type. Mutually exclusive with `token_type`.', + ), token_type: featureLlmTokenType.optional(), pricing: featureLlmUnitCostPricing.optional(), }) - - .describe("LLM cost lookup configuration. Each dimension (provider, model, token type) can be specified as either a static value or a meter group-by property name (mutually exclusive)."); + .describe( + 'LLM cost lookup configuration. Each dimension (provider, model, token type) can be specified as either a static value or a meter group-by property name (mutually exclusive).', + ) export const price = z .object({ @@ -2233,21 +2412,23 @@ export const price = z created_at: dateTime, updated_at: dateTime, }) - - .describe("An LLM cost price record, representing the cost per token for a specific model from a specific provider."); + .describe( + 'An LLM cost price record, representing the cost per token for a specific model from a specific provider.', + ) export const overrideCreate = z .object({ - provider: z.string().describe("Provider/vendor of the model."), - model_id: z.string().describe("Canonical model identifier."), - model_name: z.string().optional().describe("Human-readable model name."), + provider: z.string().describe('Provider/vendor of the model.'), + model_id: z.string().describe('Canonical model identifier.'), + model_name: z.string().optional().describe('Human-readable model name.'), pricing: modelPricing, currency: currencyCode, effective_from: dateTime, effective_to: dateTime.optional(), }) - - .describe("Input for creating a per-namespace price override. Unique per provider, model and currency. If an override already exists for the given provider, model and currency, it will be updated. If an override does not exist, it will be created."); + .describe( + 'Input for creating a per-namespace price override. Unique per provider, model and currency. If an override already exists for the given provider, model and currency, it will be updated. If an override does not exist, it will be created.', + ) export const listCustomersParamsFilter = z .object({ @@ -2258,7 +2439,7 @@ export const listCustomersParamsFilter = z plan_key: stringFieldFilter.optional(), billing_profile_id: ulidFieldFilter.optional(), }) - .describe("Filter options for listing customers."); + .describe('Filter options for listing customers.') export const listSubscriptionsParamsFilter = z .object({ @@ -2268,7 +2449,7 @@ export const listSubscriptionsParamsFilter = z plan_id: ulidFieldFilter.optional(), plan_key: stringFieldFilterExact.optional(), }) - .describe("Filter options for listing subscriptions."); + .describe('Filter options for listing subscriptions.') export const listFeaturesParamsFilter = z .object({ @@ -2276,7 +2457,7 @@ export const listFeaturesParamsFilter = z key: stringFieldFilter.optional(), name: stringFieldFilter.optional(), }) - .describe("Filter options for listing features."); + .describe('Filter options for listing features.') export const listAddonsParamsFilter = z .object({ @@ -2286,18 +2467,18 @@ export const listAddonsParamsFilter = z status: stringFieldFilterExact.optional(), currency: stringFieldFilterExact.optional(), }) - .describe("Filter options for listing add-ons."); + .describe('Filter options for listing add-ons.') export const taxCodeReference = resourceReference_2 .merge(z.object({})) - .describe("Reference to a tax code."); + .describe('Reference to a tax code.') export const rateCardTaxConfig = z .object({ behavior: taxBehavior.optional(), code: resourceReference_2, }) - .describe("The tax config of the rate card."); + .describe('The tax config of the rate card.') export const organizationDefaultTaxCodes = z .object({ @@ -2306,15 +2487,16 @@ export const organizationDefaultTaxCodes = z created_at: dateTime, updated_at: dateTime, }) - - .describe("Organization-level default tax code references. Stores the default tax codes applied to specific billing contexts for this organization. Provisioned automatically when the organization is created."); + .describe( + 'Organization-level default tax code references. Stores the default tax codes applied to specific billing contexts for this organization. Provisioned automatically when the organization is created.', + ) export const updateRequest_2 = z .object({ invoicing_tax_code: resourceReference_2.optional(), credit_grant_tax_code: resourceReference_2.optional(), }) - .describe("OrganizationDefaultTaxCodes update request."); + .describe('OrganizationDefaultTaxCodes update request.') export const subscriptionAddon = z .object({ @@ -2323,13 +2505,14 @@ export const subscriptionAddon = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -2338,13 +2521,14 @@ export const subscriptionAddon = z quantity: z .bigint() .gte(1n) - - .describe("The quantity of the add-on. Always 1 for single instance add-ons."), + .describe( + 'The quantity of the add-on. Always 1 for single instance add-ons.', + ), quantity_at: dateTime, active_from: dateTime, active_to: dateTime.optional(), }) - .describe("Addon purchased with a subscription."); + .describe('Addon purchased with a subscription.') export const planAddon = z .object({ @@ -2353,13 +2537,14 @@ export const planAddon = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -2370,15 +2555,17 @@ export const planAddon = z .bigint() .gte(1n) .optional() - - .describe("The maximum number of times the add-on can be purchased for the plan. For single-instance add-ons this field must be omitted. For multi-instance add-ons when omitted, unlimited quantity can be purchased."), + .describe( + 'The maximum number of times the add-on can be purchased for the plan. For single-instance add-ons this field must be omitted. For multi-instance add-ons when omitted, unlimited quantity can be purchased.', + ), validation_errors: z .array(productCatalogValidationError) .optional() - .describe("List of validation errors."), + .describe('List of validation errors.'), }) - - .describe("PlanAddon represents an association between a plan and an add-on, controlling which add-ons are available for purchase within a plan."); + .describe( + 'PlanAddon represents an association between a plan and an add-on, controlling which add-ons are available for purchase within a plan.', + ) export const createRequest_5 = z .object({ @@ -2386,13 +2573,14 @@ export const createRequest_5 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), addon: resourceReference_3, from_plan_phase: resourceKey, @@ -2400,10 +2588,11 @@ export const createRequest_5 = z .bigint() .gte(1n) .optional() - - .describe("The maximum number of times the add-on can be purchased for the plan. For single-instance add-ons this field must be omitted. For multi-instance add-ons when omitted, unlimited quantity can be purchased."), + .describe( + 'The maximum number of times the add-on can be purchased for the plan. For single-instance add-ons this field must be omitted. For multi-instance add-ons when omitted, unlimited quantity can be purchased.', + ), }) - .describe("PlanAddon create request."); + .describe('PlanAddon create request.') export const billingProfileAppReferences = z .object({ @@ -2411,7 +2600,7 @@ export const billingProfileAppReferences = z invoicing: appReference, payment: appReference, }) - .describe("References to the applications used by a billing profile."); + .describe('References to the applications used by a billing profile.') export const listEventsParamsFilter = z .object({ @@ -2424,7 +2613,7 @@ export const listEventsParamsFilter = z ingested_at: dateTimeFieldFilter.optional(), stored_at: dateTimeFieldFilter.optional(), }) - .describe("Filter options for listing ingested events."); + .describe('Filter options for listing ingested events.') export const resourceFilters = z .object({ @@ -2435,7 +2624,7 @@ export const resourceFilters = z updated_at: dateTimeFieldFilter.optional(), deleted_at: dateTimeFieldFilter.optional(), }) - .describe("Resource filters."); + .describe('Resource filters.') export const fieldFilters = z .object({ @@ -2447,7 +2636,7 @@ export const fieldFilters = z datetime: dateTimeFieldFilter.optional(), labels: labelsFieldFilter.optional(), }) - .describe("Field filters with all supported types."); + .describe('Field filters with all supported types.') export const ingestedEvent = z .object({ @@ -2458,9 +2647,9 @@ export const ingestedEvent = z validation_errors: z .array(ingestedEventValidationError) .optional() - .describe("The validation errors of the ingested event."), + .describe('The validation errors of the ingested event.'), }) - .describe("An ingested metering event with ingestion metadata."); + .describe('An ingested metering event with ingestion metadata.') export const meterQueryResult = z .object({ @@ -2468,53 +2657,54 @@ export const meterQueryResult = z to: dateTime.optional(), data: z .array(meterQueryRow) - - .describe("The usage data. If no data is available, an empty array is returned."), + .describe( + 'The usage data. If no data is available, an empty array is returned.', + ), }) - .describe("Meter query result."); + .describe('Meter query result.') export const createResponse = z .object({ _: z.literal(201), body: createStripeCustomerPortalSessionResult, }) - .describe("CreateStripeCustomerPortalSessionResult created response."); + .describe('CreateStripeCustomerPortalSessionResult created response.') export const createResponse_2 = z .object({ _: z.literal(201), body: costBasis, }) - .describe("CostBasis created response."); + .describe('CostBasis created response.') export const featureCostQueryResult = z .object({ from: dateTime.optional(), to: dateTime.optional(), - data: z.array(featureCostQueryRow).describe("The cost data rows."), + data: z.array(featureCostQueryRow).describe('The cost data rows.'), }) - .describe("Result of a feature cost query."); + .describe('Result of a feature cost query.') export const createResponse_3 = z .object({ _: z.literal(201), body: meter, }) - .describe("Meter created response."); + .describe('Meter created response.') export const getResponse = z .object({ _: z.literal(200), body: meter, }) - .describe("Meter response."); + .describe('Meter response.') export const updateResponse = z .object({ _: z.literal(200), body: meter, }) - .describe("Meter updated response."); + .describe('Meter updated response.') export const pagePaginatedResponse = z .object({ @@ -2522,7 +2712,7 @@ export const pagePaginatedResponse = z data: z.array(meter), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const pagePaginatedResponse_2 = z .object({ @@ -2530,17 +2720,18 @@ export const pagePaginatedResponse_2 = z data: z.array(costBasis), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const meterQueryFilters = z .object({ dimensions: z .record(z.string(), queryFilterStringMapItem) .optional() - - .describe("Filters to apply to the dimensions of the query. For `subject` and `customer_id` only equals (\"eq\", \"in\") comparisons are supported."), + .describe( + 'Filters to apply to the dimensions of the query. For `subject` and `customer_id` only equals ("eq", "in") comparisons are supported.', + ), }) - .describe("Filters to apply to a meter query."); + .describe('Filters to apply to a meter query.') export const featureMeterReference = z .object({ @@ -2548,9 +2739,9 @@ export const featureMeterReference = z filters: z .record(z.string(), queryFilterStringMapItem) .optional() - .describe("Filters to apply to the dimensions of the meter."), + .describe('Filters to apply to the dimensions of the meter.'), }) - .describe("Reference to a meter associated with a feature."); + .describe('Reference to a meter associated with a feature.') export const createRequest_6 = z .object({ @@ -2558,24 +2749,25 @@ export const createRequest_6 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: externalResourceKey, usage_attribution: customerUsageAttribution.optional(), primary_email: z .string() .optional() - .describe("The primary email address of the customer."), + .describe('The primary email address of the customer.'), currency: currencyCode.optional(), billing_address: address.optional(), }) - .describe("Customer create request."); + .describe('Customer create request.') export const customer = z .object({ @@ -2584,13 +2776,14 @@ export const customer = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -2600,12 +2793,13 @@ export const customer = z primary_email: z .string() .optional() - .describe("The primary email address of the customer."), + .describe('The primary email address of the customer.'), currency: currencyCode.optional(), billing_address: address.optional(), }) - - .describe("Customers can be individuals or organizations that can subscribe to plans and have access to features."); + .describe( + 'Customers can be individuals or organizations that can subscribe to plans and have access to features.', + ) export const upsertRequest_3 = z .object({ @@ -2613,62 +2807,63 @@ export const upsertRequest_3 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), usage_attribution: customerUsageAttribution.optional(), primary_email: z .string() .optional() - .describe("The primary email address of the customer."), + .describe('The primary email address of the customer.'), currency: currencyCode.optional(), billing_address: address.optional(), }) - .describe("Customer upsert request."); + .describe('Customer upsert request.') export const billingPartyAddresses = z .object({ billing_address: address_2, }) - .describe("A collection of addresses for the party."); + .describe('A collection of addresses for the party.') export const createStripeCheckoutSessionConsentCollection = z .object({ - payment_method_reuse_agreement: createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreement - .optional(), - promotions: createStripeCheckoutSessionConsentCollectionPromotions - .optional(), - terms_of_service: createStripeCheckoutSessionConsentCollectionTermsOfService - .optional(), + payment_method_reuse_agreement: + createStripeCheckoutSessionConsentCollectionPaymentMethodReuseAgreement.optional(), + promotions: + createStripeCheckoutSessionConsentCollectionPromotions.optional(), + terms_of_service: + createStripeCheckoutSessionConsentCollectionTermsOfService.optional(), }) - .describe("Checkout Session consent collection configuration."); + .describe('Checkout Session consent collection configuration.') export const createResponse_4 = z .object({ _: z.literal(201), body: createStripeCheckoutSessionResult, }) - .describe("CreateStripeCheckoutSessionResult created response."); + .describe('CreateStripeCheckoutSessionResult created response.') export const listCustomerEntitlementAccessResponseData = z .object({ data: z .array(entitlementAccessResult) - .describe("The list of entitlement access results."), + .describe('The list of entitlement access results.'), }) - .describe("List customer entitlement access response data."); + .describe('List customer entitlement access response data.') export const createResponse_5 = z .object({ _: z.literal(201), body: subscription, }) - .describe("Subscription created response."); + .describe('Subscription created response.') export const pagePaginatedResponse_3 = z .object({ @@ -2676,34 +2871,34 @@ export const pagePaginatedResponse_3 = z data: z.array(subscription), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const getResponse_2 = z .object({ _: z.literal(200), body: subscription, }) - .describe("Subscription response."); + .describe('Subscription response.') export const updateResponse_2 = z .object({ _: z.literal(200), body: subscription, }) - .describe("Subscription updated response."); + .describe('Subscription updated response.') export const subscriptionChangeResponse = z .object({ current: subscription, next: subscription, }) - .describe("Response for changing a subscription."); + .describe('Response for changing a subscription.') export const subscriptionCancel = z .object({ - timing: subscriptionEditTiming.optional().default("immediate"), + timing: subscriptionEditTiming.optional().default('immediate'), }) - .describe("Request for canceling a subscription."); + .describe('Request for canceling a subscription.') export const subscriptionChange = z .object({ @@ -2713,7 +2908,7 @@ export const subscriptionChange = z id: ulid.optional(), key: externalResourceKey.optional(), }) - .describe("The customer to create the subscription for."), + .describe('The customer to create the subscription for.'), plan: z .object({ id: ulid.optional(), @@ -2721,14 +2916,15 @@ export const subscriptionChange = z version: z .bigint() .optional() - - .describe("The plan version of the subscription, if any. If not provided, the latest version of the plan will be used."), + .describe( + 'The plan version of the subscription, if any. If not provided, the latest version of the plan will be used.', + ), }) - .describe("The plan reference of the subscription."), + .describe('The plan reference of the subscription.'), billing_anchor: dateTime.optional(), timing: subscriptionEditTiming, }) - .describe("Request for changing a subscription."); + .describe('Request for changing a subscription.') export const appStripe = z .object({ @@ -2737,38 +2933,42 @@ export const appStripe = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), - type: z.literal("stripe").describe("The app type."), + type: z.literal('stripe').describe('The app type.'), definition: appCatalogItem, status: appStatus, account_id: z .string() - - .describe("The Stripe account ID associated with the connected Stripe account."), + .describe( + 'The Stripe account ID associated with the connected Stripe account.', + ), livemode: z .boolean() - - .describe("Indicates whether the app is connected to a live Stripe account."), + .describe( + 'Indicates whether the app is connected to a live Stripe account.', + ), masked_api_key: z .string() - - .describe("The masked Stripe API key that only exposes the first and last few characters."), + .describe( + 'The masked Stripe API key that only exposes the first and last few characters.', + ), secret_api_key: z .string() .optional() - .describe("The Stripe secret API key used to authenticate API requests."), + .describe('The Stripe secret API key used to authenticate API requests.'), }) - .describe("Stripe app."); + .describe('Stripe app.') export const appSandbox = z .object({ @@ -2777,22 +2977,23 @@ export const appSandbox = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), - type: z.literal("sandbox").describe("The app type."), + type: z.literal('sandbox').describe('The app type.'), definition: appCatalogItem, status: appStatus, }) - .describe("Sandbox app can be used for testing billing features."); + .describe('Sandbox app can be used for testing billing features.') export const appExternalInvoicing = z .object({ @@ -2801,31 +3002,35 @@ export const appExternalInvoicing = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), - type: z.literal("external_invoicing").describe("The app type."), + type: z.literal('external_invoicing').describe('The app type.'), definition: appCatalogItem, status: appStatus, enable_draft_sync_hook: z .boolean() - - .describe("Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing."), + .describe( + 'Enable draft synchronization hook. When enabled, invoices will pause at the draft state and wait for the integration to call the draft synchronized endpoint before progressing to the issuing state. This allows the external system to validate and prepare the invoice data. When disabled, invoices automatically progress through the draft state based on the configured workflow timing.', + ), enable_issuing_sync_hook: z .boolean() - - .describe("Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued."), + .describe( + 'Enable issuing synchronization hook. When enabled, invoices will pause at the issuing state and wait for the integration to call the issuing synchronized endpoint before progressing to the issued state. This ensures the external invoicing system has successfully created and finalized the invoice before it is marked as issued. When disabled, invoices automatically progress through the issuing state and are immediately marked as issued.', + ), }) - - .describe("External Invoicing app enables integration with third-party invoicing or payment system. The app supports a bi-directional synchronization pattern where OpenMeter Billing manages the invoice lifecycle while the external system handles invoice presentation and payment collection. Integration workflow: 1. The billing system creates invoices and transitions them through lifecycle states (draft → issuing → issued) 2. The integration receives webhook notifications about invoice state changes 3. The integration calls back to provide external system IDs and metadata 4. The integration reports payment events back via the payment status API State synchronization is controlled by hooks that pause invoice progression until the external system confirms synchronization via API callbacks."); + .describe( + 'External Invoicing app enables integration with third-party invoicing or payment system. The app supports a bi-directional synchronization pattern where OpenMeter Billing manages the invoice lifecycle while the external system handles invoice presentation and payment collection. Integration workflow: 1. The billing system creates invoices and transitions them through lifecycle states (draft → issuing → issued) 2. The integration receives webhook notifications about invoice state changes 3. The integration calls back to provide external system IDs and metadata 4. The integration reports payment events back via the payment status API State synchronization is controlled by hooks that pause invoice progression until the external system confirms synchronization via API callbacks.', + ) export const createRequest_7 = z .object({ @@ -2833,20 +3038,21 @@ export const createRequest_7 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, app_mappings: z .array(taxCodeAppMapping) - .describe("Mapping of app types to tax codes."), + .describe('Mapping of app types to tax codes.'), }) - .describe("TaxCode create request."); + .describe('TaxCode create request.') export const taxCode = z .object({ @@ -2855,13 +3061,14 @@ export const taxCode = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -2869,9 +3076,9 @@ export const taxCode = z key: resourceKey, app_mappings: z .array(taxCodeAppMapping) - .describe("Mapping of app types to tax codes."), + .describe('Mapping of app types to tax codes.'), }) - .describe("Tax codes by provider."); + .describe('Tax codes by provider.') export const upsertRequest_4 = z .object({ @@ -2879,48 +3086,51 @@ export const upsertRequest_4 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), app_mappings: z .array(taxCodeAppMapping) - .describe("Mapping of app types to tax codes."), + .describe('Mapping of app types to tax codes.'), }) - .describe("TaxCode upsert request."); + .describe('TaxCode upsert request.') export const billingWorkflowCollectionAlignmentAnchored = z .object({ - type: z.literal("anchored").describe("The type of alignment."), + type: z.literal('anchored').describe('The type of alignment.'), recurring_period: recurringPeriod, }) - - .describe("BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice."); + .describe( + 'BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.', + ) export const currency = z - .discriminatedUnion("type", [currencyFiat, currencyCustom]) - .describe("Fiat or custom currency."); + .discriminatedUnion('type', [currencyFiat, currencyCustom]) + .describe('Fiat or custom currency.') export const createResponse_6 = z .object({ _: z.literal(201), body: currencyCustom, }) - .describe("CurrencyCustom created response."); + .describe('CurrencyCustom created response.') export const governanceFeatureAccess = z .object({ has_access: z .boolean() - - .describe("Whether the customer currently has access to the feature. `true` for boolean and static entitlements that are available, and for metered entitlements with remaining balance. `false` when the feature is unavailable, the usage limit has been reached, or (when applicable) credits have been exhausted."), + .describe( + 'Whether the customer currently has access to the feature. `true` for boolean and static entitlements that are available, and for metered entitlements with remaining balance. `false` when the feature is unavailable, the usage limit has been reached, or (when applicable) credits have been exhausted.', + ), reason: governanceFeatureAccessReason.optional(), }) - .describe("Access status for a single feature."); + .describe('Access status for a single feature.') export const invoiceUsageQuantityDetail = z .object({ @@ -2930,47 +3140,47 @@ export const invoiceUsageQuantityDetail = z display_unit: z .string() .optional() - - .describe("The display unit label (e.g., \"GB\", \"hours\", \"M tokens\")."), + .describe('The display unit label (e.g., "GB", "hours", "M tokens").'), applied_unit_config: unitConfig, }) - - .describe("Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount."); + .describe( + 'Usage quantity details on an invoice line item when UnitConfig is in effect. Provides the full audit trail from raw meter output to the invoiced amount.', + ) export const customerBillingData = z .object({ billing_profile: billingProfileReference.optional(), app_data: appCustomerData.optional(), }) - .describe("Billing customer data."); + .describe('Billing customer data.') export const upsertRequest_5 = z .object({ billing_profile: billingProfileReference.optional(), app_data: appCustomerData.optional(), }) - .describe("CustomerBillingData upsert request."); + .describe('CustomerBillingData upsert request.') export const upsertResponse = z .object({ _: z.literal(200), body: appCustomerData, }) - .describe("AppCustomerData upsert response."); + .describe('AppCustomerData upsert response.') export const createResponse_7 = z .object({ _: z.literal(201), body: creditAdjustment, }) - .describe("CreditAdjustment created response."); + .describe('CreditAdjustment created response.') export const creditBalances = z .object({ retrieved_at: dateTime, - balances: z.array(creditBalance).describe("The balances by currencies."), + balances: z.array(creditBalance).describe('The balances by currencies.'), }) - .describe("The balances of the credits of a customer."); + .describe('The balances of the credits of a customer.') export const cursorPaginatedResponse = z .object({ @@ -2978,36 +3188,41 @@ export const cursorPaginatedResponse = z data: z.array(creditTransaction), meta: cursorMeta, }) - .describe("Cursor paginated response."); + .describe('Cursor paginated response.') export const priceGraduated = z .object({ - type: z.literal("graduated").describe("The type of the price."), + type: z.literal('graduated').describe('The type of the price.'), tiers: z .array(priceTier) .min(1) - - .describe("The tiers of the graduated price. At least one tier is required."), + .describe( + 'The tiers of the graduated price. At least one tier is required.', + ), }) - - .describe("Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units."); + .describe( + "Graduated tiered price. Each tier's rate applies only to the usage within that tier. Pricing can change as cumulative usage crosses tier boundaries. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.", + ) export const priceVolume = z .object({ - type: z.literal("volume").describe("The type of the price."), + type: z.literal('volume').describe('The type of the price.'), tiers: z .array(priceTier) .min(1) - - .describe("The tiers of the volume price. At least one tier is required."), + .describe( + 'The tiers of the volume price. At least one tier is required.', + ), }) - - .describe("Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units."); + .describe( + 'Volume tiered price. The maximum quantity within a period determines the per-unit price for all units in that period. When UnitConfig is present on the rate card, tier boundaries (up_to_amount) are expressed in converted billing units.', + ) export const featureUnitCost = z - .discriminatedUnion("type", [featureManualUnitCost, featureLlmUnitCost]) - - .describe("Per-unit cost configuration for a feature. Either a fixed manual amount or a dynamic LLM cost lookup."); + .discriminatedUnion('type', [featureManualUnitCost, featureLlmUnitCost]) + .describe( + 'Per-unit cost configuration for a feature. Either a fixed manual amount or a dynamic LLM cost lookup.', + ) export const pagePaginatedResponse_4 = z .object({ @@ -3015,22 +3230,23 @@ export const pagePaginatedResponse_4 = z data: z.array(price), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const createResponse_8 = z .object({ _: z.literal(201), body: price, }) - .describe("Price created response."); + .describe('Price created response.') export const creditGrantTaxConfig = z .object({ behavior: taxBehavior.optional(), tax_code: taxCodeReference.optional(), }) - - .describe("Tax configuration for a credit grant. Tax configuration should be provided to ensure correct revenue recognition, including for externally funded grants."); + .describe( + 'Tax configuration for a credit grant. Tax configuration should be provided to ensure correct revenue recognition, including for externally funded grants.', + ) export const taxConfig = z .object({ @@ -3040,21 +3256,21 @@ export const taxConfig = z tax_code_id: ulid.optional(), tax_code: taxCodeReference.optional(), }) - .describe("Set of provider specific tax configs."); + .describe('Set of provider specific tax configs.') export const getResponse_3 = z .object({ _: z.literal(200), body: organizationDefaultTaxCodes, }) - .describe("OrganizationDefaultTaxCodes response."); + .describe('OrganizationDefaultTaxCodes response.') export const upsertResponse_2 = z .object({ _: z.literal(200), body: organizationDefaultTaxCodes, }) - .describe("OrganizationDefaultTaxCodes upsert response."); + .describe('OrganizationDefaultTaxCodes upsert response.') export const pagePaginatedResponse_5 = z .object({ @@ -3062,7 +3278,7 @@ export const pagePaginatedResponse_5 = z data: z.array(subscriptionAddon), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const pagePaginatedResponse_6 = z .object({ @@ -3070,28 +3286,28 @@ export const pagePaginatedResponse_6 = z data: z.array(planAddon), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const createResponse_9 = z .object({ _: z.literal(201), body: planAddon, }) - .describe("PlanAddon created response."); + .describe('PlanAddon created response.') export const getResponse_4 = z .object({ _: z.literal(200), body: planAddon, }) - .describe("PlanAddon response."); + .describe('PlanAddon response.') export const upsertResponse_3 = z .object({ _: z.literal(200), body: planAddon, }) - .describe("PlanAddon upsert response."); + .describe('PlanAddon upsert response.') export const cursorPaginatedResponse_2 = z .object({ @@ -3099,7 +3315,7 @@ export const cursorPaginatedResponse_2 = z data: z.array(ingestedEvent), meta: cursorMeta, }) - .describe("Cursor paginated response."); + .describe('Cursor paginated response.') export const meterQueryRequest = z .object({ @@ -3109,31 +3325,32 @@ export const meterQueryRequest = z time_zone: z .string() .optional() - .default("UTC") - - .describe("The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). The time zone is used to determine the start and end of the time buckets. If not specified, the UTC timezone will be used."), + .default('UTC') + .describe( + 'The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). The time zone is used to determine the start and end of the time buckets. If not specified, the UTC timezone will be used.', + ), group_by_dimensions: z .array(z.string()) .max(100) .optional() - .describe("The dimensions to group the results by."), + .describe('The dimensions to group the results by.'), filters: meterQueryFilters.optional(), }) - .describe("A meter query request."); + .describe('A meter query request.') export const createResponse_10 = z .object({ _: z.literal(201), body: customer, }) - .describe("Customer created response."); + .describe('Customer created response.') export const getResponse_5 = z .object({ _: z.literal(200), body: customer, }) - .describe("Customer response."); + .describe('Customer response.') export const pagePaginatedResponse_7 = z .object({ @@ -3141,43 +3358,46 @@ export const pagePaginatedResponse_7 = z data: z.array(customer), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const upsertResponse_4 = z .object({ _: z.literal(200), body: customer, }) - .describe("Customer upsert response."); + .describe('Customer upsert response.') export const billingParty = z .object({ - id: z.string().optional().describe("Unique identifier for the party."), + id: z.string().optional().describe('Unique identifier for the party.'), key: externalResourceKey.optional(), name: z .string() .optional() - .describe("Legal name or representation of the party."), + .describe('Legal name or representation of the party.'), tax_id: billingPartyTaxIdentity.optional(), addresses: billingPartyAddresses.optional(), }) - .describe("Party represents a person or business entity."); + .describe('Party represents a person or business entity.') export const createStripeCheckoutSessionRequestOptions = z .object({ - billing_address_collection: createStripeCheckoutSessionBillingAddressCollection - .optional() - .default("auto"), + billing_address_collection: + createStripeCheckoutSessionBillingAddressCollection + .optional() + .default('auto'), cancel_url: z .string() .optional() - - .describe("URL to redirect customers who cancel the checkout session. Not allowed when ui_mode is \"embedded\"."), + .describe( + 'URL to redirect customers who cancel the checkout session. Not allowed when ui_mode is "embedded".', + ), client_reference_id: z .string() .optional() - - .describe("Unique reference string for reconciling sessions with internal systems. Can be a customer ID, cart ID, or any other identifier."), + .describe( + 'Unique reference string for reconciling sessions with internal systems. Can be a customer ID, cart ID, or any other identifier.', + ), customer_update: createStripeCheckoutSessionCustomerUpdate.optional(), consent_collection: createStripeCheckoutSessionConsentCollection.optional(), currency: currencyCode.optional(), @@ -3187,65 +3407,72 @@ export const createStripeCheckoutSessionRequestOptions = z .gte(-9223372036854775808n) .lte(9223372036854775807n) .optional() - - .describe("Unix timestamp when the checkout session expires. Can be 30 minutes to 24 hours from creation. Defaults to 24 hours."), + .describe( + 'Unix timestamp when the checkout session expires. Can be 30 minutes to 24 hours from creation. Defaults to 24 hours.', + ), locale: z .string() .optional() - - .describe("IETF language tag for the checkout UI locale. If blank or \"auto\", uses the browser's locale. Example: \"en\", \"fr\", \"de\"."), + .describe( + 'IETF language tag for the checkout UI locale. If blank or "auto", uses the browser\'s locale. Example: "en", "fr", "de".', + ), metadata: z .record(z.string(), z.string()) .optional() - - .describe("Set of key-value pairs to attach to the checkout session. Useful for storing additional structured information."), + .describe( + 'Set of key-value pairs to attach to the checkout session. Useful for storing additional structured information.', + ), return_url: z .string() .optional() - - .describe("Return URL for embedded checkout sessions after payment authentication. Required if ui_mode is \"embedded\" and redirect-based payment methods are enabled."), + .describe( + 'Return URL for embedded checkout sessions after payment authentication. Required if ui_mode is "embedded" and redirect-based payment methods are enabled.', + ), success_url: z .string() .optional() - - .describe("Success URL to redirect customers after completing payment or setup. Not allowed when ui_mode is \"embedded\". See: https://docs.stripe.com/payments/checkout/custom-success-page"), - ui_mode: checkoutSessionUiMode.optional().default("hosted"), + .describe( + 'Success URL to redirect customers after completing payment or setup. Not allowed when ui_mode is "embedded". See: https://docs.stripe.com/payments/checkout/custom-success-page', + ), + ui_mode: checkoutSessionUiMode.optional().default('hosted'), payment_method_types: z .array(z.string()) .optional() - - .describe("List of payment method types to enable (e.g., \"card\", \"us_bank_account\"). If not specified, Stripe enables all relevant payment methods."), - redirect_on_completion: createStripeCheckoutSessionRedirectOnCompletion - .optional(), + .describe( + 'List of payment method types to enable (e.g., "card", "us_bank_account"). If not specified, Stripe enables all relevant payment methods.', + ), + redirect_on_completion: + createStripeCheckoutSessionRedirectOnCompletion.optional(), tax_id_collection: createCheckoutSessionTaxIdCollection.optional(), }) - - .describe("Configuration options for creating a Stripe Checkout Session. Based on Stripe's [Checkout Session API parameters](https://docs.stripe.com/api/checkout/sessions/create)."); + .describe( + "Configuration options for creating a Stripe Checkout Session. Based on Stripe's [Checkout Session API parameters](https://docs.stripe.com/api/checkout/sessions/create).", + ) export const listCustomerEntitlementAccessResponse = z .object({ _: z.literal(200), body: listCustomerEntitlementAccessResponseData, }) - .describe("List the customer's active features and their access."); + .describe("List the customer's active features and their access.") export const app = z - .discriminatedUnion("type", [appStripe, appSandbox, appExternalInvoicing]) - .describe("Installed application."); + .discriminatedUnion('type', [appStripe, appSandbox, appExternalInvoicing]) + .describe('Installed application.') export const createResponse_11 = z .object({ _: z.literal(201), body: taxCode, }) - .describe("TaxCode created response."); + .describe('TaxCode created response.') export const getResponse_6 = z .object({ _: z.literal(200), body: taxCode, }) - .describe("TaxCode response."); + .describe('TaxCode response.') export const pagePaginatedResponse_8 = z .object({ @@ -3253,81 +3480,85 @@ export const pagePaginatedResponse_8 = z data: z.array(taxCode), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const upsertResponse_5 = z .object({ _: z.literal(200), body: taxCode, }) - .describe("TaxCode upsert response."); + .describe('TaxCode upsert response.') export const billingWorkflowCollectionAlignment = z - .discriminatedUnion( - "type", - [ - billingWorkflowCollectionAlignmentSubscription, - billingWorkflowCollectionAlignmentAnchored - ] + .discriminatedUnion('type', [ + billingWorkflowCollectionAlignmentSubscription, + billingWorkflowCollectionAlignmentAnchored, + ]) + .describe( + 'The alignment for collecting the pending line items into an invoice. Defaults to subscription, which means that we are to create a new invoice every time the a subscription period starts (for in advance items) or ends (for in arrears items).', ) - .describe("The alignment for collecting the pending line items into an invoice. Defaults to subscription, which means that we are to create a new invoice every time the a subscription period starts (for in advance items) or ends (for in arrears items)."); - export const pagePaginatedResponse_9 = z .object({ _: z.literal(200), data: z.array(currency), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const governanceQueryResult = z .object({ matched: z .array(z.string()) - - .describe("The list of identifiers from the request that resolved to this customer. Each entry is either the customer `key` or one of its usage-attribution subject `key`s. Duplicate or aliased identifiers that resolve to the same customer collapse to a single result entry, with every requested identifier listed here."), + .describe( + 'The list of identifiers from the request that resolved to this customer. Each entry is either the customer `key` or one of its usage-attribution subject `key`s. Duplicate or aliased identifiers that resolve to the same customer collapse to a single result entry, with every requested identifier listed here.', + ), customer: customer, features: z .record(z.string(), governanceFeatureAccess) - - .describe("Map of features with their access status. Map keys are the feature keys requested in `feature.keys`, or every feature `key` available in the organization when the feature filter was omitted."), + .describe( + 'Map of features with their access status. Map keys are the feature keys requested in `feature.keys`, or every feature `key` available in the organization when the feature filter was omitted.', + ), updated_at: dateTime, }) - .describe("Access evaluation result for a single resolved customer."); + .describe('Access evaluation result for a single resolved customer.') export const getResponse_7 = z .object({ _: z.literal(200), body: customerBillingData, }) - .describe("CustomerBillingData response."); + .describe('CustomerBillingData response.') export const upsertResponse_6 = z .object({ _: z.literal(200), body: customerBillingData, }) - .describe("CustomerBillingData upsert response."); + .describe('CustomerBillingData upsert response.') export const getResponse_8 = z .object({ _: z.literal(200), body: creditBalances, }) - .describe("CreditBalances response."); + .describe('CreditBalances response.') export const price_2 = z - .discriminatedUnion( - "type", - [priceFree, priceFlat, priceUnit, priceGraduated, priceVolume] - ) - .describe("Price."); + .discriminatedUnion('type', [ + priceFree, + priceFlat, + priceUnit, + priceGraduated, + priceVolume, + ]) + .describe('Price.') export const priceUsageBased = z - .discriminatedUnion("type", [priceUnit, priceGraduated, priceVolume]) - - .describe("Usage-based price types that can appear on a usage-based rate card. When UnitConfig is present on the rate card, these price types operate on billing units (i.e. post-conversion quantities), not raw metered units."); + .discriminatedUnion('type', [priceUnit, priceGraduated, priceVolume]) + .describe( + 'Usage-based price types that can appear on a usage-based rate card. When UnitConfig is present on the rate card, these price types operate on billing units (i.e. post-conversion quantities), not raw metered units.', + ) export const feature = z .object({ @@ -3336,13 +3567,14 @@ export const feature = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -3351,7 +3583,7 @@ export const feature = z meter: featureMeterReference.optional(), unit_cost: featureUnitCost.optional(), }) - .describe("A capability or billable dimension offered by a provider."); + .describe('A capability or billable dimension offered by a provider.') export const createRequest_8 = z .object({ @@ -3359,30 +3591,33 @@ export const createRequest_8 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, meter: featureMeterReference.optional(), unit_cost: featureUnitCost.optional(), }) - .describe("Feature create request."); + .describe('Feature create request.') export const featureUpdateRequest = z .object({ unit_cost: z .union([featureUnitCost, z.null()]) .optional() - - .describe("Optional per-unit cost configuration. Use \"manual\" for a fixed per-unit cost, or \"llm\" to look up cost from the LLM cost database based on meter group-by properties. Set to `null` to clear the existing unit cost; omit to leave it unchanged."), + .describe( + 'Optional per-unit cost configuration. Use "manual" for a fixed per-unit cost, or "llm" to look up cost from the LLM cost database based on meter group-by properties. Set to `null` to clear the existing unit cost; omit to leave it unchanged.', + ), }) - - .describe("Request body for updating a feature. Currently only the unit_cost field can be updated."); + .describe( + 'Request body for updating a feature. Currently only the unit_cost field can be updated.', + ) export const createRequestNested = z .object({ @@ -3390,13 +3625,14 @@ export const createRequestNested = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), funding_method: creditFundingMethod, currency: currencyCode_2, @@ -3404,25 +3640,27 @@ export const createRequestNested = z purchase: z .object({ currency: currencyCode, - per_unit_cost_basis: numeric.optional().default("1.0"), + per_unit_cost_basis: numeric.optional().default('1.0'), availability_policy: creditAvailabilityPolicy .optional() - .default("on_creation"), + .default('on_creation'), }) .optional() - - .describe("Purchase and payment terms of the grant. Present when a funding workflow applies (funding_method is not `none`)."), + .describe( + 'Purchase and payment terms of the grant. Present when a funding workflow applies (funding_method is not `none`).', + ), tax_config: creditGrantTaxConfig.optional(), filters: z .object({ features: z .array(resourceKey) .optional() - - .describe("Limit the credit grant to specific features. If no features are specified, the credit grant can be used for any feature."), + .describe( + 'Limit the credit grant to specific features. If no features are specified, the credit grant can be used for any feature.', + ), }) .optional() - .describe("Filters for the credit grant."), + .describe('Filters for the credit grant.'), priority: z .number() .int() @@ -3430,10 +3668,11 @@ export const createRequestNested = z .lte(1000) .optional() .default(10) - - .describe("Draw-down priority of the grant. Lower values have higher priority."), + .describe( + 'Draw-down priority of the grant. Lower values have higher priority.', + ), }) - .describe("CreditGrant create request."); + .describe('CreditGrant create request.') export const creditGrant = z .object({ @@ -3442,13 +3681,14 @@ export const creditGrant = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -3459,16 +3699,17 @@ export const creditGrant = z purchase: z .object({ currency: currencyCode, - per_unit_cost_basis: numeric.optional().default("1.0"), + per_unit_cost_basis: numeric.optional().default('1.0'), amount: numeric, availability_policy: creditAvailabilityPolicy .optional() - .default("on_creation"), + .default('on_creation'), settlement_status: creditPurchasePaymentSettlementStatus.optional(), }) .optional() - - .describe("Purchase and payment terms of the grant. Present when a funding workflow applies (funding_method is not `none`)."), + .describe( + 'Purchase and payment terms of the grant. Present when a funding workflow applies (funding_method is not `none`).', + ), tax_config: creditGrantTaxConfig.optional(), invoice: z .object({ @@ -3478,22 +3719,25 @@ export const creditGrant = z id: ulid, }) .optional() - - .describe("Identifier of the invoice line associated with the grant."), + .describe( + 'Identifier of the invoice line associated with the grant.', + ), }) .optional() - - .describe("Invoice references for the grant. Available when `funding_method` is `invoice`."), + .describe( + 'Invoice references for the grant. Available when `funding_method` is `invoice`.', + ), filters: z .object({ features: z .array(resourceKey) .optional() - - .describe("Limit the credit grant to specific features. If no features are specified, the credit grant can be used for any feature."), + .describe( + 'Limit the credit grant to specific features. If no features are specified, the credit grant can be used for any feature.', + ), }) .optional() - .describe("Filters for the credit grant."), + .describe('Filters for the credit grant.'), priority: z .number() .int() @@ -3501,13 +3745,15 @@ export const creditGrant = z .lte(1000) .optional() .default(10) - - .describe("Draw-down priority of the grant. Lower values have higher priority."), + .describe( + 'Draw-down priority of the grant. Lower values have higher priority.', + ), voided_at: dateTime.optional(), status: creditGrantStatus, }) - - .describe("A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card."); + .describe( + 'A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card.', + ) export const billingWorkflowTaxSettings = z .object({ @@ -3515,24 +3761,27 @@ export const billingWorkflowTaxSettings = z .boolean() .optional() .default(true) - - .describe("Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax."), + .describe( + 'Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.', + ), enforced: z .boolean() .optional() .default(false) - - .describe("Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription."), + .describe( + 'Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription.', + ), default_tax_config: taxConfig.optional(), }) - .describe("Tax settings for a billing workflow."); + .describe('Tax settings for a billing workflow.') export const customerBillingStripeCreateCheckoutSessionRequest = z .object({ stripe_options: createStripeCheckoutSessionRequestOptions, }) - - .describe("Request to create a Stripe Checkout Session for the customer. Checkout Sessions are used to collect payment method information from customers in a secure, Stripe-hosted interface. This integration uses setup mode to collect payment methods that can be charged later for subscription billing."); + .describe( + 'Request to create a Stripe Checkout Session for the customer. Checkout Sessions are used to collect payment method information from customers in a secure, Stripe-hosted interface. This integration uses setup mode to collect payment methods that can be charged later for subscription billing.', + ) export const pagePaginatedResponse_10 = z .object({ @@ -3540,14 +3789,14 @@ export const pagePaginatedResponse_10 = z data: z.array(app), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const getResponse_9 = z .object({ _: z.literal(200), body: app, }) - .describe("App response."); + .describe('App response.') export const billingProfileApps = z .object({ @@ -3555,36 +3804,36 @@ export const billingProfileApps = z invoicing: app, payment: app, }) - .describe("Applications used by a billing profile."); + .describe('Applications used by a billing profile.') export const billingWorkflowCollectionSettings = z .object({ - alignment: billingWorkflowCollectionAlignment - .optional() - .default({ - type: "subscription", - }), + alignment: billingWorkflowCollectionAlignment.optional().default({ + type: 'subscription', + }), interval: z .string() .optional() - .default("PT1H") - - .describe("This grace period can be used to delay the collection of the pending line items specified in alignment. This is useful, in case of multiple subscriptions having slightly different billing periods."), + .default('PT1H') + .describe( + 'This grace period can be used to delay the collection of the pending line items specified in alignment. This is useful, in case of multiple subscriptions having slightly different billing periods.', + ), }) - - .describe("Workflow collection specifies how to collect the pending line items for an invoice."); + .describe( + 'Workflow collection specifies how to collect the pending line items for an invoice.', + ) export const governanceQueryResponse = z .object({ data: z .array(governanceQueryResult) - .describe("Access evaluation results, one entry per resolved customer."), + .describe('Access evaluation results, one entry per resolved customer.'), errors: z .array(governanceQueryError) - .describe("Partial errors encountered while processing the request."), + .describe('Partial errors encountered while processing the request.'), meta: cursorMeta, }) - .describe("Response of the governance query."); + .describe('Response of the governance query.') export const flatFeeCharge = z .object({ @@ -3593,18 +3842,19 @@ export const flatFeeCharge = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), - type: z.literal("flat_fee").describe("The type of the charge."), + type: z.literal('flat_fee').describe('The type of the charge.'), customer: customerReference, managed_by: resourceManagedBy, subscription: subscriptionReference.optional(), @@ -3619,7 +3869,7 @@ export const flatFeeCharge = z unique_reference_id: z .string() .optional() - .describe("Unique reference ID of the charge."), + .describe('Unique reference ID of the charge.'), settlement_mode: settlementMode, tax_config: taxConfig.optional(), payment_term: pricePaymentTerm, @@ -3627,11 +3877,11 @@ export const flatFeeCharge = z feature_key: z .string() .optional() - .describe("The feature associated with the charge, when applicable."), + .describe('The feature associated with the charge, when applicable.'), proration_configuration: prorationConfiguration, amount_after_proration: currencyAmount, }) - .describe("A flat fee charge for a customer."); + .describe('A flat fee charge for a customer.') export const usageBasedCharge = z .object({ @@ -3640,18 +3890,19 @@ export const usageBasedCharge = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, deleted_at: dateTime.optional(), - type: z.literal("usage_based").describe("The type of the charge."), + type: z.literal('usage_based').describe('The type of the charge.'), customer: customerReference, managed_by: resourceManagedBy, subscription: subscriptionReference.optional(), @@ -3666,14 +3917,14 @@ export const usageBasedCharge = z unique_reference_id: z .string() .optional() - .describe("Unique reference ID of the charge."), + .describe('Unique reference ID of the charge.'), settlement_mode: settlementMode, tax_config: taxConfig.optional(), discounts: discounts.optional(), - feature_key: z.string().describe("The feature associated with the charge."), + feature_key: z.string().describe('The feature associated with the charge.'), totals: chargeTotals, }) - .describe("A usage-based charge for a customer."); + .describe('A usage-based charge for a customer.') export const rateCard = z .object({ @@ -3681,25 +3932,27 @@ export const rateCard = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, feature: resourceReference_4.optional(), billing_cadence: iso8601Duration.optional(), price: price_2, - payment_term: pricePaymentTerm.optional().default("in_arrears"), + payment_term: pricePaymentTerm.optional().default('in_arrears'), commitments: spendCommitments.optional(), discounts: discounts.optional(), tax_config: rateCardTaxConfig.optional(), }) - - .describe("A rate card defines the pricing and entitlement of a feature or service."); + .describe( + 'A rate card defines the pricing and entitlement of a feature or service.', + ) export const pagePaginatedResponse_11 = z .object({ @@ -3707,42 +3960,42 @@ export const pagePaginatedResponse_11 = z data: z.array(feature), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const createResponse_12 = z .object({ _: z.literal(201), body: feature, }) - .describe("Feature created response."); + .describe('Feature created response.') export const getResponse_10 = z .object({ _: z.literal(200), body: feature, }) - .describe("Feature response."); + .describe('Feature response.') export const updateResponse_3 = z .object({ _: z.literal(200), body: feature, }) - .describe("Feature updated response."); + .describe('Feature updated response.') export const createResponse_13 = z .object({ _: z.literal(201), body: creditGrant, }) - .describe("CreditGrant created response."); + .describe('CreditGrant created response.') export const getResponse_11 = z .object({ _: z.literal(200), body: creditGrant, }) - .describe("CreditGrant response."); + .describe('CreditGrant response.') export const pagePaginatedResponse_12 = z .object({ @@ -3750,14 +4003,14 @@ export const pagePaginatedResponse_12 = z data: z.array(creditGrant), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const updateResponse_4 = z .object({ _: z.literal(200), body: creditGrant, }) - .describe("CreditGrant updated response."); + .describe('CreditGrant updated response.') export const billingWorkflow = z .object({ @@ -3766,11 +4019,11 @@ export const billingWorkflow = z payment: billingWorkflowPaymentSettings.optional(), tax: billingWorkflowTaxSettings.optional(), }) - .describe("Billing workflow settings."); + .describe('Billing workflow settings.') export const charge = z - .discriminatedUnion("type", [flatFeeCharge, usageBasedCharge]) - .describe("Customer charge."); + .discriminatedUnion('type', [flatFeeCharge, usageBasedCharge]) + .describe('Customer charge.') export const planPhase = z .object({ @@ -3778,20 +4031,22 @@ export const planPhase = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, duration: iso8601Duration.optional(), - rate_cards: z.array(rateCard).describe("The rate cards of the plan."), + rate_cards: z.array(rateCard).describe('The rate cards of the plan.'), }) - - .describe("The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses."); + .describe( + "The plan phase or pricing ramp allows changing a plan's rate cards over time as a subscription progresses.", + ) export const addon = z .object({ @@ -3800,13 +4055,14 @@ export const addon = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -3816,21 +4072,23 @@ export const addon = z .bigint() .gte(1n) .default(1n) - - .describe("Version of the add-on. Incremented when the add-on is updated."), + .describe( + 'Version of the add-on. Incremented when the add-on is updated.', + ), instance_type: addonInstanceType, currency: currencyCode_2, effective_from: dateTime.optional(), effective_to: dateTime.optional(), status: addonStatus, - rate_cards: z.array(rateCard).describe("The rate cards of the add-on."), + rate_cards: z.array(rateCard).describe('The rate cards of the add-on.'), validation_errors: z .array(productCatalogValidationError) .optional() - .describe("List of validation errors."), + .describe('List of validation errors.'), }) - - .describe("Add-on allows extending subscriptions with compatible plans with additional ratecards."); + .describe( + 'Add-on allows extending subscriptions with compatible plans with additional ratecards.', + ) export const createRequest_9 = z .object({ @@ -3838,20 +4096,21 @@ export const createRequest_9 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, instance_type: addonInstanceType, currency: currencyCode_2, - rate_cards: z.array(rateCard).describe("The rate cards of the add-on."), + rate_cards: z.array(rateCard).describe('The rate cards of the add-on.'), }) - .describe("Addon create request."); + .describe('Addon create request.') export const upsertRequest_6 = z .object({ @@ -3859,18 +4118,19 @@ export const upsertRequest_6 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), instance_type: addonInstanceType, - rate_cards: z.array(rateCard).describe("The rate cards of the add-on."), + rate_cards: z.array(rateCard).describe('The rate cards of the add-on.'), }) - .describe("Addon upsert request."); + .describe('Addon upsert request.') export const billingProfile = z .object({ @@ -3879,13 +4139,14 @@ export const billingProfile = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -3893,10 +4154,11 @@ export const billingProfile = z supplier: billingParty, workflow: billingWorkflow, apps: billingProfileAppReferences, - default: z.boolean().describe("Whether this is the default profile."), + default: z.boolean().describe('Whether this is the default profile.'), }) - - .describe("Billing profiles contain the settings for billing and controls invoice generation."); + .describe( + 'Billing profiles contain the settings for billing and controls invoice generation.', + ) export const createRequest_10 = z .object({ @@ -3904,20 +4166,21 @@ export const createRequest_10 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), supplier: billingParty, workflow: billingWorkflow, apps: billingProfileAppReferences, - default: z.boolean().describe("Whether this is the default profile."), + default: z.boolean().describe('Whether this is the default profile.'), }) - .describe("BillingProfile create request."); + .describe('BillingProfile create request.') export const upsertRequest_7 = z .object({ @@ -3925,19 +4188,20 @@ export const upsertRequest_7 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), supplier: billingParty, workflow: billingWorkflow, - default: z.boolean().describe("Whether this is the default profile."), + default: z.boolean().describe('Whether this is the default profile.'), }) - .describe("BillingProfile upsert request."); + .describe('BillingProfile upsert request.') export const pagePaginatedResponse_13 = z .object({ @@ -3945,7 +4209,7 @@ export const pagePaginatedResponse_13 = z data: z.array(charge), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const plan = z .object({ @@ -3954,13 +4218,14 @@ export const plan = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), created_at: dateTime, updated_at: dateTime, @@ -3970,30 +4235,33 @@ export const plan = z .bigint() .gte(1n) .default(1n) - - .describe("Plans are versioned to allow you to make changes without affecting running subscriptions."), + .describe( + 'Plans are versioned to allow you to make changes without affecting running subscriptions.', + ), currency: currencyCode, billing_cadence: iso8601Duration, pro_rating_enabled: z .boolean() .optional() .default(true) - .describe("Whether pro-rating is enabled for this plan."), + .describe('Whether pro-rating is enabled for this plan.'), effective_from: dateTime.optional(), effective_to: dateTime.optional(), status: planStatus, phases: z .array(planPhase) .min(1) - - .describe("The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required."), + .describe( + 'The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.', + ), validation_errors: z .array(productCatalogValidationError) .optional() - - .describe("List of validation errors in `draft` state that prevent the plan from being published."), + .describe( + 'List of validation errors in `draft` state that prevent the plan from being published.', + ), }) - .describe("Plans provide a template for subscriptions."); + .describe('Plans provide a template for subscriptions.') export const createRequest_11 = z .object({ @@ -4001,13 +4269,14 @@ export const createRequest_11 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), key: resourceKey, currency: currencyCode, @@ -4016,14 +4285,15 @@ export const createRequest_11 = z .boolean() .optional() .default(true) - .describe("Whether pro-rating is enabled for this plan."), + .describe('Whether pro-rating is enabled for this plan.'), phases: z .array(planPhase) .min(1) - - .describe("The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required."), + .describe( + 'The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.', + ), }) - .describe("Plan create request."); + .describe('Plan create request.') export const upsertRequest_8 = z .object({ @@ -4031,26 +4301,28 @@ export const upsertRequest_8 = z .string() .min(1) .max(256) - .describe("Display name of the resource. Between 1 and 256 characters."), + .describe('Display name of the resource. Between 1 and 256 characters.'), description: z .string() .max(1024) .optional() - - .describe("Optional description of the resource. Maximum 1024 characters."), + .describe( + 'Optional description of the resource. Maximum 1024 characters.', + ), labels: labels.optional(), pro_rating_enabled: z .boolean() .optional() .default(true) - .describe("Whether pro-rating is enabled for this plan."), + .describe('Whether pro-rating is enabled for this plan.'), phases: z .array(planPhase) .min(1) - - .describe("The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required."), + .describe( + 'The plan phases define the pricing ramp for a subscription. A phase switch occurs only at the end of a billing period. At least one phase is required.', + ), }) - .describe("Plan upsert request."); + .describe('Plan upsert request.') export const pagePaginatedResponse_14 = z .object({ @@ -4058,35 +4330,35 @@ export const pagePaginatedResponse_14 = z data: z.array(addon), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const createResponse_14 = z .object({ _: z.literal(201), body: addon, }) - .describe("Addon created response."); + .describe('Addon created response.') export const upsertResponse_7 = z .object({ _: z.literal(200), body: addon, }) - .describe("Addon upsert response."); + .describe('Addon upsert response.') export const getResponse_12 = z .object({ _: z.literal(200), body: addon, }) - .describe("Addon response."); + .describe('Addon response.') export const updateResponse_5 = z .object({ _: z.literal(200), body: addon, }) - .describe("Addon updated response."); + .describe('Addon updated response.') export const pagePaginatedResponse_15 = z .object({ @@ -4094,28 +4366,28 @@ export const pagePaginatedResponse_15 = z data: z.array(billingProfile), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const createResponse_15 = z .object({ _: z.literal(201), body: billingProfile, }) - .describe("BillingProfile created response."); + .describe('BillingProfile created response.') export const getResponse_13 = z .object({ _: z.literal(200), body: billingProfile, }) - .describe("BillingProfile response."); + .describe('BillingProfile response.') export const updateResponse_6 = z .object({ _: z.literal(200), body: billingProfile, }) - .describe("BillingProfile updated response."); + .describe('BillingProfile updated response.') export const pagePaginatedResponse_16 = z .object({ @@ -4123,32 +4395,32 @@ export const pagePaginatedResponse_16 = z data: z.array(plan), meta: pageMeta, }) - .describe("Page paginated response."); + .describe('Page paginated response.') export const createResponse_16 = z .object({ _: z.literal(201), body: plan, }) - .describe("Plan created response."); + .describe('Plan created response.') export const upsertResponse_8 = z .object({ _: z.literal(200), body: plan, }) - .describe("Plan upsert response."); + .describe('Plan upsert response.') export const getResponse_14 = z .object({ _: z.literal(200), body: plan, }) - .describe("Plan response."); + .describe('Plan response.') export const updateResponse_7 = z .object({ _: z.literal(200), body: plan, }) - .describe("Plan updated response."); + .describe('Plan updated response.') diff --git a/api/spec/packages/typespec-go/src/gen/gen_vendor.ts b/api/spec/packages/typespec-go/src/gen/gen_vendor.ts index d341da2d38..4282a39a59 100644 --- a/api/spec/packages/typespec-go/src/gen/gen_vendor.ts +++ b/api/spec/packages/typespec-go/src/gen/gen_vendor.ts @@ -63,6 +63,7 @@ export function emitVendoredFiles(module: string): VendoredFile[] { if (!rel.endsWith(".go")) return; if (rel.endsWith("_test.go")) return; let src = readFileSync(full, "utf8"); + src = stripTemplateBuildTag(src); src = src.replaceAll(REFERENCE_MODULE, module); src = rewriteBanner(src); out.push({ path: rel.split("\\").join("/"), content: src }); @@ -70,6 +71,19 @@ export function emitVendoredFiles(module: string): VendoredFile[] { return out; } +/** + * Template `.go` files in `src/templates/` carry a `//go:build ignore` build + * constraint so the host repo's `go vet ./...` and `go mod tidy` skip them + * (they reference a fictional `openmeter-go-sdk` import path and only become + * compilable Go after this emitter substitutes the consumer's module path). + * Strip the build tag and its trailing blank line on copy so the emitted + * file is normal Go again. + */ +const BUILD_IGNORE_PATTERN = /^\/\/go:build ignore\s*\n\s*\n/m; +function stripTemplateBuildTag(src: string): string { + return src.replace(BUILD_IGNORE_PATTERN, ""); +} + /** * Replace the Speakeasy "Code generated" banner with our own. If no banner * was present (rare in the reference tree), prepend ours so downstream tooling diff --git a/api/spec/packages/typespec-go/src/model/builder.ts b/api/spec/packages/typespec-go/src/model/builder.ts index 989534c232..e9ebced016 100644 --- a/api/spec/packages/typespec-go/src/model/builder.ts +++ b/api/spec/packages/typespec-go/src/model/builder.ts @@ -89,11 +89,13 @@ interface BuildCtx { /** TypeSpec Type identity -> Go name, so the same Type always maps to the same Decl. */ readonly typeToName: Map; /** - * Maps raw TypeSpec type names (e.g. "AppStripe") to the canonical Go name - * we picked for them (e.g. "BillingAppStripe"). Lets a second Type instance - * arriving with the same raw name (typically a synthetic copy in a union - * variant context, lacking the @friendlyName decorator) collapse to the - * already-emitted Decl. + * Maps resolved Go names to themselves. Lets a second Type instance that + * resolves to the same Go name (e.g. a synthetic copy in a union variant + * context that produces the same finalName as a canonical model already + * emitted) collapse onto the already-emitted Decl. Keyed on resolved Go + * name — not raw TypeSpec name — so that template instantiations with + * distinct @friendlyName values (CreateRequest -> CreatePlanRequest, + * CreateRequest -> CreateMeterRequest) get distinct decls. */ readonly rawNameToGoName: Map; /** Types currently being built, to break cycles. */ @@ -256,24 +258,30 @@ function emitDecl(ctx: BuildCtx, t: Type): GoType | undefined { if (prior) return named(prior, COMPONENTS_PKG); const rawName = t.name; - // If a sibling Type instance with the same raw TypeSpec name already - // resolved to a Go name, reuse it. This collapses synthetic copies - // (e.g. union variant instances that lack @friendlyName) onto the canonical - // Decl picked the first time we saw the name. - const aliased = ctx.rawNameToGoName.get(rawName); + // Resolve the final Go name first: @friendlyName takes precedence for + // template instances (e.g. Shared.CreateRequest -> CreatePlanRequest; + // Shared.PagePaginatedResponse -> MeterPagePaginatedResponse), with + // the raw TypeSpec name as a fallback for ordinary models. + const friendly = getFriendlyName(ctx.program, t as Model | Enum | Union | Scalar); + const finalName = + friendly && typeof friendly === "string" && friendly.trim() ? friendly : rawName; + const name = pascal(finalName); + + // If a sibling Type instance previously resolved to the same Go name, + // reuse its Decl. The cache is keyed on the resolved Go name (not just the + // raw TypeSpec name) so that distinct template instantiations with distinct + // friendly names emit distinct decls, while synthetic copies that would + // produce the same Go name (e.g. a union variant of AppStripe lacking a + // friendly name, sharing finalName="AppStripe" with the canonical model) + // still collapse onto the canonical Decl. + const aliased = ctx.rawNameToGoName.get(name); if (aliased) { ctx.typeToName.set(t, aliased); return named(aliased, COMPONENTS_PKG); } - // Prefer @friendlyName for template instances (e.g. Shared.PagePaginatedResponse - // -> MeterPagePaginatedResponse). Falls back to the raw type name otherwise. - const friendly = getFriendlyName(ctx.program, t as Model | Enum | Union | Scalar); - const finalName = - friendly && typeof friendly === "string" && friendly.trim() ? friendly : rawName; - const name = pascal(finalName); ctx.typeToName.set(t, name); - ctx.rawNameToGoName.set(rawName, name); + ctx.rawNameToGoName.set(name, name); if (ctx.seen.has(name)) return named(name, COMPONENTS_PKG); if (ctx.inProgress.has(t)) return named(name, COMPONENTS_PKG); ctx.inProgress.add(t); diff --git a/api/spec/packages/typespec-go/src/templates/internal/config/sdkconfiguration.go b/api/spec/packages/typespec-go/src/templates/internal/config/sdkconfiguration.go index ab714f3ae4..e52b5e2f44 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/config/sdkconfiguration.go +++ b/api/spec/packages/typespec-go/src/templates/internal/config/sdkconfiguration.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package config import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/hooks/hooks.go b/api/spec/packages/typespec-go/src/templates/internal/hooks/hooks.go index 6be8608542..a332608591 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/hooks/hooks.go +++ b/api/spec/packages/typespec-go/src/templates/internal/hooks/hooks.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package hooks import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/contenttype.go b/api/spec/packages/typespec-go/src/templates/internal/utils/contenttype.go index f6487e01eb..0f0b7c8ee8 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/contenttype.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/contenttype.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/env.go b/api/spec/packages/typespec-go/src/templates/internal/utils/env.go index 110d464eac..34ce9d3329 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/env.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/env.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/form.go b/api/spec/packages/typespec-go/src/templates/internal/utils/form.go index 500e3ff384..3e3b96d98f 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/form.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/form.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/headers.go b/api/spec/packages/typespec-go/src/templates/internal/utils/headers.go index 90a1aa5d81..c9d611ca7d 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/headers.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/headers.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/json.go b/api/spec/packages/typespec-go/src/templates/internal/utils/json.go index 3376067c36..9a9f34490e 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/json.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/json.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/pathparams.go b/api/spec/packages/typespec-go/src/templates/internal/utils/pathparams.go index 88942e8eb9..ed89c7a980 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/pathparams.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/pathparams.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/queryparams.go b/api/spec/packages/typespec-go/src/templates/internal/utils/queryparams.go index 24feb65896..4ae09b405c 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/queryparams.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/queryparams.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/requestbody.go b/api/spec/packages/typespec-go/src/templates/internal/utils/requestbody.go index 16e74fb382..e04f5eac33 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/requestbody.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/requestbody.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/retries.go b/api/spec/packages/typespec-go/src/templates/internal/utils/retries.go index 1050f0cdc6..5859b70c85 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/retries.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/retries.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/security.go b/api/spec/packages/typespec-go/src/templates/internal/utils/security.go index 7c1a372ae3..a9cea7ef64 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/security.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/security.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/union.go b/api/spec/packages/typespec-go/src/templates/internal/utils/union.go index ca7cca8f2e..438d055bb3 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/union.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/union.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/union_test.go b/api/spec/packages/typespec-go/src/templates/internal/utils/union_test.go index 138f7e2a06..b68869cf7f 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/union_test.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/union_test.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/internal/utils/utils.go b/api/spec/packages/typespec-go/src/templates/internal/utils/utils.go index b32a14db51..a04604bbe4 100644 --- a/api/spec/packages/typespec-go/src/templates/internal/utils/utils.go +++ b/api/spec/packages/typespec-go/src/templates/internal/utils/utils.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package utils import ( diff --git a/api/spec/packages/typespec-go/src/templates/models/apierrors/apierror.go b/api/spec/packages/typespec-go/src/templates/models/apierrors/apierror.go index 61a9628a65..5bc7e24293 100644 --- a/api/spec/packages/typespec-go/src/templates/models/apierrors/apierror.go +++ b/api/spec/packages/typespec-go/src/templates/models/apierrors/apierror.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package apierrors import ( diff --git a/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable.go b/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable.go index c6739be061..c2663c51f6 100644 --- a/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable.go +++ b/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package optionalnullable import ( diff --git a/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable_test.go b/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable_test.go index e6e5a01c6e..810b895d50 100644 --- a/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable_test.go +++ b/api/spec/packages/typespec-go/src/templates/optionalnullable/optionalnullable_test.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package optionalnullable import ( diff --git a/api/spec/packages/typespec-go/src/templates/retry/config.go b/api/spec/packages/typespec-go/src/templates/retry/config.go index 5b3dc7c122..043eea6a10 100644 --- a/api/spec/packages/typespec-go/src/templates/retry/config.go +++ b/api/spec/packages/typespec-go/src/templates/retry/config.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package retry import ( diff --git a/api/spec/packages/typespec-go/src/templates/types/bigint.go b/api/spec/packages/typespec-go/src/templates/types/bigint.go index 9c6a086d51..6694db8440 100644 --- a/api/spec/packages/typespec-go/src/templates/types/bigint.go +++ b/api/spec/packages/typespec-go/src/templates/types/bigint.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package types import ( diff --git a/api/spec/packages/typespec-go/src/templates/types/date.go b/api/spec/packages/typespec-go/src/templates/types/date.go index 5b2782f219..ef74a32b6a 100644 --- a/api/spec/packages/typespec-go/src/templates/types/date.go +++ b/api/spec/packages/typespec-go/src/templates/types/date.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package types import ( diff --git a/api/spec/packages/typespec-go/src/templates/types/datetime.go b/api/spec/packages/typespec-go/src/templates/types/datetime.go index 3eff332daa..511c31890a 100644 --- a/api/spec/packages/typespec-go/src/templates/types/datetime.go +++ b/api/spec/packages/typespec-go/src/templates/types/datetime.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package types import "time" diff --git a/api/spec/packages/typespec-go/src/templates/types/pointers.go b/api/spec/packages/typespec-go/src/templates/types/pointers.go index 35c439d266..5d1d277114 100644 --- a/api/spec/packages/typespec-go/src/templates/types/pointers.go +++ b/api/spec/packages/typespec-go/src/templates/types/pointers.go @@ -1,5 +1,7 @@ // Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. +//go:build ignore + package types func String(s string) *string { return &s } diff --git a/api/spec/pnpm-lock.yaml b/api/spec/pnpm-lock.yaml index 217ad65cce..fedd035ba0 100644 --- a/api/spec/pnpm-lock.yaml +++ b/api/spec/pnpm-lock.yaml @@ -103,9 +103,6 @@ importers: uri-template: specifier: ^2.0.0 version: 2.0.0 - zod: - specifier: '>=4' - version: 4.3.6 devDependencies: '@types/node': specifier: ~18.19.75 diff --git a/e2e/productcatalog_smoke_sdk_v3_test.go b/e2e/productcatalog_smoke_sdk_v3_test.go new file mode 100644 index 0000000000..eba07246b6 --- /dev/null +++ b/e2e/productcatalog_smoke_sdk_v3_test.go @@ -0,0 +1,344 @@ +package e2e + +import ( + "context" + "encoding/json" + "errors" + "os" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + apiv3 "github.com/openmeterio/openmeter/api/v3" + sdkpkg "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go" + sdkerr "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/apierrors" + sdkc "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/components" + sdkop "github.com/openmeterio/openmeter/api/spec/packages/aip-client-go/models/operations" +) + +// TestV3ProductCatalogSmokeSDK is the SDK-driven dogfood of the v3 plan + +// addon authoring flow, mirroring TestV3ProductCatalogSmoke but issuing +// every call through the generated Go SDK in +// api/spec/packages/aip-client-go. +// +// The fixture builders in v3helpers_test.go still produce apiv3.* types. We +// JSON-roundtrip them into the SDK's components.* types — the wire format is +// identical by construction (both are generated from the same TypeSpec), so +// any decode failure here is a signal that the SDK's typed model has drifted +// from the server schema. +func TestV3ProductCatalogSmokeSDK(t *testing.T) { + sdk, ctx := newSDKClient(t) + + eventTypes := []string{ + uniqueKey("sanity_event"), + uniqueKey("sanity_event"), + } + meterKeys := []string{ + uniqueKey("sanity_meter"), + uniqueKey("sanity_meter"), + } + + meters := make([]sdkc.Meter, 0, len(meterKeys)) + for i := range meterKeys { + valueProperty := "$.value" + req := sdkc.CreateMeterRequest{ + Key: meterKeys[i], + Name: "Test Meter " + meterKeys[i], + Aggregation: sdkc.MeterAggregationSum, + EventType: eventTypes[i], + ValueProperty: &valueProperty, + } + res, err := sdk.OpenMeterMeters.CreateMeter(ctx, sdkop.CreateMeterRequest{Meter: req}) + require.NoError(t, err, "CreateMeter") + require.NotNil(t, res.Body, "CreateMeter response body") + require.NotEmpty(t, res.Body.Id, "CreateMeter Id") + meters = append(meters, *res.Body) + } + + featureKeys := []string{ + uniqueKey("sanity_feature"), + uniqueKey("sanity_feature"), + } + features := make([]sdkc.Feature, 0, len(featureKeys)) + for i := range featureKeys { + req := sdkc.CreateFeatureRequest{ + Key: featureKeys[i], + Name: "Test Feature " + featureKeys[i], + Meter: &sdkc.FeatureMeterReference{ + Id: meters[i].Id, + }, + } + res, err := sdk.OpenMeterFeatures.CreateFeature(ctx, sdkop.CreateFeatureRequest{Feature: req}) + require.NoError(t, err, "CreateFeature") + require.NotNil(t, res.Body) + require.NotEmpty(t, res.Body.Id) + features = append(features, *res.Body) + } + + var ( + planID string + addonID string + planAddonID string + phaseKey string + ) + + t.Run("Should create a draft plan with a single flat rate card", func(t *testing.T) { + // Reuse the apiv3 fixture builder (wire-compatible) so the test + // stays in sync with the canonical valid-plan shape. + fixture := validPlanRequest("sanity_plan") + phaseKey = fixture.Phases[0].Key + + body := toSDK[sdkc.CreatePlanRequest](t, fixture) + + res, err := sdk.OpenMeterPlans.CreatePlan(ctx, sdkop.CreatePlanRequest{Plan: body}) + require.NoError(t, err, "CreatePlan") + require.NotNil(t, res.Body) + assert.Equal(t, sdkc.BillingPlanStatusDraft, res.Body.Status) + require.Len(t, res.Body.Phases, 1) + require.Len(t, res.Body.Phases[0].RateCards, 1) + + planID = res.Body.Id + }) + + t.Run("Should update the plan to carry flat + usage + graduated rate cards", func(t *testing.T) { + // Build the same three rate cards via the v3 fixture helpers, then + // project the whole UpsertPlanRequest through JSON into the SDK + // component type. Lets us test the SDK transport without + // hand-coding the BillingRateCard union. + flat := validFlatRateCard("sanity_flat") + usage := validUnitRateCard(apiv3FeatureFromSDK(features[0])) + graduated := validGraduatedRateCard(apiv3FeatureFromSDK(features[1])) + + apiUpdate := apiv3.UpsertPlanRequest{ + Name: "Sanity Plan", + Phases: []apiv3.BillingPlanPhase{{ + Key: phaseKey, + Name: "Sanity Phase", + RateCards: []apiv3.BillingRateCard{flat, usage, graduated}, + }}, + } + + sdkUpdate := toSDK[sdkc.UpsertPlanRequest](t, apiUpdate) + + res, err := sdk.OpenMeterPlans.UpdatePlan(ctx, planID, sdkop.UpdatePlanRequest{Plan: sdkUpdate}) + require.NoError(t, err, "UpdatePlan") + require.NotNil(t, res.Body) + require.Len(t, res.Body.Phases, 1) + assert.Len(t, res.Body.Phases[0].RateCards, 3, "expected three rate cards on the phase") + }) + + // Track the three valid rate cards (as raw JSON) across the + // invalid-loop subtests so "remove defective" PUTs can rebuild the + // phase from the same baseline using server-normalized values. + var validRateCardsJSON []json.RawMessage + + t.Run("Should add a defective rate card and surface validation_errors", func(t *testing.T) { + require.NotEmpty(t, planID) + require.NotEmpty(t, phaseKey) + + // Read the current valid rate cards back. The SDK gives us + // strongly typed BillingRateCard values, but they're a sealed + // union — we serialize them back to JSON and rebuild the + // upsert body via JSON, which avoids re-implementing every + // union variant against the SDK's typed API. + getRes, err := sdk.OpenMeterPlans.GetPlan(ctx, planID) + require.NoError(t, err, "GetPlan") + require.NotNil(t, getRes.Body) + require.Len(t, getRes.Body.Phases, 1) + require.Len(t, getRes.Body.Phases[0].RateCards, 3) + + for _, rc := range getRes.Body.Phases[0].RateCards { + b, err := json.Marshal(rc) + require.NoError(t, err) + validRateCardsJSON = append(validRateCardsJSON, b) + } + + // Defect: a flat rate card whose billing_cadence (P2W) is + // misaligned with the plan's P1M cadence. + defective := validFlatRateCard("defective_cadence") + misaligned := apiv3.ISO8601Duration("P2W") + defective.BillingCadence = &misaligned + + // Build the upsert body as JSON to splice typed and untyped + // rate cards together, then unmarshal into the SDK type. + defectiveJSON, err := json.Marshal(defective) + require.NoError(t, err) + + upsertJSON := map[string]any{ + "name": "Sanity Plan", + "phases": []map[string]any{{ + "key": phaseKey, + "name": "Sanity Phase", + "rate_cards": append(append([]json.RawMessage{}, validRateCardsJSON...), defectiveJSON), + }}, + } + var update sdkc.UpsertPlanRequest + raw, err := json.Marshal(upsertJSON) + require.NoError(t, err) + require.NoError(t, json.Unmarshal(raw, &update)) + + _, err = sdk.OpenMeterPlans.UpdatePlan(ctx, planID, sdkop.UpdatePlanRequest{Plan: update}) + require.NoError(t, err, "update with defective rate card should accept the draft") + + // GET should now show validation_errors on the draft. + got, err := sdk.OpenMeterPlans.GetPlan(ctx, planID) + require.NoError(t, err) + require.NotNil(t, got.Body) + require.NotEmpty(t, got.Body.ValidationErrors, "expected validation_errors on the draft") + + codes := make([]string, 0, len(got.Body.ValidationErrors)) + for _, e := range got.Body.ValidationErrors { + codes = append(codes, e.Code) + } + assert.Contains(t, codes, "rate_card_billing_cadence_unaligned") + + // Publish should reject with 400. The SDK's BadRequestError + // doesn't expose extensions.validationErrors — see + // https://github.com/openmeterio/openmeter — so we only + // assert on the surface error here. + _, err = sdk.OpenMeterPlans.PublishPlan(ctx, planID) + require.Error(t, err, "publish should reject the defective draft") + var bad *sdkerr.BadRequestError + assert.True(t, errors.As(err, &bad), "expected BadRequestError, got %T: %v", err, err) + }) + + t.Run("Should remove the defective rate card and clear validation_errors", func(t *testing.T) { + require.NotEmpty(t, planID) + require.NotEmpty(t, phaseKey) + require.NotEmpty(t, validRateCardsJSON) + + upsertJSON := map[string]any{ + "name": "Sanity Plan", + "phases": []map[string]any{{ + "key": phaseKey, + "name": "Sanity Phase", + "rate_cards": validRateCardsJSON, + }}, + } + var update sdkc.UpsertPlanRequest + raw, err := json.Marshal(upsertJSON) + require.NoError(t, err) + require.NoError(t, json.Unmarshal(raw, &update)) + + res, err := sdk.OpenMeterPlans.UpdatePlan(ctx, planID, sdkop.UpdatePlanRequest{Plan: update}) + require.NoError(t, err, "update removing defective rate card") + require.NotNil(t, res.Body) + assert.Len(t, res.Body.Phases[0].RateCards, 3, "expected three rate cards after removal") + + got, err := sdk.OpenMeterPlans.GetPlan(ctx, planID) + require.NoError(t, err) + require.NotNil(t, got.Body) + assert.Empty(t, got.Body.ValidationErrors, "expected validation_errors to clear after removal") + }) + + t.Run("Should create a draft addon", func(t *testing.T) { + body := toSDK[sdkc.CreateAddonRequest](t, validAddonRequest("sanity_addon")) + + res, err := sdk.OpenMeterAddons.CreateAddon(ctx, sdkop.CreateAddonRequest{Addon: body}) + require.NoError(t, err, "CreateAddon") + require.NotNil(t, res.Body) + assert.Equal(t, sdkc.AddonStatusDraft, res.Body.Status) + addonID = res.Body.Id + }) + + t.Run("Should publish the addon", func(t *testing.T) { + require.NotEmpty(t, addonID) + + res, err := sdk.OpenMeterAddons.PublishAddon(ctx, addonID) + require.NoError(t, err, "PublishAddon") + require.NotNil(t, res.Body) + assert.Equal(t, sdkc.AddonStatusActive, res.Body.Status) + }) + + t.Run("Should attach the published addon to the plan", func(t *testing.T) { + require.NotEmpty(t, planID) + require.NotEmpty(t, addonID) + require.NotEmpty(t, phaseKey) + + body := toSDK[sdkc.CreatePlanAddonRequest](t, validPlanAddonRequest(phaseKey, addonID)) + + res, err := sdk.OpenMeterPlanAddon.CreatePlanAddon(ctx, planID, sdkop.CreatePlanAddonRequest{PlanAddon: body}) + require.NoError(t, err, "CreatePlanAddon") + require.NotNil(t, res.Body) + assert.Equal(t, addonID, res.Body.Addon.Id) + assert.Equal(t, phaseKey, res.Body.FromPlanPhase) + + planAddonID = res.Body.Id + }) + + t.Run("Should publish the plan and keep the attached addon", func(t *testing.T) { + require.NotEmpty(t, planID) + require.NotEmpty(t, planAddonID) + + res, err := sdk.OpenMeterPlans.PublishPlan(ctx, planID) + require.NoError(t, err, "PublishPlan") + require.NotNil(t, res.Body) + assert.Equal(t, sdkc.BillingPlanStatusActive, res.Body.Status) + require.NotNil(t, res.Body.EffectiveFrom) + + // ListPlanAddonsResponse.Body is *map[string]any because the + // SDK's pagination wrapper isn't typed yet. Walk the map. + listRes, err := sdk.OpenMeterPlanAddon.ListPlanAddons(ctx, planID, sdkop.ListPlanAddonsRequest{}) + require.NoError(t, err, "ListPlanAddons") + require.NotNil(t, listRes.Body) + found := planAddonInPage(*listRes.Body, planAddonID) + assert.True(t, found, "attached plan-addon missing after plan publish") + }) +} + +// newSDKClient returns an SDK pointed at $OPENMETER_ADDRESS + /api/v3, and a +// context wired to the test's lifecycle. Skips the test when the env var is +// unset (same convention as newV3Client). +func newSDKClient(t *testing.T) (*sdkpkg.OpenMeter, context.Context) { + t.Helper() + + address := os.Getenv("OPENMETER_ADDRESS") + if address == "" { + t.Skip("OPENMETER_ADDRESS not set") + } + + base := strings.TrimRight(address, "/") + "/api/v3" + sdk := sdkpkg.New(sdkpkg.WithServerURL(base)) + + return sdk, t.Context() +} + +// toSDK projects a wire-compatible source value into the SDK's typed +// component shape by JSON round-trip. Use it when the apiv3 fixture builders +// produce data that should match a particular components.* type. +func toSDK[T any](t *testing.T, src any) T { + t.Helper() + b, err := json.Marshal(src) + require.NoError(t, err) + var dst T + require.NoError(t, json.Unmarshal(b, &dst)) + return dst +} + +// apiv3FeatureFromSDK adapts an SDK Feature into the apiv3 shape so we can +// reuse the v3 fixture builders that take apiv3.Feature. +func apiv3FeatureFromSDK(f sdkc.Feature) apiv3.Feature { + b, _ := json.Marshal(f) + var out apiv3.Feature + _ = json.Unmarshal(b, &out) + return out +} + +// planAddonInPage walks an untyped paginated response and returns true when +// the given plan-addon id appears under data[*].id. The SDK doesn't yet emit +// typed list responses (ListPlanAddonsResponse.Body is *map[string]any). +func planAddonInPage(page map[string]any, id string) bool { + data, _ := page["data"].([]any) + for _, row := range data { + obj, _ := row.(map[string]any) + if obj == nil { + continue + } + if got, _ := obj["id"].(string); got == id { + return true + } + } + return false +} diff --git a/go.mod b/go.mod index 3f15c996e6..f5ff9e4182 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,12 @@ go 1.25.5 // ee: https://github.com/oklog/run/pull/35 replace github.com/oklog/run => github.com/openmeterio/run v0.0.0-20250217124527-c72029d4b634 +// Local path to the generated Go SDK (separate go module) so e2e dogfood tests +// can import it without publishing. +replace github.com/openmeterio/openmeter/api/spec/packages/aip-client-go => ./api/spec/packages/aip-client-go + +require github.com/openmeterio/openmeter/api/spec/packages/aip-client-go v0.0.0 + require ( cirello.io/pglock v1.16.1 entgo.io/ent v0.14.6