agenttwin 0.3.37 → 0.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +25518 -16009
- package/dist/cli.js +49 -2
- package/dist/dashboard/assets/next/static/chunks/{1937-2369d8ef2eae7700.js → 1937-6c86fddc443de922.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/424-5191e91fec0be2c7.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-f05b53aa432a7110.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/about/page-8378255082922f7c.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/account/password/{page-0478a7f18cc5e31b.js → page-4db0777af7564cb4.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/auth/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/blog/layout-d92d0846e7847b0f.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/compare/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/contact/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-cbd7e31c6d430a1a.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-f45f96c066eb9de2.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/demo/{page-ac6e235c635cb130.js → page-db243af5ea4b6376.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/developers/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-83fc0a3aa3425b02.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/dpa/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-2451558ccbe066c9.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/guides/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/{layout-8aa153f632f0aa20.js → layout-13d2f06cab6f3ef6.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/login/page-589519cc705ec22f.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/not-found-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-c4292b08dedb1e5c.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/page-bfcf9194963bf52b.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/pricing/page-e65353f9ee62da36.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/privacy/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/security/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/signup/page-589519cc705ec22f.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/status/page-47f0d1533bf1206f.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/terms/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-76020499f90782bd.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-cb63082b6709d22e.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/layout-d3227c5987005526.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-40a3cf0903538784.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/{page-7c08d2c43f0be9d5.js → page-921ad64530803c42.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-d0b682a723aa566f.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-40a3cf0903538784.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-6706d2afc96be601.js +1 -0
- package/dist/dashboard/assets/next/static/chunks/{main-app-4051d8ba998bea15.js → main-app-cc626a1cec570e8f.js} +1 -1
- package/dist/dashboard/assets/next/static/chunks/{webpack-b1e92d10ff1fbc69.js → webpack-a48857e1e72fd84a.js} +1 -1
- package/dist/dashboard/assets/next/static/css/4bee95c06986ad43.css +1 -0
- package/dist/dashboard/assets/next/static/css/75f812c09155fe4d.css +1 -0
- package/dist/dashboard/assets/next/static/css/8b41516b04992d45.css +1 -0
- package/dist/dashboard/assets/next/static/css/923568b6c3a9a99a.css +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/discover-worker.js +5800 -0
- package/dist/engine.js +22482 -8402
- package/dist/gateway.js +25520 -16006
- package/dist/scan-worker.js +3312 -0
- package/dist/twins/catalog.json +122 -161
- package/dist/twins/packs/algolia/index.mjs +1 -1
- package/dist/twins/packs/openai/index.mjs +4 -4
- package/dist/twins/packs/polar/index.mjs +1 -1
- package/dist/twins/packs/slack/index.mjs +1 -1
- package/dist/twins/packs/stripe/index.mjs +7 -7
- package/dist/twins/packs/twilio/index.mjs +1 -1
- package/dist/worker.js +2375 -2153
- package/dist/world-host.js +3149 -2876
- package/package.json +4 -1
- package/dist/dashboard/assets/next/static/chunks/424-83736cfafc224fc6.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/_not-found/page-b60a5aad66f3bf1d.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/about/page-a30c6925cc9ac983.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/api-policy/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/auth/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/blog/layout-6c159db381b82832.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/compare/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/contact/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/layout-0050f308b9f77c24.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dashboard/page-3d8c07ca2af8081c.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/developers/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-c86920ba0d1f3bc0.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/dpa/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/enterprise/page-11514cc52285b7f3.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/guides/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/login/page-99ebb4d265222728.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/not-found-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-9e59af0296c9366b.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/page-76277dc68b6a22bd.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/pricing/page-c7015af858f4db8e.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/privacy/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/sandbox/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/scoreboard/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/security/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/signup/page-99ebb4d265222728.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/status/page-fd41c4e7838d9949.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/subprocessors/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/terms/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/layout-a79d128eb3b0b7d2.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/page-a9fa05c9ae5c24dc.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/layout-2e97381ae7a59ba0.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/login/page-57afbac97afd31fa.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/page-35998431fb40a9c9.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/v2/signup/page-57afbac97afd31fa.js +0 -1
- package/dist/dashboard/assets/next/static/chunks/app/what-is-agenttwin/page-91ad6c5e4226778f.js +0 -1
- package/dist/dashboard/assets/next/static/css/2c38dfe54afd9bb6.css +0 -1
- package/dist/dashboard/assets/next/static/css/605ac70c9cf7a260.css +0 -1
- package/dist/dashboard/assets/next/static/css/734b61a26b31f1d1.css +0 -1
- package/dist/dashboard/assets/next/static/css/96134c7d160c4fc3.css +0 -1
- package/dist/twins/packs/vgauth/LICENSE +0 -202
- package/dist/twins/packs/vgauth/NOTICE +0 -7
- package/dist/twins/packs/vgauth/index.mjs +0 -2
- /package/dist/dashboard/assets/next/static/{RsIyq0Rz3py_mKuoIqn42 → KNTxh0SQ8GqNZPTSXNcRe}/_buildManifest.js +0 -0
- /package/dist/dashboard/assets/next/static/{RsIyq0Rz3py_mKuoIqn42 → KNTxh0SQ8GqNZPTSXNcRe}/_ssgManifest.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
|
|
2
|
-
var Qe=Object.defineProperty;var Ge=(t,e)=>{for(var r in e)Qe(t,r,{get:e[r],enumerable:!0})};import{packOf as Rt,registerPack as jt}from"../../engine/v3/volter_world-core.mjs";function w(t,e){return e.id!==void 0?u(t,b).find(r=>r.id===e.id):u(t,b).find(r=>r.external_id===e.external)}var He="organization",b="customer",S="product",k="checkout",y="subscription",R="order",D="event",B="meter",G="customer_session",se="webhook_endpoint",de="https://buy.polar.sh",Ye="https://polar.sh",M=(t,e,r)=>Response.json({error:e,detail:r},{status:t}),P=t=>M(404,"ResourceNotFound",`${t} not found.`),m=(t,e,r="value_error")=>Response.json({detail:[{type:r,loc:["body",...t],msg:e,input:null}]},{status:422}),g=t=>m([t],"Field required","missing"),q=t=>t.body&&typeof t.body=="object"&&!Array.isArray(t.body)?t.body:{},Ze={product:"Product",checkout:"Checkout",subscription:"Subscription",order:"Order",webhook_endpoint:"WebhookEndpoint"},E=(t,e)=>t.mint(Ze[e]??e);async function A(t,e,r){let a=await t.secret(`polar-secret:${r}`),s=await t.secret(`polar-secret:${r}:2`);return`${e}${`${a}${s}`.replace(/[^A-Za-z0-9]/g,"").slice(0,43)}`}var Je="1dbfc517-0bbf-4301-9ba8-555ca42b9737",O=t=>p(t)==="sandbox"?"2dbfc517-0bbf-4301-9ba8-555ca42b9737":Je,ne=t=>{let e=d(t,He,"org")??{};return{created_at:e.created_at??"2026-01-01T00:00:00Z",modified_at:null,id:O(t),name:e.name??"Twin organization",slug:e.slug??"twin",avatar_url:null,proration_behavior:"prorate",allow_customer_updates:!0,email:null,website:null,socials:[],status:"active",details_submitted_at:null,onboarding_resubmission_requested_at:null,sso_enforced:!1,default_presentment_currency:"usd",default_tax_behavior:"location",feature_settings:{},subscription_settings:{allow_multiple_subscriptions:!1,allow_customer_updates:!0,proration_behavior:"prorate",benefit_revocation_grace_period:0,prevent_trial_abuse:!1},customer_email_settings:{},customer_portal_settings:{},dispute_settings:{},embed_hosts:[],embed_hosts_enforced:!1,account_id:null,payout_account_id:null,capabilities:{}}},C=(t,e,r)=>t.params[e]===void 0||[].concat(t.params[e]).map(String).includes(String(r)),T=t=>(e,r)=>String(r[t]).localeCompare(String(e[t])),p=t=>new URL(t.call.request.url).hostname.startsWith("sandbox")?"sandbox":"production",u=(t,e)=>t.rowsRaw(e).filter(r=>r.deleted!==!0&&(r._environment??(r.organization_id==="2dbfc517-0bbf-4301-9ba8-555ca42b9737"?"sandbox":"production"))===p(t)),d=(t,e,r)=>u(t,e).find(a=>a.id===r),I=(t,e)=>Object.fromEntries(Object.entries(t.own(e)).filter(([r])=>!r.startsWith("_"))),x=(t,e)=>I(t,e),L=(t,e)=>I(t,e),W=(t,e)=>I(t,e),N=(t,e)=>I(t,e),le=(t,e)=>I(t,e),$=(t,e)=>I(t,e);function H(t,e){return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,metadata:e.metadata??{},external_id:e.external_id??null,email:e.email,email_verified:e.email_verified??!1,type:"individual",name:e.name??null,billing_name:e.billing_name??null,billing_address:e.billing_address??null,tax_id:e.tax_id??null,locale:e.locale??null,organization_id:O(t),default_payment_method_id:null,deleted_at:e.deleted_at??null,first_user_event_at:e.first_user_event_at??null,avatar_url:`https://www.gravatar.com/avatar/${String(e.email??"")}?d=404`}}function Y(t,e,r){let a={created_at:r.created_at,modified_at:null,id:e.id,source:e.source??"catalog",amount_type:e.amount_type,price_currency:e.price_currency??"usd",tax_behavior:null,is_archived:e.is_archived??!1,product_id:r.id};if(e.amount_type==="fixed")return{...a,price_amount:e.price_amount};if(e.amount_type==="custom")return{...a,minimum_amount:e.minimum_amount??null,maximum_amount:e.maximum_amount??null,preset_amount:e.preset_amount??null};if(e.amount_type!=="metered_unit")return a;let s=d(t,B,String(e.meter_id));return{...a,unit_amount:String(e.unit_amount??"0"),cap_amount:e.cap_amount??null,meter_id:e.meter_id,meter:{id:e.meter_id,name:s?.name??"",unit:s?.unit??"scalar",custom_label:s?.custom_label??null,custom_multiplier:s?.custom_multiplier??null}}}function ce(t,e){return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,trial_interval:e.trial_interval??null,trial_interval_count:e.trial_interval_count??null,name:e.name,description:e.description??null,visibility:e.visibility??"public",recurring_interval:e.recurring_interval??null,recurring_interval_count:e.recurring_interval?Number(e.recurring_interval_count??1):null,meter_interval:null,meter_interval_count:null,is_recurring:e.recurring_interval!=null,is_archived:e.is_archived??!1,organization_id:O(t),metadata:e.metadata??{},prices:e.prices??[],benefits:[],medias:[],attached_custom_fields:[]}}function me(t,e){let r=d(t,b,String(e.customer_id)),a=d(t,S,String(e.product_id));return{created_at:e.created_at,modified_at:e.modified_at??null,id:e.id,amount:e.amount??0,currency:e.currency??"usd",recurring_interval:e.recurring_interval,recurring_interval_count:Number(e.recurring_interval_count??1),status:e.status,current_period_start:e.current_period_start,current_period_end:e.current_period_end??null,current_meter_period_start:null,current_meter_period_end:null,trial_start:e.trial_start??null,trial_end:e.trial_end??null,cancel_at_period_end:e.cancel_at_period_end??!1,canceled_at:e.canceled_at??null,started_at:e.started_at??null,ends_at:e.ends_at??null,ended_at:e.ended_at??null,pause_at_period_end:!1,paused_at:null,resumes_at:null,customer_id:e.customer_id,product_id:e.product_id,discount_id:e.discount_id??null,checkout_id:e.checkout_id??null,customer_cancellation_reason:e.customer_cancellation_reason??null,customer_cancellation_comment:e.customer_cancellation_comment??null,metadata:e.metadata??{},custom_field_data:{},customer:r?x(t,r):null,product:a?L(t,a):null,discount:null,prices:e.prices??a?.prices??[],meters:e.meters??[],pending_update:null}}function Xe(t,e){let r=d(t,b,String(e.customer_id)),a=e.product_id?d(t,S,String(e.product_id)):void 0,s=e.subscription_id?d(t,y,String(e.subscription_id)):void 0,n=Number(e.total_amount??0),i=Number(e.refunded_amount??0);return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,status:e.status,paid:["paid","refunded","partially_refunded"].includes(String(e.status)),subtotal_amount:n,discount_amount:0,net_amount:n,tax_amount:0,total_amount:n,applied_balance_amount:0,due_amount:0,refunded_amount:i,refunded_tax_amount:0,currency:e.currency??"usd",billing_reason:e.billing_reason,billing_name:null,billing_address:null,invoice_number:`TWIN-${String(e.number??1).padStart(4,"0")}`,is_invoice_generated:!1,receipt_number:null,customer_id:e.customer_id,product_id:e.product_id??null,discount_id:null,subscription_id:e.subscription_id??null,checkout_id:e.checkout_id??null,metadata:e.metadata??{},custom_field_data:{},platform_fee_amount:0,platform_fee_currency:null,customer:r?x(t,r):null,product:a?(({prices:c,benefits:o,medias:l,attached_custom_fields:h,..._})=>_)(L(t,a)):null,discount:null,subscription:s?(({customer:c,product:o,discount:l,prices:h,meters:_,pending_update:v,...F})=>F)(W(t,s)):null,items:e.items??[],description:a?.name??"Order",refundable_amount:n-i,refundable_tax_amount:0}}function pe(t,e){let r=e.customer_id?d(t,b,String(e.customer_id)):void 0;return{id:e.id,timestamp:e.timestamp,organization_id:O(t),customer_id:e.customer_id??null,customer:r&&r.deleted!==!0?x(t,r):null,external_customer_id:e.external_customer_id??null,member_id:null,external_member_id:null,child_count:0,parent_id:null,label:e.name,name:e.name,source:"user",metadata:e.metadata??{}}}function _e(t,e){let r=d(t,S,String(e.product_id)),a=r?L(t,r):null,s=e.prices?.[String(e.product_id)]??a?.prices??[],n=s.find(c=>c.id===e.product_price_id)??s[0]??null,i=Number(e.amount??0);return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,payment_processor:"stripe",status:e.status,client_secret:e.client_secret,url:`${de}/${String(e.client_secret)}`,expires_at:e.expires_at,success_url:e.success_url??`${de}/${String(e.client_secret)}/confirmation`,return_url:e.return_url??null,embed_origin:e.embed_origin??null,amount:i,discount_amount:0,net_amount:i,tax_amount:null,tax_behavior:null,total_amount:i,currency:e.currency??"usd",allow_trial:e.allow_trial??null,active_trial_interval:r?.trial_interval??null,active_trial_interval_count:r?.trial_interval_count??null,trial_end:null,organization_id:O(t),product_id:e.product_id,product_price_id:n?.id??null,discount_id:null,allow_discount_codes:e.allow_discount_codes??!0,require_billing_address:e.require_billing_address??!1,is_discount_applicable:!1,is_free_product_price:i===0,is_payment_required:i>0,is_payment_setup_required:a?.is_recurring===!0,is_payment_form_required:i>0,customer_id:e.customer_id??null,is_business_customer:e.is_business_customer??!1,customer_name:e.customer_name??null,customer_email:e.customer_email??null,customer_ip_address:e.customer_ip_address??null,customer_billing_name:null,customer_billing_address:null,customer_tax_id:null,payment_method_type:null,payment_processor_metadata:{},billing_address_fields:{country:"required",state:"disabled",city:"disabled",postal_code:"disabled",line1:"disabled",line2:"disabled"},trial_interval:null,trial_interval_count:null,metadata:e.metadata??{},external_customer_id:e.external_customer_id??null,custom_field_data:{},products:a?[a]:[],product:a,product_price:n,prices:a?{[String(a.id)]:s}:{},discount:null,subscription_id:e.subscription_id??null,attached_custom_fields:[],customer_metadata:e.customer_metadata??{}}}function K(t,e){let r=t?.clauses??[];if(r.length===0)return!0;let a=s=>{if("clauses"in s)return K(s,e);let n=String(s.property??""),i=n==="name"||n==="source"?e[n]:(e.metadata??{})[n.replace(/^metadata\./,"")],c=s.value;return String(i)===String(c)};return String(t?.conjunction??"and")==="or"?r.some(a):r.every(a)}function ye(t,e){let r=String(t?.func??"count");if(r==="count")return e.length;let a=String(t?.property??"").replace(/^metadata\./,"");if(r==="unique")return new Set(e.map(i=>(i.metadata??{})[a])).size;let s=e.map(i=>Number((i.metadata??{})[a])).filter(Number.isFinite);if(s.length===0)return 0;if(r==="max")return Math.max(...s);if(r==="min")return Math.min(...s);let n=s.reduce((i,c)=>i+c,0);return r==="avg"?n/s.length:n}function et(t,e,r){let a=u(t,D).filter(i=>i.customer_id===e&&K(r.filter,i)),s=ye(r.aggregation,a),n=0;return{consumed:s,credited:n,balance:n-s}}async function fe(t,e){let r=String(e.id);for(let s of u(t,B))if(!u(t,"_customer_meter").some(n=>n.customer_id===r&&n.meter_id===s.id)){let n=t.mint("_customer_meter");await t.record("_customer_meter",{id:n,customer_id:r,meter_id:s.id,_environment:p(t)},n)}let a=u(t,y).filter(s=>s.customer_id===r&&(s.status==="active"||s.status==="trialing"));return{...x(t,e),active_subscriptions:a.map(s=>{let n=W(t,s);return{id:n.id,created_at:n.created_at,modified_at:n.modified_at,metadata:n.metadata,status:n.status,amount:n.amount,currency:n.currency,recurring_interval:n.recurring_interval,current_period_start:n.current_period_start,current_period_end:n.current_period_end,trial_start:n.trial_start,trial_end:n.trial_end,cancel_at_period_end:n.cancel_at_period_end,canceled_at:n.canceled_at,started_at:n.started_at,ends_at:n.ends_at,product_id:n.product_id,discount_id:n.discount_id,meters:[],custom_field_data:{}}}),granted_benefits:[],active_meters:u(t,B).map(s=>{let{consumed:n,credited:i,balance:c}=et(t,r,s);return{id:u(t,"_customer_meter").find(o=>o.customer_id===r&&o.meter_id===s.id).id,created_at:s.created_at,modified_at:null,meter_id:s.id,consumed_units:n,credited_units:i,balance:c}})}}async function Z(t,e,r,a){let s=E(t,R),n=Number(t.mint("_seq_order"));await t.record("_seq_order",{},String(n));let i=d(t,S,String(e.product_id)),c=e.prices&&!Array.isArray(e.prices)?e.prices[String(i.id)]:e.prices,o=[];for(let _ of c??i.prices){let v=_.amount_type==="fixed"?Number(_.price_amount):_.amount_type==="custom"?Number(e.amount??0):0;if(_.amount_type==="metered_unit"&&a){let Q=d(t,B,String(_.meter_id)),f=u(t,D).filter(j=>j.customer_id===e.customer_id&&String(j._received_at??j.timestamp)>=a.start&&String(j._received_at??j.timestamp)<a.end&&K(Q.filter,j));v=Math.ceil(ye(Q.aggregation,f)*Number(_.unit_amount)),_.cap_amount!=null&&(v=Math.min(v,Number(_.cap_amount)))}let F=t.mint("_order_item");await t.record("_order_item",{},F),o.push({id:F,created_at:t.occurredAt,modified_at:null,label:i.name,amount:v,tax_amount:0,proration:!1,product_price_id:_.id})}let l=o.reduce((_,v)=>_+Number(v.amount),0),h=Xe(t,{id:s,created_at:t.occurredAt,modified_at:null,status:"pending",total_amount:l,currency:e.currency??"usd",refunded_amount:0,billing_reason:r,customer_id:e.customer_id,product_id:e.product_id,subscription_id:e.subscription_id??null,checkout_id:e.checkout_id??e.id,metadata:e.metadata??{},number:n,items:o});await t.write(R,s,{...h,_environment:p(t)},"order.create"),t.legal("Order","status","order.pay","pending","paid",s,"vendor"),await t.write(R,s,{status:"paid",paid:!0,modified_at:t.occurredAt},"order.pay")}function J(t,e,r){let a=new Date(t);if(e==="day"||e==="week")a.setUTCDate(a.getUTCDate()+r*(e==="week"?7:1));else{let s=a.getUTCDate();a.setUTCDate(1),e==="year"?a.setUTCFullYear(a.getUTCFullYear()+r):a.setUTCMonth(a.getUTCMonth()+r);let n=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()+1,0)).getUTCDate();a.setUTCDate(Math.min(s,n))}return a.toISOString()}async function X(t,e,r=null){let a=E(t,G),s=await A(t,"polar_cst_",`session:${a}`),n={id:a,created_at:t.occurredAt,modified_at:null,token:s,expires_at:new Date(Date.parse(t.occurredAt)+36e5).toISOString(),return_url:r,customer_portal_url:`${Ye}/${String(ne(t).slug)}/portal?customer_session_token=${s}`,customer_id:e.id,customer:x(t,e)};return await t.write(G,a,{...n,_environment:p(t)},"customer_session.create"),n}async function be(t){let e=q(t).events;if(!Array.isArray(e))return g("events");for(let[s,n]of e.entries()){if(!n||typeof n.name!="string")return m(["events",s,"name"],"Field required","missing");if(n.customer_id!==void 0&&!w(t,{id:n.customer_id}))return m(["events",s,"customer_id"],"Customer does not exist.")}let r=0,a=0;for(let s of e){if(s.external_id!=null&&u(t,"_event_key").some(c=>c.external_id===s.external_id)){a+=1;continue}let n=s.customer_id!==void 0?w(t,{id:s.customer_id}):s.external_customer_id!==void 0?w(t,{external:s.external_customer_id}):void 0,i=E(t,D);await t.write(D,i,{...pe(t,{id:i,timestamp:s.timestamp??t.occurredAt,name:s.name,customer_id:n?.id??null,external_customer_id:s.external_customer_id??null,metadata:s.metadata??{}}),_environment:p(t),_received_at:t.occurredAt},"event.ingest"),s.external_id!=null&&await t.record("_event_key",{external_id:s.external_id,_environment:p(t)}),r+=1}return Response.json({inserted:r,duplicates:a})}async function ge(t){let e=t.params.meter_id===void 0?void 0:d(t,B,String(t.params.meter_id));if(t.params.meter_id!==void 0&&(!e||e.deleted===!0))return P("Meter");let r=t.params.start_timestamp===void 0?void 0:Date.parse(String(t.params.start_timestamp)),a=t.params.end_timestamp===void 0?void 0:Date.parse(String(t.params.end_timestamp)),s=String(t.params.query??"").toLowerCase(),n=u(t,D).filter(i=>C(t,"customer_id",i.customer_id)&&C(t,"external_customer_id",i.external_customer_id)&&C(t,"name",i.name)&&C(t,"source","user")).filter(i=>!e||K(e.filter,i)).filter(i=>(r===void 0||Date.parse(String(i.timestamp))>r)&&(a===void 0||Date.parse(String(i.timestamp))<a)).filter(i=>s===""||String(i.name).toLowerCase().includes(s)).sort(T("timestamp"));return t.list(D,n.map(i=>le(t,i)))}function qe(t,e){let r=String(e.body.id??""),a=d(t,e.storedType,r)??e.body;return e.storedType===k?$(t,a):N(t,a)}function he(t){return{$environment:p(t)}}var rt={initial:"open",transitions:[{operation:"checkouts:client_confirm",actor:"external",from:["open"],to:"confirmed",source:'spec:checkouts:client_confirm "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments."'},{operation:"checkouts:client_confirm",actor:"external",from:["confirmed","succeeded","failed","expired"],refusal:{status:403,code:"CheckoutForbiddenError",message:"The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments."},source:'spec:checkouts:client_confirm "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments."'},{actor:"vendor",from:["confirmed"],to:"succeeded",source:'spec:checkouts:client_confirm "Orders and subscriptions will be processed."'},{actor:"time",from:["open"],to:"expired",source:'spec:checkouts:client_confirm "The checkout session is expired."'}]},at={initial:"incomplete",transitions:[{operation:"checkouts:client_confirm",actor:"external",from:["active","trialing"],refusal:{status:403,code:"CheckoutForbiddenError",message:"The customer already has an active subscription."},source:'spec:checkouts:client_confirm "the customer already has an active subscription"'},{actor:"vendor",from:["incomplete"],to:"active",source:'spec:/components/schemas/SubscriptionStatus "active"'},{actor:"vendor",from:["incomplete"],to:"trialing",source:'spec:/components/schemas/SubscriptionStatus "trialing"'},{actor:"time",from:["trialing"],to:"active",source:'https://polar.sh/docs/features/subscriptions/trials "Once the trial period ends, the customer will be automatically charged for the subscription, and their billing cycle will begin."'},{operation:"subscriptions:update",actor:"api",from:["active","trialing"],source:'spec:/components/schemas/SubscriptionCancel/properties/cancel_at_period_end "Cancel an active subscription once the current period ends."'},{operation:"subscriptions:update",actor:"api",from:["incomplete","incomplete_expired","past_due","canceled","unpaid","paused"],refusal:{status:403,code:"NotActiveSubscription",message:"Subscription is already canceled or will be at the end of the period, or is not active."},source:'spec:subscriptions:update "Subscription is already canceled or will be at the end of the period, or is not active."'},{actor:"time",from:["active","trialing"],to:"canceled",source:'spec:/components/schemas/SubscriptionCancel/properties/cancel_at_period_end "Cancel an active subscription once the current period ends."'}]},st={initial:"pending",transitions:[{actor:"vendor",from:["pending"],to:"paid",source:'spec:/components/schemas/OrderStatus "paid"'},{operation:"refunds:create",actor:"api",from:["paid","partially_refunded"],to:"partially_refunded",source:'spec:/components/schemas/OrderStatus "partially_refunded"'},{operation:"refunds:create",actor:"api",from:["paid","partially_refunded"],to:"refunded",source:'spec:/components/schemas/OrderStatus "refunded"'},{operation:"refunds:create",actor:"api",from:["refunded"],refusal:{status:403,code:"RefundedAlready",message:"Order is already fully refunded."},source:'spec:refunds:create "Order is already fully refunded."'}]},U={Product:{notState:["visibility","trial_interval","recurring_interval","meter_interval","is_recurring","is_archived"]},Checkout:{state:{status:rt},notState:["is_business_customer","is_discount_applicable","is_free_product_price","is_payment_form_required","is_payment_required","is_payment_setup_required"]},Subscription:{state:{status:at},notState:["recurring_interval","cancel_at_period_end"]},Order:{state:{status:st},notState:["billing_reason","is_invoice_generated","paid"]},Meter:{notState:["unit"]},WebhookEndpoint:{notState:["format"]}};var ee={vendor:"polar",service:"polar",tenant:{field:"organization_id"},body:{json:"always",validation:{operations:["meters:create"],status:422,missing:{detail:[{type:"missing",loc:["body","{name}"],msg:"Field required",input:"{input}"}]},type:{detail:[{type:"{type}_type",loc:["body","{name}"],msg:"Input should be a valid {type}",input:"{input}"}]},range:{detail:[{type:"value_error",loc:["body","{name}"],msg:"Input is outside the permitted range",input:"{input}"}]}}},ids:{template:"{uuid}"},time:"iso",error:{error:"{code}",detail:"{message}"},readOnly:{status:403,code:"NotPermitted",message:"This twin was started read-only; writes are refused."},malformedBody:{status:422,code:"RequestValidationError",message:"JSON decode error"},notFound:{status:404,code:"ResourceNotFound",message:"Not found"},variants:{"meters:create":["filter.clauses[].operator=ne","filter.clauses[].operator=gt","filter.clauses[].operator=gte","filter.clauses[].operator=lt","filter.clauses[].operator=lte","filter.clauses[].operator=like","filter.clauses[].operator=not_like","filter.clauses[].clauses[].operator=ne","filter.clauses[].clauses[].operator=gt","filter.clauses[].clauses[].operator=gte","filter.clauses[].clauses[].operator=lt","filter.clauses[].clauses[].operator=lte","filter.clauses[].clauses[].operator=like","filter.clauses[].clauses[].operator=not_like"]},list:{style:"envelope",envelope:{items:"{data}",pagination:{total_count:"{total_count}",max_page:"{max_page}"}},limit:{param:"limit",default:10,max:100},page:{param:"page",link:!1}},deleted:{},auth:{header:"authorization",scheme:"Bearer",gateWhenAbsent:!1,invalidKeys:[],missing:{status:401,code:"Unauthorized",message:"Unauthorized"},invalid:{status:401,code:"Unauthorized",message:"Unauthorized"}},events:{scheme:{kind:"webhook-id",prefix:"webhook",secretKey:"utf8"},types:{"checkout.create":"checkout.created","order.create":"order.created","order.pay":"order.paid","order.refund":"order.refunded"},envelope:{type:"$type",timestamp:"$time.iso",data:"$data"},endpoints:{storedAs:"webhook_endpoint",url:"url",secret:"secret",filter:"events",enabled:"enabled",match:{_environment:"$environment",format:"raw"}},record:"_webhook_delivery",render:qe,values:he},unmodeled:["checkouts:update","meters:get","meters:update","orders:create","orders:update","products:update","products:update_benefits","subscriptions:create","subscriptions:revoke","webhooks:get_webhook_endpoint","webhooks:update_webhook_endpoint","webhooks:delete_webhook_endpoint"],ingest:{scheme:{kind:"webhook-id",prefix:"webhook",secretKey:"utf8"},type:{body:"type"},object:"data",types:{"customer.created":{resource:"customer"},"customer.updated":{resource:"customer"},"customer.deleted":{resource:"customer",deleted:!0},"product.created":{resource:"Product"},"product.updated":{resource:"Product"},"checkout.created":{resource:"Checkout"},"checkout.updated":{resource:"Checkout"},"order.created":{resource:"Order"},"order.paid":{resource:"Order"},"order.updated":{resource:"Order"},"order.refunded":{resource:"Order"},"subscription.created":{resource:"Subscription"},"subscription.active":{resource:"Subscription"},"subscription.updated":{resource:"Subscription"},"subscription.canceled":{resource:"Subscription"},"subscription.uncanceled":{resource:"Subscription"},"subscription.revoked":{resource:"Subscription"}}},rateBudget:{allowance:{perMinute:100,source:"https://polar.sh/docs/api-reference/introduction"},windowMs:6e4,ceiling:90,defaultWeight:1,maxRetryAfterSeconds:300,rules:[],reason:"Polar documents 500 requests a minute per organization, customer or OAuth2 client in production and 100 in the sandbox, answering 429 with Retry-After over it (polar.sh/docs/api-reference/introduction, Rate Limits); 90 a minute stays under the sandbox's limit."},discovery:{twinOf:"Polar (api.polar.sh) as Volter's billing and Open Autonomy's patronage call it: meters and products, checkouts paid on the hosted checkout page and read back, the orders they make, customers and their state by the application's own id, customer sessions for the portal, usage events, and the signed webhooks of an organization's endpoints",stores:"the organization's meters and products, customers, checkouts and the subscriptions and orders they make, usage events, customer sessions, webhook endpoints, and the webhooks it sent"},doors:[{id:"accessTokens",method:"POST",path:"/_twin/access-tokens",note:"{ comment, expires_in_days? }: an Organization Access Token made on the settings page (shown once)"},{id:"revokeToken",method:"DELETE",path:"/_twin/access-tokens/{n}",note:"a token revoked on the settings page"},{id:"appCredentials",method:"POST",path:"/_twin/app-credentials",note:"the access token an application holds, as the runtime issues it"},{id:"deliveries",method:"GET",path:"/_twin/deliveries",note:"?to=<url>&type=<event>: every webhook Polar sent, in order, as the receiving server got it"}],screens:[{id:"checkout",kind:"flow",host:"buy.polar.sh",path:"/{client_secret}",demand:"every checkout an application sends a customer to (Twin's biller, Open Autonomy's patronage)",status:"done",controls:["email","pay"],source:"https://polar.sh/docs/features/checkout/session"},{id:"portal",kind:"flow",host:"polar.sh",path:"/{slug}/portal",demand:"a customer session's customer_portal_url (Twin's biller, Manage billing)",status:"done",controls:[],source:"https://polar.sh/docs/features/customer-portal"}],resources:{_access_token:{idPrefix:"oat_",ids:"{prefix}{n}"},_customer_meter:{idPrefix:"",ids:"{uuid}"},_order_item:{idPrefix:"",ids:"{uuid}"},_refund:{idPrefix:"",ids:"{uuid}"},_event_key:{idPrefix:"event_key_"},_price:{idPrefix:"",ids:"{uuid}"},_seq_order:{idPrefix:"",ids:"{n}"},customer:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},idPrefix:"",refresh:{list:"customers:list",items:"items"}},Product:{storedAs:"product",...U.Product,orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},idPrefix:"",refresh:{list:"products:list"}},event:{orderBy:{param:"sorting",default:"-timestamp",fields:["timestamp"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},idPrefix:"",refresh:{list:"events:list",items:"items"}},customer_session:{idPrefix:"",refresh:{none:"a customer session is a token answered once, by its create; the API lists none and reads none back"}},Meter:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at","name"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"meter",idPrefix:"",...U.Meter,filters:["name"],order:{field:"created_at",direction:"desc"},refresh:{list:"meters:list"},assigned:{unit:{value:"scalar"},created_at:{now:!0},modified_at:{value:null},archived_at:{value:null},metadata:{value:{}}}},WebhookEndpoint:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"webhook_endpoint",idPrefix:"",...U.WebhookEndpoint,order:{field:"created_at",direction:"desc"},refresh:{list:"webhooks:list_webhook_endpoints"}},Checkout:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"checkout",idPrefix:"",...U.Checkout,refresh:{list:"checkouts:list"}},Subscription:{orderBy:{param:"sorting",default:"-started_at",fields:["started_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"subscription",idPrefix:"",...U.Subscription,refresh:{list:"subscriptions:list"}},Order:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"order",idPrefix:"",...U.Order,refresh:{list:"orders:list"}}},descriptor:{protocol:"3",transport:"rest",archetype:"crud",bin:"world-polar",resources:["customer","product","checkout","subscription","order","event","meter","customer_session","webhook_endpoint"],specSource:"Polar's OpenAPI document, 2026-04 (spec/openapi.json.gz, provenance in spec/SOURCE.md)",description:"Polar twin \u2014 meters and products with their prices, checkouts with the hosted checkout page, the orders and subscriptions a paid checkout makes, customers and their state (subscriptions and meters) by the application's own id, customer sessions, usage events, webhook endpoints, and webhooks signed as Polar's SDK verifies them.",adoption:{sdks:["@polar-sh/sdk"],pypi:["polar-sdk"],scopes:["@polar-sh/"],envStems:["POLAR"]},credentialDoor:{path:"/_twin/app-credentials",body:{},fill:{POLAR_ACCESS_TOKEN:"access_token",POLAR_API_KEY:"access_token",POLAR_ORGANIZATION_TOKEN:"access_token"}},hosts:[{host:"api.polar.sh"},{host:"sandbox-api.polar.sh"},{host:"buy.polar.sh"},{host:"polar.sh",pathPattern:"^/[^/]+/portal"},{host:"sandbox.polar.sh"}],endpointEnvNone:"@polar-sh/sdk reads no base-URL variable: its `server` option picks production or sandbox, both claimed by the host rules."}};var te={generatedBy:"scripts/derive-pack.ts",spec:"openapi.json.gz",format:"openapi",version:"2026-04",resources:[{name:"Checkout",schema:"Checkout",fields:[{name:"active_trial_interval",type:"union",nullable:!1,required:!0},{name:"active_trial_interval_count",type:"union",nullable:!1,required:!0},{name:"allow_discount_codes",type:"boolean",nullable:!1,required:!0},{name:"allow_trial",type:"union",nullable:!1,required:!0},{name:"amount",type:"integer",nullable:!1,required:!0},{name:"attached_custom_fields",type:"union",nullable:!1,required:!0},{name:"billing_address_fields",type:"CheckoutBillingAddressFields",nullable:!1,required:!0},{name:"client_secret",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer_billing_address",type:"union",nullable:!1,required:!0},{name:"customer_billing_name",type:"union",nullable:!1,required:!0},{name:"customer_email",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"union",nullable:!1,required:!0},{name:"customer_ip_address",type:"union",nullable:!1,required:!0},{name:"customer_metadata",type:"object",nullable:!1,required:!0},{name:"customer_name",type:"union",nullable:!1,required:!0},{name:"customer_tax_id",type:"union",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"embed_origin",type:"union",nullable:!1,required:!0},{name:"expires_at",type:"string",nullable:!1,required:!0},{name:"external_customer_id",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"is_business_customer",type:"boolean",nullable:!1,required:!0},{name:"is_discount_applicable",type:"boolean",nullable:!1,required:!0},{name:"is_free_product_price",type:"boolean",nullable:!1,required:!0},{name:"is_payment_form_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_setup_required",type:"boolean",nullable:!1,required:!0},{name:"locale",type:"union",nullable:!1},{name:"max_seats",type:"union",nullable:!1},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"min_seats",type:"union",nullable:!1},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"payment_method_type",type:"union",nullable:!1,required:!0},{name:"payment_processor",type:"PaymentProcessor",nullable:!1,required:!0,enum:["stripe"]},{name:"payment_processor_metadata",type:"object",nullable:!1,required:!0},{name:"prices",type:"union",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"product_price",type:"union",nullable:!1,required:!0},{name:"product_price_id",type:"union",nullable:!1,required:!0},{name:"products",type:"array",nullable:!1,required:!0},{name:"require_billing_address",type:"boolean",nullable:!1,required:!0},{name:"return_url",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"CheckoutStatus",nullable:!1,required:!0,enum:["open","expired","confirmed","succeeded","failed"]},{name:"subscription_id",type:"union",nullable:!1,required:!0},{name:"success_url",type:"string",nullable:!1,required:!0},{name:"tax_amount",type:"union",nullable:!1,required:!0},{name:"tax_behavior",type:"union",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"trial_interval",type:"union",nullable:!1,required:!0},{name:"trial_interval_count",type:"union",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[{field:"is_business_customer",values:["false","true"]},{field:"is_discount_applicable",values:["false","true"]},{field:"is_free_product_price",values:["false","true"]},{field:"is_payment_form_required",values:["false","true"]},{field:"is_payment_required",values:["false","true"]},{field:"is_payment_setup_required",values:["false","true"]},{field:"status",values:["confirmed","expired","failed","open","succeeded"]}],expandable:[]},{name:"CheckoutLink",schema:"CheckoutLink",fields:[{name:"allow_discount_codes",type:"boolean",nullable:!1,required:!0},{name:"client_secret",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"label",type:"union",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"payment_processor",type:"PaymentProcessor",nullable:!1,required:!0,enum:["stripe"]},{name:"products",type:"array",nullable:!1,required:!0},{name:"require_billing_address",type:"boolean",nullable:!1,required:!0},{name:"return_url",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1,required:!0},{name:"success_url",type:"union",nullable:!1,required:!0},{name:"trial_interval",type:"union",nullable:!1,required:!0},{name:"trial_interval_count",type:"union",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"CheckoutPublic",schema:"CheckoutPublic",fields:[{name:"active_trial_interval",type:"union",nullable:!1,required:!0},{name:"active_trial_interval_count",type:"union",nullable:!1,required:!0},{name:"allow_discount_codes",type:"boolean",nullable:!1,required:!0},{name:"allow_trial",type:"union",nullable:!1,required:!0},{name:"amount",type:"integer",nullable:!1,required:!0},{name:"attached_custom_fields",type:"union",nullable:!1,required:!0},{name:"billing_address_fields",type:"CheckoutBillingAddressFields",nullable:!1,required:!0},{name:"client_secret",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer_billing_address",type:"union",nullable:!1,required:!0},{name:"customer_billing_name",type:"union",nullable:!1,required:!0},{name:"customer_email",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"union",nullable:!1,required:!0},{name:"customer_ip_address",type:"union",nullable:!1,required:!0},{name:"customer_name",type:"union",nullable:!1,required:!0},{name:"customer_tax_id",type:"union",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"embed_origin",type:"union",nullable:!1,required:!0},{name:"expires_at",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"is_business_customer",type:"boolean",nullable:!1,required:!0},{name:"is_discount_applicable",type:"boolean",nullable:!1,required:!0},{name:"is_free_product_price",type:"boolean",nullable:!1,required:!0},{name:"is_payment_form_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_setup_required",type:"boolean",nullable:!1,required:!0},{name:"locale",type:"union",nullable:!1},{name:"max_seats",type:"union",nullable:!1},{name:"min_seats",type:"union",nullable:!1},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"organization",type:"CheckoutOrganization",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"payment_method_type",type:"union",nullable:!1,required:!0},{name:"payment_processor",type:"PaymentProcessor",nullable:!1,required:!0,enum:["stripe"]},{name:"payment_processor_metadata",type:"object",nullable:!1,required:!0},{name:"prices",type:"union",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"product_price",type:"union",nullable:!1,required:!0},{name:"product_price_id",type:"union",nullable:!1,required:!0},{name:"products",type:"array",nullable:!1,required:!0},{name:"require_billing_address",type:"boolean",nullable:!1,required:!0},{name:"return_url",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"CheckoutStatus",nullable:!1,required:!0,enum:["open","expired","confirmed","succeeded","failed"]},{name:"success_url",type:"string",nullable:!1,required:!0},{name:"tax_amount",type:"union",nullable:!1,required:!0},{name:"tax_behavior",type:"union",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[{field:"is_business_customer",values:["false","true"]},{field:"is_discount_applicable",values:["false","true"]},{field:"is_free_product_price",values:["false","true"]},{field:"is_payment_form_required",values:["false","true"]},{field:"is_payment_required",values:["false","true"]},{field:"is_payment_setup_required",values:["false","true"]},{field:"status",values:["confirmed","expired","failed","open","succeeded"]}],expandable:[]},{name:"CustomerCustomerMeter",schema:"CustomerCustomerMeter",fields:[{name:"balance",type:"number",nullable:!1,required:!0},{name:"consumed_units",type:"number",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"credited_units",type:"integer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"meter",type:"CustomerCustomerMeterMeter",nullable:!1,required:!0},{name:"meter_id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"CustomerMeter",schema:"CustomerMeter",fields:[{name:"balance",type:"number",nullable:!1,required:!0},{name:"consumed_units",type:"number",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"credited_units",type:"integer",nullable:!1,required:!0},{name:"customer",type:"Customer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"meter",type:"Meter",nullable:!1,required:!0},{name:"meter_id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"CustomerOrder",schema:"CustomerOrder",fields:[{name:"applied_balance_amount",type:"integer",nullable:!1,required:!0},{name:"billing_address",type:"union",nullable:!1,required:!0},{name:"billing_name",type:"union",nullable:!1,required:!0},{name:"billing_reason",type:"OrderBillingReason",nullable:!1,required:!0,enum:["purchase","subscription_create","subscription_cycle","subscription_update","subscription_meter_cycle"]},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"description",type:"string",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"due_amount",type:"integer",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"invoice_number",type:"union",nullable:!1,required:!0},{name:"is_invoice_generated",type:"boolean",nullable:!1,required:!0},{name:"items",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"next_payment_attempt_at",type:"union",nullable:!1},{name:"paid",type:"boolean",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"receipt_number",type:"union",nullable:!1,required:!0},{name:"refundable_amount",type:"integer",nullable:!1,required:!0},{name:"refundable_tax_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_tax_amount",type:"integer",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"OrderStatus",nullable:!1,required:!0,enum:["draft","pending","paid","refunded","partially_refunded","void"]},{name:"subscription",type:"union",nullable:!1,required:!0},{name:"subscription_id",type:"union",nullable:!1,required:!0},{name:"subtotal_amount",type:"integer",nullable:!1,required:!0},{name:"tax_amount",type:"integer",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"billing_reason",values:["purchase","subscription_create","subscription_cycle","subscription_meter_cycle","subscription_update"]},{field:"is_invoice_generated",values:["false","true"]},{field:"paid",values:["false","true"]},{field:"status",values:["draft","paid","partially_refunded","pending","refunded","void"]}],expandable:[]},{name:"CustomerPortalCustomer",schema:"CustomerPortalCustomer",fields:[{name:"billing_address",type:"union",nullable:!1,required:!0},{name:"billing_name",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"default_payment_method_id",type:"union",nullable:!1},{name:"email",type:"union",nullable:!1,required:!0},{name:"email_verified",type:"boolean",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"locale",type:"union",nullable:!1},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"union",nullable:!1,required:!0},{name:"oauth_accounts",type:"object",nullable:!1,required:!0},{name:"tax_id",type:"union",nullable:!1,required:!0},{name:"type",type:"union",nullable:!1}],stateCandidates:[],expandable:[]},{name:"CustomerSeat",schema:"CustomerSeat",fields:[{name:"claimed_at",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer_email",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"union",nullable:!1,required:!0},{name:"email",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"invitation_token_expires_at",type:"union",nullable:!1,required:!0},{name:"member",type:"union",nullable:!1,required:!0},{name:"member_id",type:"union",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"order_id",type:"union",nullable:!1,required:!0},{name:"revoked_at",type:"union",nullable:!1,required:!0},{name:"seat_metadata",type:"union",nullable:!1,required:!0},{name:"status",type:"SeatStatus",nullable:!1,required:!0,enum:["pending","claimed","revoked"]},{name:"subscription_id",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"status",values:["claimed","pending","revoked"]}],expandable:[]},{name:"CustomerSubscription",schema:"CustomerSubscription",fields:[{name:"amount",type:"integer",nullable:!1,required:!0},{name:"cancel_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"canceled_at",type:"union",nullable:!1,required:!0},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"current_meter_period_end",type:"union",nullable:!1,required:!0},{name:"current_meter_period_start",type:"union",nullable:!1,required:!0},{name:"current_period_end",type:"string",nullable:!1,required:!0},{name:"current_period_start",type:"string",nullable:!1,required:!0},{name:"customer_cancellation_comment",type:"union",nullable:!1,required:!0},{name:"customer_cancellation_reason",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"ended_at",type:"union",nullable:!1,required:!0},{name:"ends_at",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"meters",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"past_due_at",type:"union",nullable:!1},{name:"pause_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"paused_at",type:"union",nullable:!1,required:!0},{name:"pending_update",type:"union",nullable:!1,required:!0},{name:"prices",type:"array",nullable:!1,required:!0},{name:"product",type:"CustomerSubscriptionProduct",nullable:!1,required:!0},{name:"product_id",type:"string",nullable:!1,required:!0},{name:"recurring_interval",type:"RecurringInterval",nullable:!1,required:!0,enum:["day","week","month","year"]},{name:"recurring_interval_count",type:"integer",nullable:!1,required:!0},{name:"resumes_at",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"started_at",type:"union",nullable:!1,required:!0},{name:"status",type:"SubscriptionStatus",nullable:!1,required:!0,enum:["incomplete","incomplete_expired","trialing","active","past_due","canceled","unpaid","paused"]},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"trial_start",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"recurring_interval",values:["day","month","week","year"]},{field:"status",values:["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]}],expandable:[]},{name:"CustomerWallet",schema:"CustomerWallet",fields:[{name:"balance",type:"integer",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"Dispute",schema:"Dispute",fields:[{name:"amount",type:"integer",nullable:!1,required:!0},{name:"case_id",type:"union",nullable:!1,required:!0},{name:"closed",type:"boolean",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"customer",type:"DisputeCustomer",nullable:!1,required:!0},{name:"evidence_due_by",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"order_id",type:"string",nullable:!1,required:!0},{name:"past_due",type:"boolean",nullable:!1,required:!0},{name:"payment_id",type:"string",nullable:!1,required:!0},{name:"reason",type:"union",nullable:!1,required:!0},{name:"resolved",type:"boolean",nullable:!1,required:!0},{name:"status",type:"DisputeStatus",nullable:!1,required:!0,enum:["prevented","early_warning","needs_response","under_review","lost","won"]},{name:"tax_amount",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"closed",values:["false","true"]},{field:"status",values:["early_warning","lost","needs_response","prevented","under_review","won"]}],expandable:[]},{name:"LicenseKeyActivationRead",schema:"LicenseKeyActivationRead",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"label",type:"string",nullable:!1,required:!0},{name:"license_key",type:"LicenseKeyRead",nullable:!1,required:!0},{name:"license_key_id",type:"string",nullable:!1,required:!0},{name:"meta",type:"object",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"LicenseKeyWithActivations",schema:"LicenseKeyWithActivations",fields:[{name:"activations",type:"array",nullable:!1,required:!0},{name:"benefit_id",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer",type:"LicenseKeyCustomer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"display_key",type:"string",nullable:!1,required:!0},{name:"expires_at",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"key",type:"string",nullable:!1,required:!0},{name:"last_validated_at",type:"union",nullable:!1,required:!0},{name:"limit_activations",type:"union",nullable:!1,required:!0},{name:"limit_usage",type:"union",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"status",type:"LicenseKeyStatus",nullable:!1,required:!0,enum:["granted","revoked","disabled"]},{name:"usage",type:"integer",nullable:!1,required:!0},{name:"validations",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"status",values:["disabled","granted","revoked"]}],expandable:[]},{name:"Member",schema:"Member",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"email",type:"string",nullable:!1,required:!0},{name:"external_id",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"union",nullable:!1,required:!0},{name:"role",type:"MemberRole",nullable:!1,required:!0,enum:["owner","billing_manager","member"]}],stateCandidates:[{field:"role",values:["billing_manager","member","owner"]}],expandable:[]},{name:"Meter",schema:"Meter",fields:[{name:"aggregation",type:"union",nullable:!1,required:!0},{name:"archived_at",type:"union",nullable:!1},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"custom_label",type:"union",nullable:!1},{name:"custom_multiplier",type:"union",nullable:!1},{name:"filter",type:"Filter",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"unit",type:"MeterUnit",nullable:!1,required:!0,enum:["scalar","token","custom"]}],stateCandidates:[{field:"unit",values:["custom","scalar","token"]}],expandable:[]},{name:"MeterQuantity",schema:"MeterQuantity",fields:[{name:"quantity",type:"number",nullable:!1,required:!0},{name:"timestamp",type:"string",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"MetricDashboardSchema",schema:"MetricDashboardSchema",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"metrics",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"MetricsIntervalsLimits",schema:"MetricsIntervalsLimits",fields:[{name:"day",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"hour",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"month",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"week",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"year",type:"MetricsIntervalLimit",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"Order",schema:"Order",fields:[{name:"applied_balance_amount",type:"integer",nullable:!1,required:!0},{name:"billing_address",type:"union",nullable:!1,required:!0},{name:"billing_name",type:"union",nullable:!1,required:!0},{name:"billing_reason",type:"OrderBillingReason",nullable:!1,required:!0,enum:["purchase","subscription_create","subscription_cycle","subscription_update","subscription_meter_cycle"]},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer",type:"OrderCustomer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"description",type:"string",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"due_amount",type:"integer",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"invoice_number",type:"union",nullable:!1,required:!0},{name:"is_invoice_generated",type:"boolean",nullable:!1,required:!0},{name:"items",type:"array",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"next_payment_attempt_at",type:"union",nullable:!1},{name:"paid",type:"boolean",nullable:!1,required:!0},{name:"platform_fee_amount",type:"integer",nullable:!1,required:!0},{name:"platform_fee_currency",type:"union",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"receipt_number",type:"union",nullable:!1,required:!0},{name:"refundable_amount",type:"integer",nullable:!1,required:!0},{name:"refundable_tax_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_tax_amount",type:"integer",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"OrderStatus",nullable:!1,required:!0,enum:["draft","pending","paid","refunded","partially_refunded","void"]},{name:"subscription",type:"union",nullable:!1,required:!0},{name:"subscription_id",type:"union",nullable:!1,required:!0},{name:"subtotal_amount",type:"integer",nullable:!1,required:!0},{name:"tax_amount",type:"integer",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"billing_reason",values:["purchase","subscription_create","subscription_cycle","subscription_meter_cycle","subscription_update"]},{field:"is_invoice_generated",values:["false","true"]},{field:"paid",values:["false","true"]},{field:"status",values:["draft","paid","partially_refunded","pending","refunded","void"]}],expandable:[]},{name:"Organization",schema:"Organization",fields:[{name:"account_id",type:"union",nullable:!1,required:!0},{name:"allow_customer_updates",type:"boolean",nullable:!1,required:!0},{name:"avatar_url",type:"union",nullable:!1,required:!0},{name:"capabilities",type:"OrganizationCapabilities",nullable:!1,required:!0},{name:"country",type:"union",nullable:!1},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer_email_settings",type:"OrganizationCustomerEmailSettings",nullable:!1,required:!0},{name:"customer_portal_settings",type:"OrganizationCustomerPortalSettings",nullable:!1,required:!0},{name:"default_presentment_currency",type:"string",nullable:!1,required:!0},{name:"default_tax_behavior",type:"TaxBehaviorOption",nullable:!1,required:!0,enum:["location","inclusive","exclusive"]},{name:"details_submitted_at",type:"union",nullable:!1,required:!0},{name:"dispute_settings",type:"OrganizationDisputeSettings",nullable:!1,required:!0},{name:"email",type:"union",nullable:!1,required:!0},{name:"embed_hosts",type:"array",nullable:!1,required:!0},{name:"embed_hosts_enforced",type:"boolean",nullable:!1,required:!0},{name:"feature_settings",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"onboarding_resubmission_requested_at",type:"union",nullable:!1,required:!0},{name:"payout_account_id",type:"union",nullable:!1,required:!0},{name:"proration_behavior",type:"SubscriptionProrationBehavior",nullable:!1,required:!0,enum:["invoice","prorate","next_period","reset"]},{name:"slug",type:"string",nullable:!1,required:!0},{name:"socials",type:"array",nullable:!1,required:!0},{name:"sso_enforced",type:"boolean",nullable:!1,required:!0},{name:"status",type:"OrganizationStatus",nullable:!1,required:!0,enum:["created","review","snoozed","denied","active","blocked","offboarding","offboarded"]},{name:"subscription_settings",type:"OrganizationSubscriptionSettings",nullable:!1,required:!0},{name:"website",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"default_tax_behavior",values:["exclusive","inclusive","location"]},{field:"proration_behavior",values:["invoice","next_period","prorate","reset"]},{field:"status",values:["active","blocked","created","denied","offboarded","offboarding","review","snoozed"]}],expandable:[]},{name:"Product",schema:"Product",fields:[{name:"attached_custom_fields",type:"array",nullable:!1,required:!0},{name:"benefits",type:"array",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"description",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"is_archived",type:"boolean",nullable:!1,required:!0},{name:"is_recurring",type:"boolean",nullable:!1,required:!0},{name:"medias",type:"array",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"meter_interval",type:"union",nullable:!1,required:!0},{name:"meter_interval_count",type:"union",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"prices",type:"array",nullable:!1,required:!0},{name:"recurring_interval",type:"union",nullable:!1,required:!0},{name:"recurring_interval_count",type:"union",nullable:!1,required:!0},{name:"trial_interval",type:"union",nullable:!1,required:!0},{name:"trial_interval_count",type:"union",nullable:!1,required:!0},{name:"visibility",type:"ProductVisibility",nullable:!1,required:!0,enum:["draft","private","public"]}],stateCandidates:[{field:"is_archived",values:["false","true"]},{field:"is_recurring",values:["false","true"]},{field:"visibility",values:["draft","private","public"]}],expandable:[]},{name:"Subscription",schema:"Subscription",fields:[{name:"amount",type:"integer",nullable:!1,required:!0},{name:"cancel_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"canceled_at",type:"union",nullable:!1,required:!0},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"current_meter_period_end",type:"union",nullable:!1,required:!0},{name:"current_meter_period_start",type:"union",nullable:!1,required:!0},{name:"current_period_end",type:"string",nullable:!1,required:!0},{name:"current_period_start",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer",type:"SubscriptionCustomer",nullable:!1,required:!0},{name:"customer_cancellation_comment",type:"union",nullable:!1,required:!0},{name:"customer_cancellation_reason",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"ended_at",type:"union",nullable:!1,required:!0},{name:"ends_at",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"meters",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"past_due_at",type:"union",nullable:!1},{name:"pause_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"paused_at",type:"union",nullable:!1,required:!0},{name:"pending_update",type:"union",nullable:!1,required:!0},{name:"prices",type:"array",nullable:!1,required:!0},{name:"product",type:"Product",nullable:!1,required:!0},{name:"product_id",type:"string",nullable:!1,required:!0},{name:"recurring_interval",type:"RecurringInterval",nullable:!1,required:!0,enum:["day","week","month","year"]},{name:"recurring_interval_count",type:"integer",nullable:!1,required:!0},{name:"resumes_at",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"started_at",type:"union",nullable:!1,required:!0},{name:"status",type:"SubscriptionStatus",nullable:!1,required:!0,enum:["incomplete","incomplete_expired","trialing","active","past_due","canceled","unpaid","paused"]},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"trial_start",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"recurring_interval",values:["day","month","week","year"]},{field:"status",values:["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]}],expandable:[]},{name:"WebhookEndpoint",schema:"WebhookEndpoint",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"enabled",type:"boolean",nullable:!1,required:!0},{name:"events",type:"array",nullable:!1,required:!0},{name:"format",type:"WebhookFormat",nullable:!1,required:!0,enum:["raw","discord","slack"]},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"union",nullable:!1},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"secret",type:"string",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[{field:"format",values:["discord","raw","slack"]}],expandable:[]}],operations:[{id:"benefit-grants:list",method:"get",path:"/v1/benefit-grants/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"is_granted",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_BenefitGrant_"},{id:"benefits:list",method:"get",path:"/v1/benefits/",pathParams:[],query:[{name:"exclude_id",type:"union",required:!1},{name:"id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"type",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Benefit_"},{id:"benefits:create",method:"post",path:"/v1/benefits/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["benefits:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"benefits:get",method:"get",path:"/v1/benefits/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"benefits:update",method:"patch",path:"/v1/benefits/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["benefits:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"benefits:delete",method:"delete",path:"/v1/benefits/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["benefits:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"benefits:files",method:"get",path:"/v1/benefits/{id}/files",pathParams:["id"],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_BenefitDownloadableFile_"},{id:"benefits:grants",method:"get",path:"/v1/benefits/{id}/grants",pathParams:["id"],query:[{name:"customer_id",type:"union",required:!1},{name:"is_granted",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"member_id",type:"union",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_BenefitGrant_"},{id:"checkout-links:list",method:"get",path:"/v1/checkout-links/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkout_links:read","checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!0,key:"items"},class:"list",resource:"CheckoutLink"},{id:"checkout-links:create",method:"post",path:"/v1/checkout-links/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!1},class:"create",resource:"CheckoutLink"},{id:"checkout-links:get",method:"get",path:"/v1/checkout-links/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkout_links:read","checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!1},class:"retrieve",resource:"CheckoutLink"},{id:"checkout-links:update",method:"patch",path:"/v1/checkout-links/{id}",pathParams:["id"],query:[],body:[{name:"allow_discount_codes",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"label",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"products",type:"union",required:!1},{name:"require_billing_address",type:"union",required:!1},{name:"return_url",type:"union",required:!1},{name:"seats",type:"union",required:!1},{name:"success_url",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!1},class:"update",resource:"CheckoutLink"},{id:"checkout-links:delete",method:"delete",path:"/v1/checkout-links/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["checkout_links:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"CheckoutLink"},{id:"checkouts:list",method:"get",path:"/v1/checkouts/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkouts:read","checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!0,key:"items"},class:"list",resource:"Checkout"},{id:"checkouts:create",method:"post",path:"/v1/checkouts/",pathParams:[],query:[],body:[{name:"allow_discount_codes",type:"boolean",required:!1},{name:"allow_trial",type:"boolean",required:!1},{name:"amount",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"customer_ip_address",type:"union",required:!1},{name:"customer_metadata",type:"object",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"embed_origin",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"is_business_customer",type:"boolean",required:!1},{name:"locale",type:"union",required:!1},{name:"max_seats",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"min_seats",type:"union",required:!1},{name:"prices",type:"union",required:!1},{name:"products",type:"array",required:!0},{name:"require_billing_address",type:"boolean",required:!1},{name:"return_url",type:"union",required:!1},{name:"seats",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1},{name:"success_url",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!1},class:"create",resource:"Checkout"},{id:"checkouts:get",method:"get",path:"/v1/checkouts/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkouts:read","checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!1},class:"retrieve",resource:"Checkout"},{id:"checkouts:update",method:"patch",path:"/v1/checkouts/{id}",pathParams:["id"],query:[],body:[{name:"allow_discount_codes",type:"union",required:!1},{name:"allow_trial",type:"union",required:!1},{name:"amount",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_ip_address",type:"union",required:!1},{name:"customer_metadata",type:"union",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"embed_origin",type:"union",required:!1},{name:"is_business_customer",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"product_id",type:"union",required:!1},{name:"product_price_id",type:"union",required:!1},{name:"require_billing_address",type:"union",required:!1},{name:"return_url",type:"union",required:!1},{name:"seats",type:"union",required:!1},{name:"success_url",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!1},class:"update",resource:"Checkout"},{id:"checkouts:client_get",method:"get",path:"/v1/checkouts/client/{client_secret}",pathParams:["client_secret"],query:[],body:[],bodyEncoding:"none",successStatus:200,answers:{resource:"CheckoutPublic",list:!1},class:"retrieve",resource:"CheckoutPublic"},{id:"checkouts:client_update",method:"patch",path:"/v1/checkouts/client/{client_secret}",pathParams:["client_secret"],query:[],body:[{name:"allow_trial",type:"union",required:!1},{name:"amount",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_code",type:"union",required:!1},{name:"is_business_customer",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"payment_method_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"product_price_id",type:"union",required:!1},{name:"seats",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,answers:{resource:"CheckoutPublic",list:!1},class:"update",resource:"CheckoutPublic"},{id:"checkouts:client_confirm",method:"post",path:"/v1/checkouts/client/{client_secret}/confirm",pathParams:["client_secret"],query:[],body:[{name:"allow_trial",type:"union",required:!1},{name:"amount",type:"union",required:!1},{name:"confirmation_token_id",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_code",type:"union",required:!1},{name:"is_business_customer",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"payment_method_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"product_price_id",type:"union",required:!1},{name:"seats",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,credentials:["oidc","pat"],class:"action",resource:"CheckoutPublic"},{id:"custom-fields:list",method:"get",path:"/v1/custom-fields/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"type",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["custom_fields:read","custom_fields:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_CustomField_"},{id:"custom-fields:create",method:"post",path:"/v1/custom-fields/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["custom_fields:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"custom-fields:get",method:"get",path:"/v1/custom-fields/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["custom_fields:read","custom_fields:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"custom-fields:update",method:"patch",path:"/v1/custom-fields/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["custom_fields:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"custom-fields:delete",method:"delete",path:"/v1/custom-fields/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["custom_fields:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"customer_meters:list",method:"get",path:"/v1/customer-meters/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"meter_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_meters:read"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerMeter",list:!0,key:"items"},class:"list",resource:"CustomerMeter"},{id:"customer_meters:get",method:"get",path:"/v1/customer-meters/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_meters:read"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerMeter",list:!1},class:"retrieve",resource:"CustomerMeter"},{id:"customer_portal:benefit-grants:list",method:"get",path:"/v1/customer-portal/benefit-grants/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"checkout_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"member_id",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1},{name:"type",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_CustomerBenefitGrant_"},{id:"customer_portal:benefit-grants:get",method:"get",path:"/v1/customer-portal/benefit-grants/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"computed"},{id:"customer_portal:benefit-grants:update",method:"patch",path:"/v1/customer-portal/benefit-grants/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"non-resource"},{id:"customer_portal:customer-session:introspect",method:"get",path:"/v1/customer-portal/customer-session/introspect",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerCustomerSession"},{id:"customer_portal:customer-session:get_authenticated_user",method:"get",path:"/v1/customer-portal/customer-session/user",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"PortalAuthenticatedUser"},{id:"customer_portal:customers:get",method:"get",path:"/v1/customer-portal/customers/me",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerPortalCustomer",list:!1},class:"retrieve",resource:"CustomerPortalCustomer"},{id:"customer_portal:customers:update",method:"patch",path:"/v1/customer-portal/customers/me",pathParams:[],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"billing_name",type:"union",required:!1},{name:"default_payment_method_id",type:"union",required:!1},{name:"tax_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerPortalCustomer",list:!1},class:"action",resource:"CustomerPortalCustomer"},{id:"customer_portal:customers:check_email_update",method:"get",path:"/v1/customer-portal/customers/me/email-update/check",pathParams:[],query:[{name:"token",type:"string",required:!0}],body:[],bodyEncoding:"none",successStatus:204,class:"computed"},{id:"customer_portal:customers:request_email_update",method:"post",path:"/v1/customer-portal/customers/me/email-update/request",pathParams:[],query:[],body:[{name:"email",type:"string",required:!0}],bodyEncoding:"json",successStatus:202,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"non-resource"},{id:"customer_portal:customers:verify_email_update",method:"post",path:"/v1/customer-portal/customers/me/email-update/verify",pathParams:[],query:[],body:[{name:"token",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,class:"non-resource"},{id:"customer_portal:customers:list_payment_methods",method:"get",path:"/v1/customer-portal/customers/me/payment-methods",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_CustomerPaymentMethod_"},{id:"customer_portal:customers:add_payment_method",method:"post",path:"/v1/customer-portal/customers/me/payment-methods",pathParams:[],query:[],body:[{name:"confirmation_token_id",type:"string",required:!0},{name:"return_url",type:"string",required:!0},{name:"set_default",type:"boolean",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"action",resource:"CustomerPortalCustomer"},{id:"customer_portal:customers:delete_payment_method",method:"delete",path:"/v1/customer-portal/customers/me/payment-methods/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"delete"},{id:"customer_portal:customers:confirm_payment_method",method:"post",path:"/v1/customer-portal/customers/me/payment-methods/confirm",pathParams:[],query:[],body:[{name:"set_default",type:"boolean",required:!0},{name:"setup_intent_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"non-resource"},{id:"customer_portal:downloadables:list",method:"get",path:"/v1/customer-portal/downloadables/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_DownloadableRead_"},{id:"customer_portal:license_keys:list",method:"get",path:"/v1/customer-portal/license-keys/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_LicenseKeyRead_"},{id:"customer_portal:license_keys:get",method:"get",path:"/v1/customer-portal/license-keys/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"LicenseKeyWithActivations",list:!1},class:"retrieve",resource:"LicenseKeyWithActivations"},{id:"customer_portal:license_keys:activate",method:"post",path:"/v1/customer-portal/license-keys/activate",pathParams:[],query:[],body:[{name:"conditions",type:"object",required:!1},{name:"key",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"meta",type:"object",required:!1},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,answers:{resource:"LicenseKeyActivationRead",list:!1},class:"action",resource:"LicenseKeyActivationRead"},{id:"customer_portal:license_keys:deactivate",method:"post",path:"/v1/customer-portal/license-keys/deactivate",pathParams:[],query:[],body:[{name:"activation_id",type:"string",required:!0},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:204,class:"non-resource"},{id:"customer_portal:license_keys:validate",method:"post",path:"/v1/customer-portal/license-keys/validate",pathParams:[],query:[],body:[{name:"activation_id",type:"union",required:!1},{name:"benefit_id",type:"union",required:!1},{name:"conditions",type:"object",required:!1},{name:"customer_id",type:"union",required:!1},{name:"increment_usage",type:"union",required:!1},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,class:"non-resource"},{id:"customer_portal:members:list_members",method:"get",path:"/v1/customer-portal/members",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["member_session"],class:"retrieve",resource:"ListResource_CustomerPortalMember_"},{id:"customer_portal:members:add_member",method:"post",path:"/v1/customer-portal/members",pathParams:[],query:[],body:[{name:"email",type:"string",required:!0},{name:"name",type:"union",required:!1},{name:"role",type:"MemberRole",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["customer_portal:write"],credentials:["member_session"],class:"non-resource"},{id:"customer_portal:members:update_member",method:"patch",path:"/v1/customer-portal/members/{id}",pathParams:["id"],query:[],body:[{name:"name",type:"union",required:!1},{name:"role",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["member_session"],class:"non-resource"},{id:"customer_portal:members:remove_member",method:"delete",path:"/v1/customer-portal/members/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["customer_portal:write"],credentials:["member_session"],class:"delete"},{id:"customer_portal:customer_meters:list",method:"get",path:"/v1/customer-portal/meters/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"meter_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerCustomerMeter",list:!0,key:"items"},class:"list",resource:"CustomerCustomerMeter"},{id:"customer_portal:customer_meters:get",method:"get",path:"/v1/customer-portal/meters/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerCustomerMeter",list:!1},class:"retrieve",resource:"CustomerCustomerMeter"},{id:"customer_portal:orders:list",method:"get",path:"/v1/customer-portal/orders/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"product_billing_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerOrder",list:!0,key:"items"},class:"list",resource:"CustomerOrder"},{id:"customer_portal:orders:get",method:"get",path:"/v1/customer-portal/orders/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerOrder",list:!1},class:"retrieve",resource:"CustomerOrder"},{id:"customer_portal:orders:update",method:"patch",path:"/v1/customer-portal/orders/{id}",pathParams:["id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"billing_name",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerOrder",list:!1},class:"update",resource:"CustomerOrder"},{id:"customer_portal:orders:confirm_retry_payment",method:"post",path:"/v1/customer-portal/orders/{id}/confirm-payment",pathParams:["id"],query:[],body:[{name:"confirmation_token_id",type:"union",required:!1},{name:"payment_method_id",type:"union",required:!1},{name:"payment_processor",type:"PaymentProcessor",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"action",resource:"CustomerOrder"},{id:"customer_portal:orders:invoice",method:"get",path:"/v1/customer-portal/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerOrderInvoice"},{id:"customer_portal:orders:generate_invoice",method:"post",path:"/v1/customer-portal/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:202,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"action",resource:"CustomerOrder"},{id:"customer_portal:orders:get_payment_status",method:"get",path:"/v1/customer-portal/orders/{id}/payment-status",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerOrderPaymentStatus"},{id:"customer_portal:orders:receipt",method:"get",path:"/v1/customer-portal/orders/{id}/receipt",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerOrderReceipt"},{id:"customer_portal:organizations:get",method:"get",path:"/v1/customer-portal/organizations/{slug}",pathParams:["slug"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"customer_portal:seats:list_seats",method:"get",path:"/v1/customer-portal/seats",pathParams:[],query:[{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!0,key:"seats"},class:"list",resource:"CustomerSeat"},{id:"customer_portal:seats:assign_seat",method:"post",path:"/v1/customer-portal/seats",pathParams:[],query:[],body:[{name:"checkout_id",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"external_member_id",type:"union",required:!1},{name:"immediate_claim",type:"boolean",required:!1},{name:"member_id",type:"union",required:!1},{name:"metadata",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!1},class:"create",resource:"CustomerSeat"},{id:"customer_portal:seats:revoke_seat",method:"delete",path:"/v1/customer-portal/seats/{seat_id}",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!1},class:"delete",resource:"CustomerSeat"},{id:"customer_portal:seats:resend_invitation",method:"post",path:"/v1/customer-portal/seats/{seat_id}/resend",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!1},class:"action",resource:"CustomerSeat"},{id:"customer_portal:seats:list_claimed_subscriptions",method:"get",path:"/v1/customer-portal/seats/subscriptions",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!0,key:"items"},class:"list",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:list",method:"get",path:"/v1/customer-portal/subscriptions/",pathParams:[],query:[{name:"active",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!0,key:"items"},class:"list",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:get",method:"get",path:"/v1/customer-portal/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!1},class:"retrieve",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:update",method:"patch",path:"/v1/customer-portal/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!1},class:"update",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:cancel",method:"delete",path:"/v1/customer-portal/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!1},class:"delete",resource:"CustomerSubscription"},{id:"customer_portal:wallets:list",method:"get",path:"/v1/customer-portal/wallets/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerWallet",list:!0,key:"items"},class:"list",resource:"CustomerWallet"},{id:"customer_portal:wallets:get",method:"get",path:"/v1/customer-portal/wallets/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerWallet",list:!1},class:"retrieve",resource:"CustomerWallet"},{id:"customer-seats:list_seats",method:"get",path:"/v1/customer-seats",pathParams:[],query:[{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_seats:read"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!0,key:"seats"},class:"list",resource:"CustomerSeat"},{id:"customer-seats:assign_seat",method:"post",path:"/v1/customer-seats",pathParams:[],query:[],body:[{name:"customer_id",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"external_member_id",type:"union",required:!1},{name:"immediate_claim",type:"boolean",required:!1},{name:"member_id",type:"union",required:!1},{name:"metadata",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_seats:write"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!1},class:"create",resource:"CustomerSeat"},{id:"customer-seats:revoke_seat",method:"delete",path:"/v1/customer-seats/{seat_id}",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_seats:write"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!1},class:"delete",resource:"CustomerSeat"},{id:"customer-seats:resend_invitation",method:"post",path:"/v1/customer-seats/{seat_id}/resend",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_seats:write"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!1},class:"action",resource:"CustomerSeat"},{id:"customer-seats:claim_seat",method:"post",path:"/v1/customer-seats/claim",pathParams:[],query:[],body:[{name:"invitation_token",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,answers:{resource:"CustomerSeat",list:!1,key:"seat"},class:"action",resource:"CustomerSeat"},{id:"customer-seats:get_claim_info",method:"get",path:"/v1/customer-seats/claim/{invitation_token}",pathParams:["invitation_token"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"customer-sessions:create",method:"post",path:"/v1/customer-sessions/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["customer_sessions:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:list",method:"get",path:"/v1/customers/",pathParams:[],query:[{name:"active",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Customer_"},{id:"customers:create",method:"post",path:"/v1/customers/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:get",method:"get",path:"/v1/customers/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"customers:update",method:"patch",path:"/v1/customers/{id}",pathParams:["id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"external_id",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"tax_id",type:"union",required:!1},{name:"type",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:delete",method:"delete",path:"/v1/customers/{id}",pathParams:["id"],query:[{name:"anonymize",type:"boolean",required:!1}],body:[],bodyEncoding:"none",successStatus:204,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"customers:members:create",method:"post",path:"/v1/customers/{id}/members",pathParams:["id"],query:[],body:[{name:"email",type:"string",required:!0},{name:"external_id",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"string",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"create",resource:"Member"},{id:"customers:members:get",method:"get",path:"/v1/customers/{id}/members/{member_id}",pathParams:["id","member_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["members:read","members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"retrieve",resource:"Member"},{id:"customers:members:update",method:"patch",path:"/v1/customers/{id}/members/{member_id}",pathParams:["id","member_id"],query:[],body:[{name:"email",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"update",resource:"Member"},{id:"customers:members:delete",method:"delete",path:"/v1/customers/{id}/members/{member_id}",pathParams:["id","member_id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["members:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"Member"},{id:"customers:list_payment_methods",method:"get",path:"/v1/customers/{id}/payment-methods",pathParams:["id"],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_PaymentMethod_"},{id:"customers:get_state",method:"get",path:"/v1/customers/{id}/state",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"CustomerState"},{id:"customers:export",method:"get",path:"/v1/customers/export",pathParams:[],query:[{name:"organization_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"customers:get_external",method:"get",path:"/v1/customers/external/{external_id}",pathParams:["external_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"customers:update_external",method:"patch",path:"/v1/customers/external/{external_id}",pathParams:["external_id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"tax_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:delete_external",method:"delete",path:"/v1/customers/external/{external_id}",pathParams:["external_id"],query:[{name:"anonymize",type:"boolean",required:!1}],body:[],bodyEncoding:"none",successStatus:204,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"customers:members:create_external",method:"post",path:"/v1/customers/external/{external_id}/members",pathParams:["external_id"],query:[],body:[{name:"email",type:"string",required:!0},{name:"external_id",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"string",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"create",resource:"Member"},{id:"customers:members:get_external",method:"get",path:"/v1/customers/external/{external_id}/members/{member_external_id}",pathParams:["external_id","member_external_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["members:read","members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"retrieve",resource:"Member"},{id:"customers:members:update_external",method:"patch",path:"/v1/customers/external/{external_id}/members/{member_external_id}",pathParams:["external_id","member_external_id"],query:[],body:[{name:"email",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"update",resource:"Member"},{id:"customers:members:delete_external",method:"delete",path:"/v1/customers/external/{external_id}/members/{member_external_id}",pathParams:["external_id","member_external_id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["members:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"Member"},{id:"customers:list_payment_methods_external",method:"get",path:"/v1/customers/external/{external_id}/payment-methods",pathParams:["external_id"],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_PaymentMethod_"},{id:"customers:get_state_external",method:"get",path:"/v1/customers/external/{external_id}/state",pathParams:["external_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"CustomerState"},{id:"discounts:list",method:"get",path:"/v1/discounts/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["discounts:read","discounts:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Discount_"},{id:"discounts:create",method:"post",path:"/v1/discounts/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["discounts:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"discounts:get",method:"get",path:"/v1/discounts/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["discounts:read","discounts:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"discounts:update",method:"patch",path:"/v1/discounts/{id}",pathParams:["id"],query:[],body:[{name:"amount",type:"union",required:!1},{name:"amounts",type:"union",required:!1},{name:"basis_points",type:"union",required:!1},{name:"code",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"duration",type:"union",required:!1},{name:"duration_in_months",type:"union",required:!1},{name:"ends_at",type:"union",required:!1},{name:"max_redemptions",type:"union",required:!1},{name:"max_redemptions_per_customer",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"products",type:"union",required:!1},{name:"starts_at",type:"union",required:!1},{name:"type",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["discounts:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"discounts:delete",method:"delete",path:"/v1/discounts/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["discounts:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"disputes:list",method:"get",path:"/v1/disputes/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"order_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["disputes:read","disputes:write"],credentials:["oat","oidc","pat"],answers:{resource:"Dispute",list:!0,key:"items"},class:"list",resource:"Dispute"},{id:"disputes:get",method:"get",path:"/v1/disputes/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["disputes:read","disputes:write"],credentials:["oat","oidc","pat"],answers:{resource:"Dispute",list:!1},class:"retrieve",resource:"Dispute"},{id:"disputes:accept",method:"post",path:"/v1/disputes/{id}/accept",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["disputes:write"],credentials:["oat","oidc","pat"],answers:{resource:"Dispute",list:!1},class:"action",resource:"Dispute"},{id:"event-types:list",method:"get",path:"/v1/event-types/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"parent_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"root_events",type:"boolean",required:!1},{name:"sorting",type:"union",required:!1},{name:"source",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_EventTypeWithStats_"},{id:"event-types:update",method:"patch",path:"/v1/event-types/{id}",pathParams:["id"],query:[],body:[{name:"label",type:"string",required:!0},{name:"label_property_selector",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["events:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"events:list",method:"get",path:"/v1/events/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"depth",type:"union",required:!1},{name:"end_timestamp",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"filter",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"meter_id",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"parent_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"source",type:"union",required:!1},{name:"start_timestamp",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"events:get",method:"get",path:"/v1/events/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"events:ingest",method:"post",path:"/v1/events/ingest",pathParams:[],query:[],body:[{name:"events",type:"array",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["events:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"events:list_names",method:"get",path:"/v1/events/names",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"source",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_EventName_"},{id:"files:list",method:"get",path:"/v1/files/",pathParams:[],query:[{name:"ids",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["files:read","files:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_FileRead_"},{id:"files:create",method:"post",path:"/v1/files/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"files:update",method:"patch",path:"/v1/files/{id}",pathParams:["id"],query:[],body:[{name:"name",type:"union",required:!1},{name:"version",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"files:delete",method:"delete",path:"/v1/files/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"files:uploaded",method:"post",path:"/v1/files/{id}/uploaded",pathParams:["id"],query:[],body:[{name:"id",type:"string",required:!0},{name:"parts",type:"array",required:!0},{name:"path",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"license_keys:list",method:"get",path:"/v1/license-keys/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["license_keys:read","license_keys:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_LicenseKeyRead_"},{id:"license_keys:get",method:"get",path:"/v1/license-keys/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["license_keys:read","license_keys:write"],credentials:["oat","oidc","pat"],answers:{resource:"LicenseKeyWithActivations",list:!1},class:"retrieve",resource:"LicenseKeyWithActivations"},{id:"license_keys:update",method:"patch",path:"/v1/license-keys/{id}",pathParams:["id"],query:[],body:[{name:"expires_at",type:"union",required:!1},{name:"limit_activations",type:"union",required:!1},{name:"limit_usage",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"usage",type:"integer",required:!1,minimum:-2147483648,maximum:2147483647}],bodyEncoding:"json",successStatus:200,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"license_keys:get_activation",method:"get",path:"/v1/license-keys/{id}/activations/{activation_id}",pathParams:["id","activation_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["license_keys:read","license_keys:write"],credentials:["oat","oidc","pat"],answers:{resource:"LicenseKeyActivationRead",list:!1},class:"retrieve",resource:"LicenseKeyActivationRead"},{id:"license_keys:activate",method:"post",path:"/v1/license-keys/activate",pathParams:[],query:[],body:[{name:"conditions",type:"object",required:!1},{name:"key",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"meta",type:"object",required:!1},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],answers:{resource:"LicenseKeyActivationRead",list:!1},class:"action",resource:"LicenseKeyActivationRead"},{id:"license_keys:deactivate",method:"post",path:"/v1/license-keys/deactivate",pathParams:[],query:[],body:[{name:"activation_id",type:"string",required:!0},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:204,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"license_keys:validate",method:"post",path:"/v1/license-keys/validate",pathParams:[],query:[],body:[{name:"activation_id",type:"union",required:!1},{name:"benefit_id",type:"union",required:!1},{name:"conditions",type:"object",required:!1},{name:"customer_id",type:"union",required:!1},{name:"increment_usage",type:"union",required:!1},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"members:list_members",method:"get",path:"/v1/members/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"role",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["members:read","members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!0,key:"items"},class:"list",resource:"Member"},{id:"meters:list",method:"get",path:"/v1/meters/",pathParams:[],query:[{name:"is_archived",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["meters:read","meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!0,key:"items"},class:"list",resource:"Meter"},{id:"meters:create",method:"post",path:"/v1/meters/",pathParams:[],query:[],body:[{name:"aggregation",type:"union",required:!0},{name:"custom_label",type:"union",required:!1},{name:"custom_multiplier",type:"union",required:!1},{name:"filter",type:"Filter",required:!0},{name:"metadata",type:"object",required:!1},{name:"name",type:"string",required:!0},{name:"organization_id",type:"union",required:!1},{name:"unit",type:"MeterUnit",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!1},class:"create",resource:"Meter"},{id:"meters:get",method:"get",path:"/v1/meters/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["meters:read","meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!1},class:"retrieve",resource:"Meter"},{id:"meters:update",method:"patch",path:"/v1/meters/{id}",pathParams:["id"],query:[],body:[{name:"aggregation",type:"union",required:!1},{name:"custom_label",type:"union",required:!1},{name:"custom_multiplier",type:"union",required:!1},{name:"filter",type:"union",required:!1},{name:"is_archived",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"unit",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!1},class:"update",resource:"Meter"},{id:"meters:quantities",method:"get",path:"/v1/meters/{id}/quantities",pathParams:["id"],query:[{name:"customer_aggregation_function",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"end_timestamp",type:"string",required:!0},{name:"external_customer_id",type:"union",required:!1},{name:"interval",type:"TimeInterval",required:!0},{name:"metadata",type:"MetadataQuery",required:!1},{name:"start_timestamp",type:"string",required:!0},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["meters:read","meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"MeterQuantity",list:!0,key:"quantities"},class:"list",resource:"MeterQuantity"},{id:"metrics:get",method:"get",path:"/v1/metrics/",pathParams:[],query:[{name:"billing_type",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"end_date",type:"string",required:!0},{name:"interval",type:"TimeInterval",required:!0},{name:"metrics",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"start_date",type:"string",required:!0},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"MetricsResponse"},{id:"metrics:list_dashboards",method:"get",path:"/v1/metrics/dashboards",pathParams:[],query:[{name:"organization_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!0},class:"list",resource:"MetricDashboardSchema"},{id:"metrics:create_dashboard",method:"post",path:"/v1/metrics/dashboards",pathParams:[],query:[],body:[{name:"metrics",type:"array",required:!1},{name:"name",type:"string",required:!0},{name:"organization_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["metrics:write"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!1},class:"create",resource:"MetricDashboardSchema"},{id:"metrics:get_dashboard",method:"get",path:"/v1/metrics/dashboards/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!1},class:"retrieve",resource:"MetricDashboardSchema"},{id:"metrics:update_dashboard",method:"patch",path:"/v1/metrics/dashboards/{id}",pathParams:["id"],query:[],body:[{name:"metrics",type:"union",required:!1},{name:"name",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["metrics:write"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!1},class:"update",resource:"MetricDashboardSchema"},{id:"metrics:delete_dashboard",method:"delete",path:"/v1/metrics/dashboards/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["metrics:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"MetricDashboardSchema"},{id:"metrics:export",method:"get",path:"/v1/metrics/export",pathParams:[],query:[{name:"billing_type",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"end_date",type:"string",required:!0},{name:"interval",type:"TimeInterval",required:!0},{name:"metrics",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"start_date",type:"string",required:!0},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],class:"computed"},{id:"metrics:limits",method:"get",path:"/v1/metrics/limits",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],answers:{resource:"MetricsIntervalsLimits",list:!1,key:"intervals"},class:"retrieve",resource:"MetricsIntervalsLimits"},{id:"oauth2:authorize",method:"get",path:"/v1/oauth2/authorize",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,credentials:["oidc","pat"],class:"computed"},{id:"oauth2:introspect_token",method:"post",path:"/v1/oauth2/introspect",pathParams:[],query:[],body:[{name:"client_id",type:"string",required:!0},{name:"client_secret",type:"string",required:!0},{name:"token",type:"string",required:!0},{name:"token_type_hint",type:"union",required:!1}],bodyEncoding:"form",enums:{token_type_hint:["access_token","refresh_token"]},successStatus:200,class:"non-resource"},{id:"oauth2:clients:oauth2:create_client",method:"post",path:"/v1/oauth2/register",pathParams:[],query:[],body:[{name:"client_name",type:"string",required:!0},{name:"client_uri",type:"union",required:!1},{name:"default_sub_type",type:"SubType",required:!1},{name:"grant_types",type:"array",required:!1},{name:"logo_uri",type:"union",required:!1},{name:"policy_uri",type:"union",required:!1},{name:"redirect_uris",type:"array",required:!0},{name:"response_types",type:"array",required:!1},{name:"scope",type:"string",required:!1},{name:"token_endpoint_auth_method",type:"string",required:!1},{name:"tos_uri",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,credentials:["oidc","pat"],class:"non-resource"},{id:"oauth2:clients:oauth2:get_client",method:"get",path:"/v1/oauth2/register/{client_id}",pathParams:["client_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,credentials:["oidc","pat"],class:"computed"},{id:"oauth2:clients:oauth2:update_client",method:"put",path:"/v1/oauth2/register/{client_id}",pathParams:["client_id"],query:[],body:[{name:"client_id",type:"string",required:!0},{name:"client_name",type:"string",required:!0},{name:"client_uri",type:"union",required:!1},{name:"default_sub_type",type:"SubType",required:!1},{name:"grant_types",type:"array",required:!1},{name:"logo_uri",type:"union",required:!1},{name:"policy_uri",type:"union",required:!1},{name:"redirect_uris",type:"array",required:!0},{name:"response_types",type:"array",required:!1},{name:"scope",type:"string",required:!1},{name:"token_endpoint_auth_method",type:"string",required:!1},{name:"tos_uri",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,credentials:["oidc","pat"],class:"non-resource"},{id:"oauth2:clients:oauth2:delete_client",method:"delete",path:"/v1/oauth2/register/{client_id}",pathParams:["client_id"],query:[],body:[],bodyEncoding:"none",successStatus:204,credentials:["oidc","pat"],class:"delete"},{id:"oauth2:revoke_token",method:"post",path:"/v1/oauth2/revoke",pathParams:[],query:[],body:[{name:"client_id",type:"string",required:!0},{name:"client_secret",type:"string",required:!0},{name:"token",type:"string",required:!0},{name:"token_type_hint",type:"union",required:!1}],bodyEncoding:"form",enums:{token_type_hint:["access_token","refresh_token"]},successStatus:200,class:"non-resource"},{id:"oauth2:request_token",method:"post",path:"/v1/oauth2/token",pathParams:[],query:[],body:[],bodyEncoding:"form",successStatus:200,class:"non-resource"},{id:"oauth2:userinfo",method:"get",path:"/v1/oauth2/userinfo",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,credentials:["oidc"],class:"computed"},{id:"orders:list",method:"get",path:"/v1/orders/",pathParams:[],query:[{name:"checkout_id",type:"union",required:!1},{name:"created_after",type:"union",required:!1},{name:"created_before",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_billing_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!0,key:"items"},class:"list",resource:"Order"},{id:"orders:create",method:"post",path:"/v1/orders/",pathParams:[],query:[],body:[{name:"amount",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_id",type:"string",required:!0},{name:"description",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["orders:write"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"create",resource:"Order"},{id:"orders:get",method:"get",path:"/v1/orders/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"retrieve",resource:"Order"},{id:"orders:update",method:"patch",path:"/v1/orders/{id}",pathParams:["id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"billing_name",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["orders:write"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"update",resource:"Order"},{id:"orders:finalize",method:"post",path:"/v1/orders/{id}/finalize",pathParams:["id"],query:[],body:[{name:"payment_method_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["orders:write"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"action",resource:"Order"},{id:"orders:invoice",method:"get",path:"/v1/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"OrderInvoice"},{id:"orders:generate_invoice",method:"post",path:"/v1/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:202,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"action",resource:"Order"},{id:"orders:receipt",method:"get",path:"/v1/orders/{id}/receipt",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"OrderReceipt"},{id:"orders:export",method:"get",path:"/v1/orders/export",pathParams:[],query:[{name:"columns",type:"union",required:!1},{name:"created_after",type:"union",required:!1},{name:"created_before",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"computed"},{id:"organizations:list",method:"get",path:"/v1/organizations/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"slug",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["organizations:read","organizations:write"],credentials:["oat","oidc","pat"],answers:{resource:"Organization",list:!0,key:"items"},class:"list",resource:"Organization"},{id:"organizations:create",method:"post",path:"/v1/organizations/",pathParams:[],query:[],body:[{name:"avatar_url",type:"union",required:!1},{name:"country",type:"union",required:!1},{name:"customer_email_settings",type:"union",required:!1},{name:"customer_portal_settings",type:"union",required:!1},{name:"default_presentment_currency",type:"PresentmentCurrency",required:!1},{name:"default_tax_behavior",type:"TaxBehaviorOption",required:!1},{name:"details",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"feature_settings",type:"union",required:!1},{name:"legal_entity",type:"union",required:!1},{name:"name",type:"string",required:!0},{name:"slug",type:"string",required:!0},{name:"socials",type:"union",required:!1},{name:"subscription_settings",type:"union",required:!1},{name:"website",type:"union",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["organizations:write"],credentials:["oidc","pat"],answers:{resource:"Organization",list:!1},class:"create",resource:"Organization"},{id:"organizations:get",method:"get",path:"/v1/organizations/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["organizations:read","organizations:write"],credentials:["oat","oidc","pat"],answers:{resource:"Organization",list:!1},class:"retrieve",resource:"Organization"},{id:"organizations:update",method:"patch",path:"/v1/organizations/{id}",pathParams:["id"],query:[],body:[{name:"avatar_url",type:"union",required:!1},{name:"country",type:"union",required:!1},{name:"customer_email_settings",type:"union",required:!1},{name:"customer_portal_settings",type:"union",required:!1},{name:"default_presentment_currency",type:"union",required:!1},{name:"default_tax_behavior",type:"union",required:!1},{name:"details",type:"union",required:!1},{name:"dispute_settings",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"embed_hosts",type:"union",required:!1},{name:"feature_settings",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"socials",type:"union",required:!1},{name:"sso_enforced",type:"union",required:!1},{name:"subscription_settings",type:"union",required:!1},{name:"website",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["organizations:write"],credentials:["oat","oidc","pat"],answers:{resource:"Organization",list:!1},class:"update",resource:"Organization"},{id:"payments:list",method:"get",path:"/v1/payments/",pathParams:[],query:[{name:"checkout_id",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"method",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["payments:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Payment_"},{id:"payments:get",method:"get",path:"/v1/payments/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["payments:read"],credentials:["oat","oidc","pat"],class:"computed"},{id:"products:list",method:"get",path:"/v1/products/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"id",type:"union",required:!1},{name:"is_archived",type:"union",required:!1},{name:"is_recurring",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"visibility",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["products:read","products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!0,key:"items"},class:"list",resource:"Product"},{id:"products:create",method:"post",path:"/v1/products/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"create",resource:"Product"},{id:"products:get",method:"get",path:"/v1/products/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["products:read","products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"retrieve",resource:"Product"},{id:"products:update",method:"patch",path:"/v1/products/{id}",pathParams:["id"],query:[],body:[{name:"attached_custom_fields",type:"union",required:!1},{name:"description",type:"union",required:!1},{name:"is_archived",type:"union",required:!1},{name:"medias",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"prices",type:"union",required:!1},{name:"recurring_interval",type:"union",required:!1},{name:"recurring_interval_count",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1},{name:"visibility",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"update",resource:"Product"},{id:"products:update_benefits",method:"post",path:"/v1/products/{id}/benefits",pathParams:["id"],query:[],body:[{name:"benefits",type:"array",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"action",resource:"Product"},{id:"refunds:list",method:"get",path:"/v1/refunds/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"order_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1},{name:"succeeded",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["refunds:read","refunds:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Refund_"},{id:"refunds:create",method:"post",path:"/v1/refunds/",pathParams:[],query:[],body:[{name:"amount",type:"integer",required:!0},{name:"comment",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"order_id",type:"string",required:!0},{name:"reason",type:"string",required:!0},{name:"revoke_benefits",type:"boolean",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["refunds:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"subscriptions:list",method:"get",path:"/v1/subscriptions/",pathParams:[],query:[{name:"active",type:"union",required:!1},{name:"cancel_at_period_end",type:"union",required:!1},{name:"canceled_at_after",type:"union",required:!1},{name:"canceled_at_before",type:"union",required:!1},{name:"customer_cancellation_reason",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"started_after",type:"union",required:!1},{name:"started_before",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:read","subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!0,key:"items"},class:"list",resource:"Subscription"},{id:"subscriptions:create",method:"post",path:"/v1/subscriptions/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"create",resource:"Subscription"},{id:"subscriptions:get",method:"get",path:"/v1/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:read","subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"retrieve",resource:"Subscription"},{id:"subscriptions:update",method:"patch",path:"/v1/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"update",resource:"Subscription"},{id:"subscriptions:revoke",method:"delete",path:"/v1/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"delete",resource:"Subscription"},{id:"subscriptions:export",method:"get",path:"/v1/subscriptions/export",pathParams:[],query:[{name:"cancel_at_period_end",type:"union",required:!1},{name:"columns",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"started_after",type:"union",required:!1},{name:"started_before",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:read","subscriptions:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"webhooks:list_webhook_deliveries",method:"get",path:"/v1/webhooks/deliveries",pathParams:[],query:[{name:"end_timestamp",type:"union",required:!1},{name:"endpoint_id",type:"union",required:!1},{name:"event_type",type:"union",required:!1},{name:"http_code_class",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"start_timestamp",type:"union",required:!1},{name:"succeeded",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:read","webhooks:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_WebhookDelivery_"},{id:"webhooks:list_webhook_endpoints",method:"get",path:"/v1/webhooks/endpoints",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:read","webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!0,key:"items"},class:"list",resource:"WebhookEndpoint"},{id:"webhooks:create_webhook_endpoint",method:"post",path:"/v1/webhooks/endpoints",pathParams:[],query:[],body:[{name:"events",type:"array",required:!0},{name:"format",type:"WebhookFormat",required:!0},{name:"name",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"url",type:"string",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"create",resource:"WebhookEndpoint"},{id:"webhooks:get_webhook_endpoint",method:"get",path:"/v1/webhooks/endpoints/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:read","webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"retrieve",resource:"WebhookEndpoint"},{id:"webhooks:update_webhook_endpoint",method:"patch",path:"/v1/webhooks/endpoints/{id}",pathParams:["id"],query:[],body:[{name:"enabled",type:"union",required:!1},{name:"events",type:"union",required:!1},{name:"format",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"url",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"update",resource:"WebhookEndpoint"},{id:"webhooks:delete_webhook_endpoint",method:"delete",path:"/v1/webhooks/endpoints/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"WebhookEndpoint"},{id:"webhooks:reset_webhook_endpoint_secret",method:"patch",path:"/v1/webhooks/endpoints/{id}/secret",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"action",resource:"WebhookEndpoint"},{id:"webhooks:redeliver_webhook_event",method:"post",path:"/v1/webhooks/events/{id}/redeliver",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:202,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],class:"non-resource"}]};import{createPackFetch as xt}from"../../engine/v3/volter_world-core.mjs";import{sha256 as it}from"../../engine/v3/volter_world-core.mjs";var ve=()=>Response.json({error:"Unauthorized",detail:"Unauthorized"},{status:401});async function we(t,e){let r=t.call.operation.id==="checkouts:client_confirm"?[]:t.call.operation.credentials??[],a=/^Bearer\s+(\S+)/i.exec(t.call.request.headers.get("authorization")??"")?.[1];return(r.includes("oat")||r.includes("pat"))&&(!a||!t.rowsRaw("_access_token").some(n=>(n._environment??"production")===p(t)&&n._sha256===it(a)&&n.deleted!==!0&&(n.expires_at===null||Date.parse(String(n.expires_at))>Date.parse(t.occurredAt))))?ve():t.validate()??e()}async function ke(t){for(let e of u(t,k).filter(r=>r.status==="open"&&String(r.expires_at)<=t.occurredAt)){let r=await t.at(String(e.expires_at));r.legal("Checkout","status","checkout.update","open","expired",String(e.id),"time"),await r.write(k,String(e.id),{status:"expired",modified_at:r.occurredAt},"checkout.update")}for(let e of u(t,y).filter(r=>["trialing","active"].includes(String(r.status)))){let r=String(e.current_period_end);for(;r<=t.occurredAt;){let a=await t.at(r);if(e.cancel_at_period_end===!0){a.legal("Subscription","status","subscription.update",String(e.status),"canceled",String(e.id),"time"),await a.write(y,String(e.id),{status:"canceled",ended_at:r,ends_at:r,modified_at:r},"subscription.update");break}let s=J(r,String(e.recurring_interval),Number(e.recurring_interval_count??1));a.legal("Subscription","status","subscription.update","trialing","active",String(e.id),"time"),await a.write(y,String(e.id),{status:"active",current_period_start:r,current_period_end:s,modified_at:r},"subscription.update"),await Z(a,{...e,subscription_id:e.id},e.status==="trialing"?"subscription_create":"subscription_cycle",e.status==="trialing"?void 0:{start:String(e.current_period_start),end:r}),e.current_period_start=r,e.status="active",r=s}}}function Se(t){return O(t)}var oe={};Ge(oe,{accessTokens:()=>ut,appCredentials:()=>lt,deliveries:()=>ct,revokeToken:()=>dt});import{sha256 as ie}from"../../engine/v3/volter_world-core.mjs";async function ot(t,e,r){let a=t.mint("_access_token"),s=await A(t,"polar_oat_",`access-token:${a}`);return await t.record("_access_token",{comment:e,_environment:p(t),_sha256:ie(s),created_at:t.occurredAt,expires_at:r===null?null:new Date(Date.parse(t.occurredAt)+r*864e5).toISOString(),deleted:!1},a),{token:s,id:a}}async function ut(t){let e=q(t),r=typeof e.expires_in_days=="number"?e.expires_in_days:null;return Response.json(await ot(t,typeof e.comment=="string"?e.comment:"token",r),{status:201})}async function dt(t){let e=String(t.call.params.n);return t.rowsRaw("_access_token").some(r=>r.id===e&&r.deleted!==!0)?(await t.record("_access_token",{deleted:!0},e),new Response(null,{status:204})):Response.json({error:"no such token"},{status:404})}async function lt(t){let e=await A(t,"polar_oat_",`access-token:app:${p(t)}`);return t.rowsRaw("_access_token",{withDeleted:!0}).some(r=>r.id===`oat_app_${p(t)}`&&r._sha256===ie(e))||await t.record("_access_token",{comment:"world",_environment:p(t),_sha256:ie(e),created_at:t.occurredAt,expires_at:null,deleted:!1},`oat_app_${p(t)}`),Response.json({access_token:e},{status:201})}async function ct(t){let e=new URL(t.call.request.url).searchParams,r=t.rowsRaw("_webhook_delivery").filter(a=>(e.get("to")===null||a.url===e.get("to"))&&(e.get("type")===null||a.event_type===e.get("type"))).sort((a,s)=>Number(a.sent_at)-Number(s.sent_at));return Response.json({data:r.map(a=>({url:a.url,type:a.event_type,sent_at:a.sent_at,headers:a.headers,body:JSON.parse(String(a.body))}))})}var mt=864e5;async function Pe(t){let e=q(t),r=Array.isArray(e.products)?e.products.map(String):[];if(r.length===0)return g("products");let a=d(t,S,r[0]);if(!a||a.deleted===!0)return m(["products",0],"Product does not exist.");let s=[];for(let l of e.prices?.[r[0]]??[]){let h=t.mint("_price");await t.record("_price",{},h),s.push({...l,id:h,source:"ad_hoc"})}let n=(s.length?s:a.prices??[])[0],i=n?.amount_type==="fixed"?Number(n.price_amount??0):Number(e.amount??0),c=e.customer_id!==void 0?w(t,{id:e.customer_id}):void 0;if(e.customer_id!==void 0&&!c)return m(["customer_id"],"Customer does not exist.");let o=E(t,k);return await t.write(k,o,{..._e(t,{id:o,created_at:t.occurredAt,modified_at:null,status:"open",client_secret:await A(t,"polar_c_",`checkout:${o}`),expires_at:new Date(Date.parse(t.occurredAt)+mt).toISOString(),product_id:a.id,products:r,product_price_id:n?.id??null,amount:i,prices:{[String(a.id)]:s.length?s.map(l=>Y(t,l,a)):a.prices},currency:n?.price_currency??"usd",success_url:e.success_url??null,return_url:e.return_url??null,embed_origin:e.embed_origin??null,customer_ip_address:e.customer_ip_address??null,allow_discount_codes:e.allow_discount_codes??!0,require_billing_address:e.require_billing_address??!1,allow_trial:e.allow_trial??null,is_business_customer:e.is_business_customer??!1,customer_id:c?.id??null,customer_email:e.customer_email??c?.email??null,customer_name:e.customer_name??null,external_customer_id:e.external_customer_id??e.customer_external_id??null,metadata:e.metadata??{},customer_metadata:e.customer_metadata??{}}),_environment:p(t)},"checkout.create"),Response.json($(t,d(t,k,o)),{status:201})}var Ee=t=>u(t,k).find(e=>e.client_secret===t.call.params.client_secret),Ce=(t,e)=>{let{trial_interval:r,trial_interval_count:a,metadata:s,external_customer_id:n,subscription_id:i,customer_metadata:c,...o}=$(t,e);return{...o,organization:ne(t)}};async function Oe(t){let e=d(t,k,String(t.call.params.id));return e&&e.deleted!==!0?Response.json($(t,e)):P("Checkout")}async function xe(t){let e=String(t.params.query??"").toLowerCase(),r=u(t,k).filter(a=>C(t,"customer_id",a.customer_id)&&C(t,"external_customer_id",a.external_customer_id)&&C(t,"product_id",a.product_id)&&C(t,"status",a.status)).filter(a=>e===""||String(a.customer_email??"").toLowerCase().includes(e)).sort(T("created_at"));return t.list("Checkout",r.map(a=>$(t,a)))}async function re(t){let e=Ee(t);return e?Response.json(Ce(t,e)):P("Checkout")}async function ae(t){let e=Ee(t);if(!e)return P("Checkout");if(e.status==="expired")return M(410,"ExpiredCheckoutError","The checkout session is expired.");let r=t.legal("Checkout","status","checkouts:client_confirm",e.status,"confirmed",String(e.id),"external");if(r)return t.refuse(r);let a=q(t);if(e.is_payment_required&&!a.confirmation_token_id)return g("confirmation_token_id");let s=a.customer_email??e.customer_email,n=e.customer_id?w(t,{id:e.customer_id}):e.external_customer_id?w(t,{external:e.external_customer_id}):void 0;if(!n&&s&&(n=u(t,b).find(f=>String(f.email).toLowerCase()===s.toLowerCase())),!n&&!s)return g("customer_email");let i=d(t,S,String(e.product_id));if(!i)return m(["products",0],"Product does not exist.");let c=n,o=i.recurring_interval!=null&&c?u(t,y).find(f=>f.customer_id===c.id&&f.product_id===i.id&&["trialing","active"].includes(String(f.status))):void 0;if(o)return t.refuse(t.legal("Subscription","status","checkouts:client_confirm",o.status,void 0,String(o.id),"external"));let l=t.occurredAt,h=!1;if(await t.change("Checkout",String(e.id),f=>{if(f.status==="open")return h=!0,{status:"confirmed",modified_at:l}},"checkout.update"),!h)return M(403,"CheckoutForbiddenError","The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.");if(!n){let f=E(t,b);await t.write(b,f,{...H(t,{id:f,created_at:t.occurredAt,modified_at:null,email:s,name:a.customer_name??e.customer_name??null,external_id:e.external_customer_id??null,email_verified:!1,metadata:{}}),_environment:p(t)},"customer.create"),n=d(t,b,f)}let _=String(n.id);await t.write(k,String(e.id),{customer_id:_,customer_email:n.email,modified_at:l},"checkout.update");let v=null;if(i.recurring_interval){v=E(t,y);let f=i.trial_interval!=null,j=J(l,String(f?i.trial_interval:i.recurring_interval),Number(f?i.trial_interval_count??1:i.recurring_interval_count??1));await t.write(y,v,{...me(t,{id:v,created_at:l,modified_at:null,amount:e.amount,currency:e.currency??"usd",recurring_interval:i.recurring_interval,recurring_interval_count:i.recurring_interval_count??1,status:"incomplete",current_period_start:l,current_period_end:j,trial_start:f?l:null,trial_end:f?j:null,cancel_at_period_end:!1,canceled_at:null,started_at:l,ends_at:null,ended_at:null,customer_id:_,product_id:i.id,checkout_id:e.id,prices:e.prices[String(i.id)],metadata:e.metadata??{}}),_environment:p(t)},"subscription.create"),t.legal("Subscription","status","subscription.activate","incomplete",f?"trialing":"active",v,"vendor"),await t.write(y,v,{status:f?"trialing":"active",modified_at:l},"subscription.activate")}i.trial_interval||await Z(t,{...e,customer_id:_,subscription_id:v},v?"subscription_create":"purchase");let F=await X(t,n),Q={...Ce(t,d(t,k,String(e.id))),customer_session_token:F.token};return t.legal("Checkout","status","checkout.update","confirmed","succeeded",String(e.id),"vendor"),await t.write(k,String(e.id),{status:"succeeded",subscription_id:v,modified_at:l},"checkout.update"),Response.json(Q)}async function Re(t){let e=q(t);if(e.customer_id===void 0&&e.external_customer_id===void 0)return g("customer_id");let r=e.customer_id!==void 0?w(t,{id:e.customer_id}):w(t,{external:e.external_customer_id});return r?Response.json(await X(t,r,e.return_url),{status:201}):m([e.customer_id!==void 0?"customer_id":"external_customer_id"],"Customer does not exist.")}var yt=["email","name","external_id","billing_name","billing_address","tax_id","locale","metadata"];function ft(t,e,r){return typeof e.email=="string"&&u(t,b).some(s=>s.id!==r&&String(s.email).toLowerCase()===String(e.email).toLowerCase())?qt():e.external_id!=null&&u(t,b).some(s=>s.id!==r&&s.external_id===e.external_id)?gt():void 0}async function je(t){let e=q(t);if(typeof e.email!="string"||e.email==="")return g("email");let r=ft(t,e);if(r)return r;let a=E(t,b),s={id:a,created_at:t.occurredAt,modified_at:null,email_verified:!1};for(let n of yt)n in e&&(s[n]=e[n]);return await t.write(b,a,{...H(t,s),_environment:p(t)},"customer.create"),Response.json(x(t,d(t,b,a)),{status:201})}var bt=t=>w(t,{external:decodeURIComponent(t.call.params.external_id??"")});async function ze(t){let e=w(t,{id:t.call.params.id});return e?Response.json(x(t,e)):P("Customer")}async function Me(t){let e=bt(t);return e?Response.json(await fe(t,e)):P("Customer")}async function Ae(t){let e=String(t.params.query??"").toLowerCase(),r=new Set(u(t,y).filter(n=>["trialing","active","past_due"].includes(String(n.status))).map(n=>n.customer_id)),a=t.params.active===void 0?void 0:String(t.params.active)==="true",s=u(t,b).filter(n=>t.params.email===void 0||String(n.email??"").toLowerCase()===String(t.params.email).toLowerCase()).filter(n=>e===""||[n.name,n.email,n.external_id].some(i=>typeof i=="string"&&i.toLowerCase().includes(e))).filter(n=>a===void 0||r.has(n.id)===a).sort(T("created_at"));return t.list(b,s.map(n=>x(t,n)))}function gt(){return m(["external_id"],"A customer with this external ID already exists.")}function qt(){return m(["email"],"A customer with this email address already exists.")}var vt=["checkout_id","customer_id","product_id","subscription_id","status"];async function Te(t){let e=d(t,R,String(t.call.params.id));return e?Response.json(N(t,e)):P("Order")}async function Ie(t){let e=u(t,R).filter(r=>vt.every(a=>t.params[a]===void 0||[].concat(t.params[a]).map(String).includes(String(r[a])))).sort((r,a)=>String(a.created_at).localeCompare(String(r.created_at)));return t.list("Order",e.map(r=>N(t,r)))}var kt=new Set(["fixed","free","custom","metered_unit","seat_based"]);async function Le(t){let e=q(t);if(typeof e.name!="string"||e.name==="")return g("name");let r=Array.isArray(e.prices)?e.prices:[];if(r.length===0)return g("prices");let a=r.findIndex(i=>!kt.has(String(i.amount_type)));if(a>=0)return m(["prices",a,"amount_type"],"Input tag does not match any of the expected tags","union_tag_invalid");let s=E(t,S),n=[];for(let i of r){let c=t.mint("_price");await t.record("_price",{},c),n.push(Y(t,{...i,id:c},{...e,id:s,created_at:t.occurredAt}))}return await t.write(S,s,{...ce(t,{id:s,created_at:t.occurredAt,modified_at:null,name:e.name,description:e.description??null,recurring_interval:e.recurring_interval??null,recurring_interval_count:e.recurring_interval_count??(e.recurring_interval?1:null),trial_interval:e.trial_interval??null,trial_interval_count:e.trial_interval_count??null,visibility:e.visibility??"public",is_archived:!1,prices:n,benefit_ids:[],metadata:e.metadata??{}}),_environment:p(t)},"product.create"),Response.json(L(t,d(t,S,s)),{status:201})}async function De(t){let e=i=>i===void 0?void 0:String(i)==="true",r=e(t.params.is_archived),a=e(t.params.is_recurring),s=String(t.params.query??"").toLowerCase(),n=u(t,S).filter(i=>r===void 0||!!i.is_archived===r).filter(i=>a===void 0||i.recurring_interval!=null===a).filter(i=>s===""||String(i.name).toLowerCase().includes(s)).filter(i=>t.params.benefit_id===void 0||(i.benefit_ids??[]).includes(String(t.params.benefit_id))).sort((i,c)=>String(c.created_at).localeCompare(String(i.created_at)));return t.list("Product",n.map(i=>L(t,i)))}async function Ne(t){let e=q(t);if(typeof e.order_id!="string"||!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e.order_id))return m(["order_id"],"Input should be a valid UUID version 4.");if(!Number.isSafeInteger(e.amount)||Number(e.amount)<1)return m(["amount"],"Amount must be a positive integer.");if(!["duplicate","fraudulent","customer_request","service_disruption","satisfaction_guarantee","other"].includes(String(e.reason)))return m(["reason"],"Choose a documented refund reason.");if(e.revoke_benefits!==void 0&&typeof e.revoke_benefits!="boolean")return m(["revoke_benefits"],"Input should be a valid boolean.");if(e.comment!=null&&typeof e.comment!="string")return m(["comment"],"Input should be a valid string.");let r=e.metadata??{};if(typeof r!="object"||Array.isArray(r)||Object.keys(r).length>50||Object.entries(r).some(([o,l])=>o.length<1||o.length>40||!["string","number","boolean"].includes(typeof l)||typeof l=="string"&&(l.length<1||l.length>500)))return m(["metadata"],"Invalid refund metadata.");let a=d(t,R,e.order_id);if(!a)return m(["order_id"],"Order does not exist.");if(e.revoke_benefits===!0&&a.subscription_id!=null)return m(["revoke_benefits"],"Subscription benefits are revoked by canceling the subscription.");let s=Number(e.amount),n,i=!1;if(await t.change("Order",e.order_id,o=>{if(o.status==="refunded"){n=M(403,"RefundedAlready","Order is already fully refunded.");return}if(!["paid","partially_refunded"].includes(String(o.status))){n=m(["order_id"],"Only a paid order can be refunded.");return}let l=Number(o.refunded_amount??0)+s,h=Number(o.total_amount);if(l>h){n=m(["amount"],"Amount exceeds the remaining refundable balance.");return}let _=l===h?"refunded":"partially_refunded";return t.legal("Order","status","refunds:create",o.status,_,e.order_id,"api"),i=!0,{status:_,refunded_amount:l,refundable_amount:h-l,modified_at:t.occurredAt}},"order.refund"),!i)return n??m(["order_id"],"Order is unavailable.");let c=await t.create("_refund",o=>({id:o,created_at:t.occurredAt,modified_at:t.occurredAt,metadata:r,status:"succeeded",reason:e.reason,amount:s,tax_amount:0,currency:a.currency,organization_id:O(t),order_id:a.id,subscription_id:a.subscription_id??null,customer_id:a.customer_id,revoke_benefits:e.revoke_benefits??!1,dispute:null,_environment:p(t),_comment:e.comment??null}),"refund.create");return Response.json(I(t,c),{status:201})}async function $e(t){let e=d(t,y,String(t.call.params.id));return e?Response.json(W(t,e)):P("Subscription")}async function Ue(t){let e=t.params.external_customer_id===void 0?void 0:[].concat(t.params.external_customer_id).map(s=>String(w(t,{external:String(s)})?.id)),r=t.params.active===void 0?void 0:String(t.params.active)==="true",a=u(t,y).filter(s=>C(t,"customer_id",s.customer_id)&&C(t,"product_id",s.product_id)&&C(t,"status",s.status)).filter(s=>e===void 0||e.includes(String(s.customer_id))).filter(s=>r===void 0||["trialing","active","past_due"].includes(String(s.status))===r).sort(T("started_at"));return t.list("Subscription",a.map(s=>W(t,s)))}async function Fe(t){let e=d(t,y,String(t.call.params.id));if(!e)return P("Subscription");let r=q(t);if(typeof r.cancel_at_period_end!="boolean")return g("cancel_at_period_end");let a=r.cancel_at_period_end,s=t.legal("Subscription","status","subscriptions:update",e.status,void 0,String(e.id),"api");if(s)return t.refuse(s);if(a&&e.cancel_at_period_end===!0)return M(403,"AlreadyCanceledSubscription","Subscription is already canceled or will be at the end of the period, or is not active.");let n=t.occurredAt;return await t.write(y,String(e.id),a?{cancel_at_period_end:!0,canceled_at:n,ends_at:e.current_period_end,modified_at:n}:{cancel_at_period_end:!1,canceled_at:null,ends_at:null,modified_at:n},"subscription.update"),Response.json(W(t,d(t,y,String(e.id))))}var Ct=["raw","discord","slack"];async function Be(t){let e=q(t);if(typeof e.url!="string"||e.url==="")return g("url");if(!/^https?:\/\/[^\s]+$/.test(e.url))return m(["url"],"Input should be a valid URL","url_parsing");if(e.format===void 0)return g("format");if(!Ct.includes(String(e.format)))return m(["format"],"Input should be 'raw', 'discord' or 'slack'","enum");if(!Array.isArray(e.events))return g("events");let r=E(t,se),a=await A(t,"polar_whs_",`endpoint:${r}`),s={created_at:t.occurredAt,modified_at:null,id:r,url:e.url,name:e.name??null,format:e.format,secret:a,organization_id:O(t),events:e.events,enabled:!0};return await t.write(se,r,{...s,_environment:p(t)},"webhook_endpoint.create"),Response.json(s,{status:201})}var We={"checkouts:client_confirm":ae,"checkouts:client_get":re,"checkouts:create":Pe,"checkouts:get":Oe,"checkouts:list":xe,"customer-sessions:create":Re,"customers:create":je,"customers:get":ze,"customers:get_state_external":Me,"customers:list":Ae,"events:ingest":be,"events:list":ge,"orders:get":Te,"orders:list":Ie,"products:create":Le,"products:list":De,"refunds:create":Ne,"subscriptions:get":$e,"subscriptions:list":Ue,"subscriptions:update":Fe,"webhooks:create_webhook_endpoint":Be};var z=t=>String(t??"").replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]);async function Ve(t){let e=String(t.call.params.client_secret),r=new URL(t.call.request.url).pathname.replace(/\/+$/,"").endsWith("/pay"),a=t.publicBase.replace(/\/+$/,""),s=await re(t);if(!s.ok)return new Response("This checkout does not exist.",{status:404,headers:{"content-type":"text/plain; charset=utf-8"}});let n=await s.json();if(r&&t.call.request.method==="POST"){let l=new URLSearchParams(t.text),h=await ae({...t,body:{customer_email:l.get("email")||n.customer_email,confirmation_token_id:await t.secret(`test-stripe-confirmation:${n.id}`)}});return h.ok?new Response(null,{status:303,headers:{location:n.success_url.replace("{CHECKOUT_ID}",n.id)}}):new Response(`The payment could not be completed (${h.status}).`,{status:h.status,headers:{"content-type":"text/plain; charset=utf-8"}})}let i=`$${(Number(n.amount)/100).toFixed(2)}`,c=n.product?.recurring_interval?` / ${n.product.recurring_interval}`:"",o=n.status!=="open"?`<p>This checkout is ${z(n.status)}.</p>`:`<form method="post" action="${z(a)}/${z(e)}/pay"><label>Email<input name="email" type="email" required value="${z(n.customer_email)}"></label><label>Card<input value="4242 4242 4242 4242" readonly></label><button type="submit">Pay ${z(i)}${z(c)}</button></form>`;return new Response(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Checkout</title><style>body{font:16px/1.5 system-ui,sans-serif;background:#f7f7f8;margin:0}main{max-width:440px;margin:48px auto;background:#fff;border:1px solid #e5e5e8;border-radius:12px;padding:28px}h1{font-size:20px;margin:0}p.price{font-size:30px;font-weight:600;margin:10px 0 20px}label{display:block;font-size:13px;color:#555;margin:12px 0}input{display:block;width:100%;box-sizing:border-box;padding:9px;border:1px solid #ccc;border-radius:8px;font:inherit;margin-top:4px}button{margin-top:16px;width:100%;padding:11px;border:0;border-radius:8px;background:#0062ff;color:#fff;font:inherit;cursor:pointer}</style></head><body><main><h1>${z(n.product?.name??"Checkout")}</h1><p class="price">${z(i)}<small>${z(c)}</small></p>${o}</main></body></html>`,{headers:{"content-type":"text/html; charset=utf-8"}})}var V=t=>String(t??"").replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]);async function Ke(t){let e=new URL(t.call.request.url).searchParams.get("customer_session_token"),r=u(t,G).find(o=>o.token===e&&String(o.expires_at)>t.occurredAt);if(!r)return new Response("Unauthorized",{status:401});let a=d(t,b,String(r.customer_id));if(!a)return new Response("Customer not found",{status:404});let s=u(t,y).filter(o=>o.customer_id===a.id&&["active","trialing"].includes(String(o.status))),n=u(t,R).filter(o=>o.customer_id===a.id).sort((o,l)=>String(l.created_at).localeCompare(String(o.created_at))),i=s.map(o=>`<li>${V(L(t,d(t,S,String(o.product_id))).name)}: ${V(o.status)}</li>`).join(""),c=n.map(o=>{let l=N(t,o);return`<li>${V(l.invoice_number)} \u2014 ${V(l.currency)} ${(Number(l.total_amount)/100).toFixed(2)}</li>`}).join("");return new Response(`<!doctype html><html lang="en"><title>Customer portal</title><main><h1>Billing for ${V(x(t,a).email)}</h1><h2>Subscriptions</h2><ul>${i||"<li>No active subscriptions</li>"}</ul><h2>Purchase history</h2><ul>${c||"<li>No purchases</li>"}</ul><a href="${V(r.return_url)}">Return to the application</a></main></html>`,{headers:{"content-type":"text/html; charset=utf-8"}})}function ue(t={}){return xt({manifest:ee,surface:te,handlers:We,doors:oe,around:we,clock:ke,tenant:Se,screens:{checkout:Ve,portal:Ke}},t)}import{serveHttp as qr}from"../../engine/v3/volter_world-core.mjs";var Er=jt(Rt(ee,te));export{ue as createTwinFetch};
|
|
2
|
+
var Qe=Object.defineProperty;var Ge=(t,e)=>{for(var r in e)Qe(t,r,{get:e[r],enumerable:!0})};import{packOf as Rt,registerPack as jt}from"../../engine/v3/volter_world-core.mjs";function w(t,e){return e.id!==void 0?u(t,b).find(r=>r.id===e.id):u(t,b).find(r=>r.external_id===e.external)}var He="organization",b="customer",S="product",k="checkout",y="subscription",R="order",D="event",B="meter",G="customer_session",se="webhook_endpoint",de="https://buy.polar.sh",Ye="https://polar.sh",M=(t,e,r)=>Response.json({error:e,detail:r},{status:t}),P=t=>M(404,"ResourceNotFound",`${t} not found.`),m=(t,e,r="value_error")=>Response.json({detail:[{type:r,loc:["body",...t],msg:e,input:null}]},{status:422}),g=t=>m([t],"Field required","missing"),q=t=>t.body&&typeof t.body=="object"&&!Array.isArray(t.body)?t.body:{},Ze={product:"Product",checkout:"Checkout",subscription:"Subscription",order:"Order",webhook_endpoint:"WebhookEndpoint"},E=(t,e)=>t.mint(Ze[e]??e);async function A(t,e,r){let a=await t.secret(`polar-secret:${r}`),s=await t.secret(`polar-secret:${r}:2`);return`${e}${`${a}${s}`.replace(/[^A-Za-z0-9]/g,"").slice(0,43)}`}var Je="1dbfc517-0bbf-4301-9ba8-555ca42b9737",O=t=>p(t)==="sandbox"?"2dbfc517-0bbf-4301-9ba8-555ca42b9737":Je,ne=t=>{let e=d(t,He,"org")??{};return{created_at:e.created_at??"2026-01-01T00:00:00Z",modified_at:null,id:O(t),name:e.name??"Twin organization",slug:e.slug??"twin",avatar_url:null,proration_behavior:"prorate",allow_customer_updates:!0,email:null,website:null,socials:[],status:"active",details_submitted_at:null,onboarding_resubmission_requested_at:null,sso_enforced:!1,default_presentment_currency:"usd",default_tax_behavior:"location",feature_settings:{},subscription_settings:{allow_multiple_subscriptions:!1,allow_customer_updates:!0,proration_behavior:"prorate",benefit_revocation_grace_period:0,prevent_trial_abuse:!1},customer_email_settings:{},customer_portal_settings:{},dispute_settings:{},embed_hosts:[],embed_hosts_enforced:!1,account_id:null,payout_account_id:null,capabilities:{}}},C=(t,e,r)=>t.params[e]===void 0||[].concat(t.params[e]).map(String).includes(String(r)),T=t=>(e,r)=>String(r[t]).localeCompare(String(e[t])),p=t=>new URL(t.call.request.url).hostname.startsWith("sandbox")?"sandbox":"production",u=(t,e)=>t.rowsRaw(e).filter(r=>r.deleted!==!0&&(r._environment??(r.organization_id==="2dbfc517-0bbf-4301-9ba8-555ca42b9737"?"sandbox":"production"))===p(t)),d=(t,e,r)=>u(t,e).find(a=>a.id===r),I=(t,e)=>Object.fromEntries(Object.entries(t.own(e)).filter(([r])=>!r.startsWith("_"))),x=(t,e)=>I(t,e),L=(t,e)=>I(t,e),W=(t,e)=>I(t,e),N=(t,e)=>I(t,e),le=(t,e)=>I(t,e),$=(t,e)=>I(t,e);function H(t,e){return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,metadata:e.metadata??{},external_id:e.external_id??null,email:e.email,email_verified:e.email_verified??!1,type:"individual",name:e.name??null,billing_name:e.billing_name??null,billing_address:e.billing_address??null,tax_id:e.tax_id??null,locale:e.locale??null,organization_id:O(t),default_payment_method_id:null,deleted_at:e.deleted_at??null,first_user_event_at:e.first_user_event_at??null,avatar_url:`https://www.gravatar.com/avatar/${String(e.email??"")}?d=404`}}function Y(t,e,r){let a={created_at:r.created_at,modified_at:null,id:e.id,source:e.source??"catalog",amount_type:e.amount_type,price_currency:e.price_currency??"usd",tax_behavior:null,is_archived:e.is_archived??!1,product_id:r.id};if(e.amount_type==="fixed")return{...a,price_amount:e.price_amount};if(e.amount_type==="custom")return{...a,minimum_amount:e.minimum_amount??null,maximum_amount:e.maximum_amount??null,preset_amount:e.preset_amount??null};if(e.amount_type!=="metered_unit")return a;let s=d(t,B,String(e.meter_id));return{...a,unit_amount:String(e.unit_amount??"0"),cap_amount:e.cap_amount??null,meter_id:e.meter_id,meter:{id:e.meter_id,name:s?.name??"",unit:s?.unit??"scalar",custom_label:s?.custom_label??null,custom_multiplier:s?.custom_multiplier??null}}}function ce(t,e){return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,trial_interval:e.trial_interval??null,trial_interval_count:e.trial_interval_count??null,name:e.name,description:e.description??null,visibility:e.visibility??"public",recurring_interval:e.recurring_interval??null,recurring_interval_count:e.recurring_interval?Number(e.recurring_interval_count??1):null,meter_interval:null,meter_interval_count:null,is_recurring:e.recurring_interval!=null,is_archived:e.is_archived??!1,organization_id:O(t),metadata:e.metadata??{},prices:e.prices??[],benefits:[],medias:[],attached_custom_fields:[]}}function me(t,e){let r=d(t,b,String(e.customer_id)),a=d(t,S,String(e.product_id));return{created_at:e.created_at,modified_at:e.modified_at??null,id:e.id,amount:e.amount??0,currency:e.currency??"usd",recurring_interval:e.recurring_interval,recurring_interval_count:Number(e.recurring_interval_count??1),status:e.status,current_period_start:e.current_period_start,current_period_end:e.current_period_end??null,current_meter_period_start:null,current_meter_period_end:null,trial_start:e.trial_start??null,trial_end:e.trial_end??null,cancel_at_period_end:e.cancel_at_period_end??!1,canceled_at:e.canceled_at??null,started_at:e.started_at??null,ends_at:e.ends_at??null,ended_at:e.ended_at??null,pause_at_period_end:!1,paused_at:null,resumes_at:null,customer_id:e.customer_id,product_id:e.product_id,discount_id:e.discount_id??null,checkout_id:e.checkout_id??null,customer_cancellation_reason:e.customer_cancellation_reason??null,customer_cancellation_comment:e.customer_cancellation_comment??null,metadata:e.metadata??{},custom_field_data:{},customer:r?x(t,r):null,product:a?L(t,a):null,discount:null,prices:e.prices??a?.prices??[],meters:e.meters??[],pending_update:null}}function Xe(t,e){let r=d(t,b,String(e.customer_id)),a=e.product_id?d(t,S,String(e.product_id)):void 0,s=e.subscription_id?d(t,y,String(e.subscription_id)):void 0,n=Number(e.total_amount??0),i=Number(e.refunded_amount??0);return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,status:e.status,paid:["paid","refunded","partially_refunded"].includes(String(e.status)),subtotal_amount:n,discount_amount:0,net_amount:n,tax_amount:0,total_amount:n,applied_balance_amount:0,due_amount:0,refunded_amount:i,refunded_tax_amount:0,currency:e.currency??"usd",billing_reason:e.billing_reason,billing_name:null,billing_address:null,invoice_number:`TWIN-${String(e.number??1).padStart(4,"0")}`,is_invoice_generated:!1,receipt_number:null,customer_id:e.customer_id,product_id:e.product_id??null,discount_id:null,subscription_id:e.subscription_id??null,checkout_id:e.checkout_id??null,metadata:e.metadata??{},custom_field_data:{},platform_fee_amount:0,platform_fee_currency:null,customer:r?x(t,r):null,product:a?(({prices:c,benefits:o,medias:l,attached_custom_fields:h,..._})=>_)(L(t,a)):null,discount:null,subscription:s?(({customer:c,product:o,discount:l,prices:h,meters:_,pending_update:v,...F})=>F)(W(t,s)):null,items:e.items??[],description:a?.name??"Order",refundable_amount:n-i,refundable_tax_amount:0}}function pe(t,e){let r=e.customer_id?d(t,b,String(e.customer_id)):void 0;return{id:e.id,timestamp:e.timestamp,organization_id:O(t),customer_id:e.customer_id??null,customer:r&&r.deleted!==!0?x(t,r):null,external_customer_id:e.external_customer_id??null,member_id:null,external_member_id:null,child_count:0,parent_id:null,label:e.name,name:e.name,source:"user",metadata:e.metadata??{}}}function _e(t,e){let r=d(t,S,String(e.product_id)),a=r?L(t,r):null,s=e.prices?.[String(e.product_id)]??a?.prices??[],n=s.find(c=>c.id===e.product_price_id)??s[0]??null,i=Number(e.amount??0);return{id:e.id,created_at:e.created_at,modified_at:e.modified_at??null,payment_processor:"stripe",status:e.status,client_secret:e.client_secret,url:`${de}/${String(e.client_secret)}`,expires_at:e.expires_at,success_url:e.success_url??`${de}/${String(e.client_secret)}/confirmation`,return_url:e.return_url??null,embed_origin:e.embed_origin??null,amount:i,discount_amount:0,net_amount:i,tax_amount:null,tax_behavior:null,total_amount:i,currency:e.currency??"usd",allow_trial:e.allow_trial??null,active_trial_interval:r?.trial_interval??null,active_trial_interval_count:r?.trial_interval_count??null,trial_end:null,organization_id:O(t),product_id:e.product_id,product_price_id:n?.id??null,discount_id:null,allow_discount_codes:e.allow_discount_codes??!0,require_billing_address:e.require_billing_address??!1,is_discount_applicable:!1,is_free_product_price:i===0,is_payment_required:i>0,is_payment_setup_required:a?.is_recurring===!0,is_payment_form_required:i>0,customer_id:e.customer_id??null,is_business_customer:e.is_business_customer??!1,customer_name:e.customer_name??null,customer_email:e.customer_email??null,customer_ip_address:e.customer_ip_address??null,customer_billing_name:null,customer_billing_address:null,customer_tax_id:null,payment_method_type:null,payment_processor_metadata:{},billing_address_fields:{country:"required",state:"disabled",city:"disabled",postal_code:"disabled",line1:"disabled",line2:"disabled"},trial_interval:null,trial_interval_count:null,metadata:e.metadata??{},external_customer_id:e.external_customer_id??null,custom_field_data:{},products:a?[a]:[],product:a,product_price:n,prices:a?{[String(a.id)]:s}:{},discount:null,subscription_id:e.subscription_id??null,attached_custom_fields:[],customer_metadata:e.customer_metadata??{}}}function K(t,e){let r=t?.clauses??[];if(r.length===0)return!0;let a=s=>{if("clauses"in s)return K(s,e);let n=String(s.property??""),i=n==="name"||n==="source"?e[n]:(e.metadata??{})[n.replace(/^metadata\./,"")],c=s.value;return String(i)===String(c)};return String(t?.conjunction??"and")==="or"?r.some(a):r.every(a)}function ye(t,e){let r=String(t?.func??"count");if(r==="count")return e.length;let a=String(t?.property??"").replace(/^metadata\./,"");if(r==="unique")return new Set(e.map(i=>(i.metadata??{})[a])).size;let s=e.map(i=>Number((i.metadata??{})[a])).filter(Number.isFinite);if(s.length===0)return 0;if(r==="max")return Math.max(...s);if(r==="min")return Math.min(...s);let n=s.reduce((i,c)=>i+c,0);return r==="avg"?n/s.length:n}function et(t,e,r){let a=u(t,D).filter(i=>i.customer_id===e&&K(r.filter,i)),s=ye(r.aggregation,a),n=0;return{consumed:s,credited:n,balance:n-s}}async function fe(t,e){let r=String(e.id);for(let s of u(t,B))if(!u(t,"_customer_meter").some(n=>n.customer_id===r&&n.meter_id===s.id)){let n=t.mint("_customer_meter");await t.record("_customer_meter",{id:n,customer_id:r,meter_id:s.id,_environment:p(t)},n)}let a=u(t,y).filter(s=>s.customer_id===r&&(s.status==="active"||s.status==="trialing"));return{...x(t,e),active_subscriptions:a.map(s=>{let n=W(t,s);return{id:n.id,created_at:n.created_at,modified_at:n.modified_at,metadata:n.metadata,status:n.status,amount:n.amount,currency:n.currency,recurring_interval:n.recurring_interval,current_period_start:n.current_period_start,current_period_end:n.current_period_end,trial_start:n.trial_start,trial_end:n.trial_end,cancel_at_period_end:n.cancel_at_period_end,canceled_at:n.canceled_at,started_at:n.started_at,ends_at:n.ends_at,product_id:n.product_id,discount_id:n.discount_id,meters:[],custom_field_data:{}}}),granted_benefits:[],active_meters:u(t,B).map(s=>{let{consumed:n,credited:i,balance:c}=et(t,r,s);return{id:u(t,"_customer_meter").find(o=>o.customer_id===r&&o.meter_id===s.id).id,created_at:s.created_at,modified_at:null,meter_id:s.id,consumed_units:n,credited_units:i,balance:c}})}}async function Z(t,e,r,a){let s=E(t,R),n=Number(t.mint("_seq_order"));await t.record("_seq_order",{},String(n));let i=d(t,S,String(e.product_id)),c=e.prices&&!Array.isArray(e.prices)?e.prices[String(i.id)]:e.prices,o=[];for(let _ of c??i.prices){let v=_.amount_type==="fixed"?Number(_.price_amount):_.amount_type==="custom"?Number(e.amount??0):0;if(_.amount_type==="metered_unit"&&a){let Q=d(t,B,String(_.meter_id)),f=u(t,D).filter(j=>j.customer_id===e.customer_id&&String(j._received_at??j.timestamp)>=a.start&&String(j._received_at??j.timestamp)<a.end&&K(Q.filter,j));v=Math.ceil(ye(Q.aggregation,f)*Number(_.unit_amount)),_.cap_amount!=null&&(v=Math.min(v,Number(_.cap_amount)))}let F=t.mint("_order_item");await t.record("_order_item",{},F),o.push({id:F,created_at:t.occurredAt,modified_at:null,label:i.name,amount:v,tax_amount:0,proration:!1,product_price_id:_.id})}let l=o.reduce((_,v)=>_+Number(v.amount),0),h=Xe(t,{id:s,created_at:t.occurredAt,modified_at:null,status:"pending",total_amount:l,currency:e.currency??"usd",refunded_amount:0,billing_reason:r,customer_id:e.customer_id,product_id:e.product_id,subscription_id:e.subscription_id??null,checkout_id:e.checkout_id??e.id,metadata:e.metadata??{},number:n,items:o});await t.write(R,s,{...h,_environment:p(t)},"order.create"),t.legal("Order","status","order.pay","pending","paid",s,"vendor"),await t.write(R,s,{status:"paid",paid:!0,modified_at:t.occurredAt},"order.pay")}function J(t,e,r){let a=new Date(t);if(e==="day"||e==="week")a.setUTCDate(a.getUTCDate()+r*(e==="week"?7:1));else{let s=a.getUTCDate();a.setUTCDate(1),e==="year"?a.setUTCFullYear(a.getUTCFullYear()+r):a.setUTCMonth(a.getUTCMonth()+r);let n=new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth()+1,0)).getUTCDate();a.setUTCDate(Math.min(s,n))}return a.toISOString()}async function X(t,e,r=null){let a=E(t,G),s=await A(t,"polar_cst_",`session:${a}`),n={id:a,created_at:t.occurredAt,modified_at:null,token:s,expires_at:new Date(Date.parse(t.occurredAt)+36e5).toISOString(),return_url:r,customer_portal_url:`${Ye}/${String(ne(t).slug)}/portal?customer_session_token=${s}`,customer_id:e.id,customer:x(t,e)};return await t.write(G,a,{...n,_environment:p(t)},"customer_session.create"),n}async function be(t){let e=q(t).events;if(!Array.isArray(e))return g("events");for(let[s,n]of e.entries()){if(!n||typeof n.name!="string")return m(["events",s,"name"],"Field required","missing");if(n.customer_id!==void 0&&!w(t,{id:n.customer_id}))return m(["events",s,"customer_id"],"Customer does not exist.")}let r=0,a=0;for(let s of e){if(s.external_id!=null&&u(t,"_event_key").some(c=>c.external_id===s.external_id)){a+=1;continue}let n=s.customer_id!==void 0?w(t,{id:s.customer_id}):s.external_customer_id!==void 0?w(t,{external:s.external_customer_id}):void 0,i=E(t,D);await t.write(D,i,{...pe(t,{id:i,timestamp:s.timestamp??t.occurredAt,name:s.name,customer_id:n?.id??null,external_customer_id:s.external_customer_id??null,metadata:s.metadata??{}}),_environment:p(t),_received_at:t.occurredAt},"event.ingest"),s.external_id!=null&&await t.record("_event_key",{external_id:s.external_id,_environment:p(t)}),r+=1}return Response.json({inserted:r,duplicates:a})}async function ge(t){let e=t.params.meter_id===void 0?void 0:d(t,B,String(t.params.meter_id));if(t.params.meter_id!==void 0&&(!e||e.deleted===!0))return P("Meter");let r=t.params.start_timestamp===void 0?void 0:Date.parse(String(t.params.start_timestamp)),a=t.params.end_timestamp===void 0?void 0:Date.parse(String(t.params.end_timestamp)),s=String(t.params.query??"").toLowerCase(),n=u(t,D).filter(i=>C(t,"customer_id",i.customer_id)&&C(t,"external_customer_id",i.external_customer_id)&&C(t,"name",i.name)&&C(t,"source","user")).filter(i=>!e||K(e.filter,i)).filter(i=>(r===void 0||Date.parse(String(i.timestamp))>r)&&(a===void 0||Date.parse(String(i.timestamp))<a)).filter(i=>s===""||String(i.name).toLowerCase().includes(s)).sort(T("timestamp"));return t.list(D,n.map(i=>le(t,i)))}function qe(t,e){let r=String(e.body.id??""),a=d(t,e.storedType,r)??e.body;return e.storedType===k?$(t,a):N(t,a)}function he(t){return{$environment:p(t)}}var rt={initial:"open",transitions:[{operation:"checkouts:client_confirm",actor:"external",from:["open"],to:"confirmed",source:'spec:checkouts:client_confirm "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments."'},{operation:"checkouts:client_confirm",actor:"external",from:["confirmed","succeeded","failed","expired"],refusal:{status:403,code:"CheckoutForbiddenError",message:"The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments."},source:'spec:checkouts:client_confirm "The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments."'},{actor:"vendor",from:["confirmed"],to:"succeeded",source:'spec:checkouts:client_confirm "Orders and subscriptions will be processed."'},{actor:"time",from:["open"],to:"expired",source:'spec:checkouts:client_confirm "The checkout session is expired."'}]},at={initial:"incomplete",transitions:[{operation:"checkouts:client_confirm",actor:"external",from:["active","trialing"],refusal:{status:403,code:"CheckoutForbiddenError",message:"The customer already has an active subscription."},source:'spec:checkouts:client_confirm "the customer already has an active subscription"'},{actor:"vendor",from:["incomplete"],to:"active",source:'spec:/components/schemas/SubscriptionStatus "active"'},{actor:"vendor",from:["incomplete"],to:"trialing",source:'spec:/components/schemas/SubscriptionStatus "trialing"'},{actor:"time",from:["trialing"],to:"active",source:'https://polar.sh/docs/features/subscriptions/trials "Once the trial period ends, the customer will be automatically charged for the subscription, and their billing cycle will begin."'},{operation:"subscriptions:update",actor:"api",from:["active","trialing"],source:'spec:/components/schemas/SubscriptionCancel/properties/cancel_at_period_end "Cancel an active subscription once the current period ends."'},{operation:"subscriptions:update",actor:"api",from:["incomplete","incomplete_expired","past_due","canceled","unpaid","paused"],refusal:{status:403,code:"NotActiveSubscription",message:"Subscription is already canceled or will be at the end of the period, or is not active."},source:'spec:subscriptions:update "Subscription is already canceled or will be at the end of the period, or is not active."'},{actor:"time",from:["active","trialing"],to:"canceled",source:'spec:/components/schemas/SubscriptionCancel/properties/cancel_at_period_end "Cancel an active subscription once the current period ends."'}]},st={initial:"pending",transitions:[{actor:"vendor",from:["pending"],to:"paid",source:'spec:/components/schemas/OrderStatus "paid"'},{operation:"refunds:create",actor:"api",from:["paid","partially_refunded"],to:"partially_refunded",source:'spec:/components/schemas/OrderStatus "partially_refunded"'},{operation:"refunds:create",actor:"api",from:["paid","partially_refunded"],to:"refunded",source:'spec:/components/schemas/OrderStatus "refunded"'},{operation:"refunds:create",actor:"api",from:["refunded"],refusal:{status:403,code:"RefundedAlready",message:"Order is already fully refunded."},source:'spec:refunds:create "Order is already fully refunded."'}]},U={Product:{notState:["visibility","trial_interval","recurring_interval","meter_interval","is_recurring","is_archived"]},Checkout:{state:{status:rt},notState:["is_business_customer","is_discount_applicable","is_free_product_price","is_payment_form_required","is_payment_required","is_payment_setup_required"]},Subscription:{state:{status:at},notState:["recurring_interval","cancel_at_period_end"]},Order:{state:{status:st},notState:["billing_reason","is_invoice_generated","paid"]},Meter:{notState:["unit"]},WebhookEndpoint:{notState:["format"]}};var ee={vendor:"polar",service:"polar",tenant:{field:"organization_id"},body:{json:"always",validation:{operations:["meters:create"],status:422,missing:{detail:[{type:"missing",loc:["body","{name}"],msg:"Field required",input:"{input}"}]},type:{detail:[{type:"{type}_type",loc:["body","{name}"],msg:"Input should be a valid {type}",input:"{input}"}]},range:{detail:[{type:"value_error",loc:["body","{name}"],msg:"Input is outside the permitted range",input:"{input}"}]}}},ids:{template:"{uuid}"},time:"iso",error:{error:"{code}",detail:"{message}"},readOnly:{status:403,code:"NotPermitted",message:"This twin was started read-only; writes are refused."},malformedBody:{status:422,code:"RequestValidationError",message:"JSON decode error"},notFound:{status:404,code:"ResourceNotFound",message:"Not found"},variants:{"meters:create":["filter.clauses[].operator=ne","filter.clauses[].operator=gt","filter.clauses[].operator=gte","filter.clauses[].operator=lt","filter.clauses[].operator=lte","filter.clauses[].operator=like","filter.clauses[].operator=not_like","filter.clauses[].clauses[].operator=ne","filter.clauses[].clauses[].operator=gt","filter.clauses[].clauses[].operator=gte","filter.clauses[].clauses[].operator=lt","filter.clauses[].clauses[].operator=lte","filter.clauses[].clauses[].operator=like","filter.clauses[].clauses[].operator=not_like"]},list:{style:"envelope",envelope:{items:"{data}",pagination:{total_count:"{total_count}",max_page:"{max_page}"}},limit:{param:"limit",default:10,max:100},page:{param:"page",link:!1}},deleted:{},auth:{header:"authorization",scheme:"Bearer",gateWhenAbsent:!1,invalidKeys:[],missing:{status:401,code:"Unauthorized",message:"Unauthorized"},invalid:{status:401,code:"Unauthorized",message:"Unauthorized"}},events:{scheme:{kind:"webhook-id",prefix:"webhook",secretKey:"utf8"},types:{"checkout.create":"checkout.created","order.create":"order.created","order.pay":"order.paid","order.refund":"order.refunded"},envelope:{type:"$type",timestamp:"$time.iso",data:"$data"},endpoints:{storedAs:"webhook_endpoint",url:"url",secret:"secret",filter:"events",enabled:"enabled",match:{_environment:"$environment",format:"raw"}},record:"_webhook_delivery",render:qe,values:he},unmodeled:["checkouts:update","meters:get","meters:update","orders:create","orders:update","products:update","products:update_benefits","subscriptions:create","subscriptions:revoke","webhooks:get_webhook_endpoint","webhooks:update_webhook_endpoint","webhooks:delete_webhook_endpoint"],ingest:{scheme:{kind:"webhook-id",prefix:"webhook",secretKey:"utf8"},type:{body:"type"},object:"data",types:{"customer.created":{resource:"customer"},"customer.updated":{resource:"customer"},"customer.deleted":{resource:"customer",deleted:!0},"product.created":{resource:"Product"},"product.updated":{resource:"Product"},"checkout.created":{resource:"Checkout"},"checkout.updated":{resource:"Checkout"},"order.created":{resource:"Order"},"order.paid":{resource:"Order"},"order.updated":{resource:"Order"},"order.refunded":{resource:"Order"},"subscription.created":{resource:"Subscription"},"subscription.active":{resource:"Subscription"},"subscription.updated":{resource:"Subscription"},"subscription.canceled":{resource:"Subscription"},"subscription.uncanceled":{resource:"Subscription"},"subscription.revoked":{resource:"Subscription"}}},rateBudget:{allowance:{perMinute:100,source:"https://polar.sh/docs/api-reference/introduction"},windowMs:6e4,ceiling:90,defaultWeight:1,maxRetryAfterSeconds:300,rules:[],reason:"Polar documents 500 requests a minute per organization, customer or OAuth2 client in production and 100 in the sandbox, answering 429 with Retry-After over it (polar.sh/docs/api-reference/introduction, Rate Limits); 90 a minute stays under the sandbox's limit."},discovery:{twinOf:"Polar (api.polar.sh) as Volter's billing and Open Autonomy's patronage call it: meters and products, checkouts paid on the hosted checkout page and read back, the orders they make, customers and their state by the application's own id, customer sessions for the portal, usage events, and the signed webhooks of an organization's endpoints",stores:"the organization's meters and products, customers, checkouts and the subscriptions and orders they make, usage events, customer sessions, webhook endpoints, and the webhooks it sent"},doors:[{id:"accessTokens",method:"POST",path:"/_twin/access-tokens",note:"{ comment, expires_in_days? }: an Organization Access Token made on the settings page (shown once)"},{id:"revokeToken",method:"DELETE",path:"/_twin/access-tokens/{n}",note:"a token revoked on the settings page"},{id:"appCredentials",method:"POST",path:"/_twin/app-credentials",note:"the access token an application holds, as the runtime issues it"},{id:"deliveries",method:"GET",path:"/_twin/deliveries",note:"?to=<url>&type=<event>: every webhook Polar sent, in order, as the receiving server got it"}],screens:[{id:"checkout",kind:"flow",host:"buy.polar.sh",path:"/{client_secret}",demand:"every checkout an application sends a customer to (Twin's biller, Open Autonomy's patronage)",status:"done",controls:["email","pay"],source:"https://polar.sh/docs/features/checkout/session"},{id:"portal",kind:"flow",host:"polar.sh",path:"/{slug}/portal",demand:"a customer session's customer_portal_url (Twin's biller, Manage billing)",status:"done",controls:[],source:"https://polar.sh/docs/features/customer-portal"}],resources:{_access_token:{idPrefix:"oat_",ids:"{prefix}{n}"},_customer_meter:{idPrefix:"",ids:"{uuid}"},_order_item:{idPrefix:"",ids:"{uuid}"},_refund:{idPrefix:"",ids:"{uuid}"},_event_key:{idPrefix:"event_key_"},_price:{idPrefix:"",ids:"{uuid}"},_seq_order:{idPrefix:"",ids:"{n}"},customer:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},idPrefix:"",refresh:{list:"customers:list",items:"items"}},Product:{storedAs:"product",...U.Product,orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},idPrefix:"",refresh:{list:"products:list"}},event:{orderBy:{param:"sorting",default:"-timestamp",fields:["timestamp"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},idPrefix:"",refresh:{list:"events:list",items:"items"}},customer_session:{idPrefix:"",refresh:{none:"a customer session is a token answered once, by its create; the API lists none and reads none back"}},Meter:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at","name"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"meter",idPrefix:"",...U.Meter,filters:["name"],order:{field:"created_at",direction:"desc"},refresh:{list:"meters:list"},assigned:{unit:{value:"scalar"},created_at:{now:!0},modified_at:{value:null},archived_at:{value:null},metadata:{value:{}}}},WebhookEndpoint:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"webhook_endpoint",idPrefix:"",...U.WebhookEndpoint,order:{field:"created_at",direction:"desc"},refresh:{list:"webhooks:list_webhook_endpoints"}},Checkout:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"checkout",idPrefix:"",...U.Checkout,refresh:{list:"checkouts:list"}},Subscription:{orderBy:{param:"sorting",default:"-started_at",fields:["started_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"subscription",idPrefix:"",...U.Subscription,refresh:{list:"subscriptions:list"}},Order:{orderBy:{param:"sorting",default:"-created_at",fields:["created_at"],invalid:{status:422,code:"RequestValidationError",message:"Invalid sorting criterion"}},storedAs:"order",idPrefix:"",...U.Order,refresh:{list:"orders:list"}}},descriptor:{protocol:"3",transport:"rest",archetype:"crud",bin:"world-polar",resources:["customer","product","checkout","subscription","order","event","meter","customer_session","webhook_endpoint"],specSource:"Polar's OpenAPI document, 2026-04 (spec/openapi.json.gz, provenance in spec/SOURCE.md)",description:"Polar twin \u2014 meters and products with their prices, checkouts with the hosted checkout page, the orders and subscriptions a paid checkout makes, customers and their state (subscriptions and meters) by the application's own id, customer sessions, usage events, webhook endpoints, and webhooks signed as Polar's SDK verifies them.",adoption:{sdks:["@polar-sh/sdk"],pypi:["polar-sdk"],scopes:["@polar-sh/"],envStems:["POLAR"]},credentialDoor:{path:"/_twin/app-credentials",body:{},fill:{POLAR_ACCESS_TOKEN:"access_token",POLAR_API_KEY:"access_token",POLAR_ORGANIZATION_TOKEN:"access_token"}},hosts:[{host:"api.polar.sh"},{host:"sandbox-api.polar.sh"},{host:"buy.polar.sh"},{host:"polar.sh",pathPattern:"^/[^/]+/portal"},{host:"sandbox.polar.sh"}],endpointEnvNone:"@polar-sh/sdk reads no base-URL variable: its `server` option picks production or sandbox, both claimed by the host rules."}};var te={generatedBy:"scripts/derive-pack.ts",spec:"openapi.json.gz",format:"openapi",version:"2026-04",resources:[{name:"Checkout",schema:"Checkout",fields:[{name:"active_trial_interval",type:"union",nullable:!1,required:!0},{name:"active_trial_interval_count",type:"union",nullable:!1,required:!0},{name:"allow_discount_codes",type:"boolean",nullable:!1,required:!0},{name:"allow_trial",type:"union",nullable:!1,required:!0},{name:"amount",type:"integer",nullable:!1,required:!0},{name:"attached_custom_fields",type:"union",nullable:!1,required:!0},{name:"billing_address_fields",type:"CheckoutBillingAddressFields",nullable:!1,required:!0},{name:"client_secret",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer_billing_address",type:"union",nullable:!1,required:!0},{name:"customer_billing_name",type:"union",nullable:!1,required:!0},{name:"customer_email",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"union",nullable:!1,required:!0},{name:"customer_ip_address",type:"union",nullable:!1,required:!0},{name:"customer_metadata",type:"object",nullable:!1,required:!0},{name:"customer_name",type:"union",nullable:!1,required:!0},{name:"customer_tax_id",type:"union",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"embed_origin",type:"union",nullable:!1,required:!0},{name:"expires_at",type:"string",nullable:!1,required:!0},{name:"external_customer_id",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"is_business_customer",type:"boolean",nullable:!1,required:!0},{name:"is_discount_applicable",type:"boolean",nullable:!1,required:!0},{name:"is_free_product_price",type:"boolean",nullable:!1,required:!0},{name:"is_payment_form_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_setup_required",type:"boolean",nullable:!1,required:!0},{name:"locale",type:"union",nullable:!1},{name:"max_seats",type:"union",nullable:!1},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"min_seats",type:"union",nullable:!1},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"payment_method_type",type:"union",nullable:!1,required:!0},{name:"payment_processor",type:"PaymentProcessor",nullable:!1,required:!0,enum:["stripe"]},{name:"payment_processor_metadata",type:"object",nullable:!1,required:!0},{name:"prices",type:"union",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"product_price",type:"union",nullable:!1,required:!0},{name:"product_price_id",type:"union",nullable:!1,required:!0},{name:"products",type:"array",nullable:!1,required:!0},{name:"require_billing_address",type:"boolean",nullable:!1,required:!0},{name:"return_url",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"CheckoutStatus",nullable:!1,required:!0,enum:["open","expired","confirmed","succeeded","failed"]},{name:"subscription_id",type:"union",nullable:!1,required:!0},{name:"success_url",type:"string",nullable:!1,required:!0},{name:"tax_amount",type:"union",nullable:!1,required:!0},{name:"tax_behavior",type:"union",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"trial_interval",type:"union",nullable:!1,required:!0},{name:"trial_interval_count",type:"union",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[{field:"is_business_customer",values:["false","true"]},{field:"is_discount_applicable",values:["false","true"]},{field:"is_free_product_price",values:["false","true"]},{field:"is_payment_form_required",values:["false","true"]},{field:"is_payment_required",values:["false","true"]},{field:"is_payment_setup_required",values:["false","true"]},{field:"status",values:["confirmed","expired","failed","open","succeeded"]}],expandable:[]},{name:"CheckoutLink",schema:"CheckoutLink",fields:[{name:"allow_discount_codes",type:"boolean",nullable:!1,required:!0},{name:"client_secret",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"label",type:"union",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"payment_processor",type:"PaymentProcessor",nullable:!1,required:!0,enum:["stripe"]},{name:"products",type:"array",nullable:!1,required:!0},{name:"require_billing_address",type:"boolean",nullable:!1,required:!0},{name:"return_url",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1,required:!0},{name:"success_url",type:"union",nullable:!1,required:!0},{name:"trial_interval",type:"union",nullable:!1,required:!0},{name:"trial_interval_count",type:"union",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"CheckoutPublic",schema:"CheckoutPublic",fields:[{name:"active_trial_interval",type:"union",nullable:!1,required:!0},{name:"active_trial_interval_count",type:"union",nullable:!1,required:!0},{name:"allow_discount_codes",type:"boolean",nullable:!1,required:!0},{name:"allow_trial",type:"union",nullable:!1,required:!0},{name:"amount",type:"integer",nullable:!1,required:!0},{name:"attached_custom_fields",type:"union",nullable:!1,required:!0},{name:"billing_address_fields",type:"CheckoutBillingAddressFields",nullable:!1,required:!0},{name:"client_secret",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer_billing_address",type:"union",nullable:!1,required:!0},{name:"customer_billing_name",type:"union",nullable:!1,required:!0},{name:"customer_email",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"union",nullable:!1,required:!0},{name:"customer_ip_address",type:"union",nullable:!1,required:!0},{name:"customer_name",type:"union",nullable:!1,required:!0},{name:"customer_tax_id",type:"union",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"embed_origin",type:"union",nullable:!1,required:!0},{name:"expires_at",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"is_business_customer",type:"boolean",nullable:!1,required:!0},{name:"is_discount_applicable",type:"boolean",nullable:!1,required:!0},{name:"is_free_product_price",type:"boolean",nullable:!1,required:!0},{name:"is_payment_form_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_required",type:"boolean",nullable:!1,required:!0},{name:"is_payment_setup_required",type:"boolean",nullable:!1,required:!0},{name:"locale",type:"union",nullable:!1},{name:"max_seats",type:"union",nullable:!1},{name:"min_seats",type:"union",nullable:!1},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"organization",type:"CheckoutOrganization",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"payment_method_type",type:"union",nullable:!1,required:!0},{name:"payment_processor",type:"PaymentProcessor",nullable:!1,required:!0,enum:["stripe"]},{name:"payment_processor_metadata",type:"object",nullable:!1,required:!0},{name:"prices",type:"union",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"product_price",type:"union",nullable:!1,required:!0},{name:"product_price_id",type:"union",nullable:!1,required:!0},{name:"products",type:"array",nullable:!1,required:!0},{name:"require_billing_address",type:"boolean",nullable:!1,required:!0},{name:"return_url",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"CheckoutStatus",nullable:!1,required:!0,enum:["open","expired","confirmed","succeeded","failed"]},{name:"success_url",type:"string",nullable:!1,required:!0},{name:"tax_amount",type:"union",nullable:!1,required:!0},{name:"tax_behavior",type:"union",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[{field:"is_business_customer",values:["false","true"]},{field:"is_discount_applicable",values:["false","true"]},{field:"is_free_product_price",values:["false","true"]},{field:"is_payment_form_required",values:["false","true"]},{field:"is_payment_required",values:["false","true"]},{field:"is_payment_setup_required",values:["false","true"]},{field:"status",values:["confirmed","expired","failed","open","succeeded"]}],expandable:[]},{name:"CustomerCustomerMeter",schema:"CustomerCustomerMeter",fields:[{name:"balance",type:"number",nullable:!1,required:!0},{name:"consumed_units",type:"number",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"credited_units",type:"integer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"meter",type:"CustomerCustomerMeterMeter",nullable:!1,required:!0},{name:"meter_id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"CustomerMeter",schema:"CustomerMeter",fields:[{name:"balance",type:"number",nullable:!1,required:!0},{name:"consumed_units",type:"number",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"credited_units",type:"integer",nullable:!1,required:!0},{name:"customer",type:"Customer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"meter",type:"Meter",nullable:!1,required:!0},{name:"meter_id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"CustomerOrder",schema:"CustomerOrder",fields:[{name:"applied_balance_amount",type:"integer",nullable:!1,required:!0},{name:"billing_address",type:"union",nullable:!1,required:!0},{name:"billing_name",type:"union",nullable:!1,required:!0},{name:"billing_reason",type:"OrderBillingReason",nullable:!1,required:!0,enum:["purchase","subscription_create","subscription_cycle","subscription_update","subscription_meter_cycle"]},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"description",type:"string",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"due_amount",type:"integer",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"invoice_number",type:"union",nullable:!1,required:!0},{name:"is_invoice_generated",type:"boolean",nullable:!1,required:!0},{name:"items",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"next_payment_attempt_at",type:"union",nullable:!1},{name:"paid",type:"boolean",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"receipt_number",type:"union",nullable:!1,required:!0},{name:"refundable_amount",type:"integer",nullable:!1,required:!0},{name:"refundable_tax_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_tax_amount",type:"integer",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"OrderStatus",nullable:!1,required:!0,enum:["draft","pending","paid","refunded","partially_refunded","void"]},{name:"subscription",type:"union",nullable:!1,required:!0},{name:"subscription_id",type:"union",nullable:!1,required:!0},{name:"subtotal_amount",type:"integer",nullable:!1,required:!0},{name:"tax_amount",type:"integer",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"billing_reason",values:["purchase","subscription_create","subscription_cycle","subscription_meter_cycle","subscription_update"]},{field:"is_invoice_generated",values:["false","true"]},{field:"paid",values:["false","true"]},{field:"status",values:["draft","paid","partially_refunded","pending","refunded","void"]}],expandable:[]},{name:"CustomerPortalCustomer",schema:"CustomerPortalCustomer",fields:[{name:"billing_address",type:"union",nullable:!1,required:!0},{name:"billing_name",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"default_payment_method_id",type:"union",nullable:!1},{name:"email",type:"union",nullable:!1,required:!0},{name:"email_verified",type:"boolean",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"locale",type:"union",nullable:!1},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"union",nullable:!1,required:!0},{name:"oauth_accounts",type:"object",nullable:!1,required:!0},{name:"tax_id",type:"union",nullable:!1,required:!0},{name:"type",type:"union",nullable:!1}],stateCandidates:[],expandable:[]},{name:"CustomerSeat",schema:"CustomerSeat",fields:[{name:"claimed_at",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer_email",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"union",nullable:!1,required:!0},{name:"email",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"invitation_token_expires_at",type:"union",nullable:!1,required:!0},{name:"member",type:"union",nullable:!1,required:!0},{name:"member_id",type:"union",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"order_id",type:"union",nullable:!1,required:!0},{name:"revoked_at",type:"union",nullable:!1,required:!0},{name:"seat_metadata",type:"union",nullable:!1,required:!0},{name:"status",type:"SeatStatus",nullable:!1,required:!0,enum:["pending","claimed","revoked"]},{name:"subscription_id",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"status",values:["claimed","pending","revoked"]}],expandable:[]},{name:"CustomerSubscription",schema:"CustomerSubscription",fields:[{name:"amount",type:"integer",nullable:!1,required:!0},{name:"cancel_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"canceled_at",type:"union",nullable:!1,required:!0},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"current_meter_period_end",type:"union",nullable:!1,required:!0},{name:"current_meter_period_start",type:"union",nullable:!1,required:!0},{name:"current_period_end",type:"string",nullable:!1,required:!0},{name:"current_period_start",type:"string",nullable:!1,required:!0},{name:"customer_cancellation_comment",type:"union",nullable:!1,required:!0},{name:"customer_cancellation_reason",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"ended_at",type:"union",nullable:!1,required:!0},{name:"ends_at",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"meters",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"past_due_at",type:"union",nullable:!1},{name:"pause_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"paused_at",type:"union",nullable:!1,required:!0},{name:"pending_update",type:"union",nullable:!1,required:!0},{name:"prices",type:"array",nullable:!1,required:!0},{name:"product",type:"CustomerSubscriptionProduct",nullable:!1,required:!0},{name:"product_id",type:"string",nullable:!1,required:!0},{name:"recurring_interval",type:"RecurringInterval",nullable:!1,required:!0,enum:["day","week","month","year"]},{name:"recurring_interval_count",type:"integer",nullable:!1,required:!0},{name:"resumes_at",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"started_at",type:"union",nullable:!1,required:!0},{name:"status",type:"SubscriptionStatus",nullable:!1,required:!0,enum:["incomplete","incomplete_expired","trialing","active","past_due","canceled","unpaid","paused"]},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"trial_start",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"recurring_interval",values:["day","month","week","year"]},{field:"status",values:["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]}],expandable:[]},{name:"CustomerWallet",schema:"CustomerWallet",fields:[{name:"balance",type:"integer",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"Dispute",schema:"Dispute",fields:[{name:"amount",type:"integer",nullable:!1,required:!0},{name:"case_id",type:"union",nullable:!1,required:!0},{name:"closed",type:"boolean",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"customer",type:"DisputeCustomer",nullable:!1,required:!0},{name:"evidence_due_by",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"order_id",type:"string",nullable:!1,required:!0},{name:"past_due",type:"boolean",nullable:!1,required:!0},{name:"payment_id",type:"string",nullable:!1,required:!0},{name:"reason",type:"union",nullable:!1,required:!0},{name:"resolved",type:"boolean",nullable:!1,required:!0},{name:"status",type:"DisputeStatus",nullable:!1,required:!0,enum:["prevented","early_warning","needs_response","under_review","lost","won"]},{name:"tax_amount",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"closed",values:["false","true"]},{field:"status",values:["early_warning","lost","needs_response","prevented","under_review","won"]}],expandable:[]},{name:"LicenseKeyActivationRead",schema:"LicenseKeyActivationRead",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"label",type:"string",nullable:!1,required:!0},{name:"license_key",type:"LicenseKeyRead",nullable:!1,required:!0},{name:"license_key_id",type:"string",nullable:!1,required:!0},{name:"meta",type:"object",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"LicenseKeyWithActivations",schema:"LicenseKeyWithActivations",fields:[{name:"activations",type:"array",nullable:!1,required:!0},{name:"benefit_id",type:"string",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer",type:"LicenseKeyCustomer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"display_key",type:"string",nullable:!1,required:!0},{name:"expires_at",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"key",type:"string",nullable:!1,required:!0},{name:"last_validated_at",type:"union",nullable:!1,required:!0},{name:"limit_activations",type:"union",nullable:!1,required:!0},{name:"limit_usage",type:"union",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"status",type:"LicenseKeyStatus",nullable:!1,required:!0,enum:["granted","revoked","disabled"]},{name:"usage",type:"integer",nullable:!1,required:!0},{name:"validations",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"status",values:["disabled","granted","revoked"]}],expandable:[]},{name:"Member",schema:"Member",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"email",type:"string",nullable:!1,required:!0},{name:"external_id",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"union",nullable:!1,required:!0},{name:"role",type:"MemberRole",nullable:!1,required:!0,enum:["owner","billing_manager","member"]}],stateCandidates:[{field:"role",values:["billing_manager","member","owner"]}],expandable:[]},{name:"Meter",schema:"Meter",fields:[{name:"aggregation",type:"union",nullable:!1,required:!0},{name:"archived_at",type:"union",nullable:!1},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"custom_label",type:"union",nullable:!1},{name:"custom_multiplier",type:"union",nullable:!1},{name:"filter",type:"Filter",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"unit",type:"MeterUnit",nullable:!1,required:!0,enum:["scalar","token","custom"]}],stateCandidates:[{field:"unit",values:["custom","scalar","token"]}],expandable:[]},{name:"MeterQuantity",schema:"MeterQuantity",fields:[{name:"quantity",type:"number",nullable:!1,required:!0},{name:"timestamp",type:"string",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"MetricDashboardSchema",schema:"MetricDashboardSchema",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"metrics",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"MetricsIntervalsLimits",schema:"MetricsIntervalsLimits",fields:[{name:"day",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"hour",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"month",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"week",type:"MetricsIntervalLimit",nullable:!1,required:!0},{name:"year",type:"MetricsIntervalLimit",nullable:!1,required:!0}],stateCandidates:[],expandable:[]},{name:"Order",schema:"Order",fields:[{name:"applied_balance_amount",type:"integer",nullable:!1,required:!0},{name:"billing_address",type:"union",nullable:!1,required:!0},{name:"billing_name",type:"union",nullable:!1,required:!0},{name:"billing_reason",type:"OrderBillingReason",nullable:!1,required:!0,enum:["purchase","subscription_create","subscription_cycle","subscription_update","subscription_meter_cycle"]},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer",type:"OrderCustomer",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"description",type:"string",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_amount",type:"integer",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"due_amount",type:"integer",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"invoice_number",type:"union",nullable:!1,required:!0},{name:"is_invoice_generated",type:"boolean",nullable:!1,required:!0},{name:"items",type:"array",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"net_amount",type:"integer",nullable:!1,required:!0},{name:"next_payment_attempt_at",type:"union",nullable:!1},{name:"paid",type:"boolean",nullable:!1,required:!0},{name:"platform_fee_amount",type:"integer",nullable:!1,required:!0},{name:"platform_fee_currency",type:"union",nullable:!1,required:!0},{name:"product",type:"union",nullable:!1,required:!0},{name:"product_id",type:"union",nullable:!1,required:!0},{name:"receipt_number",type:"union",nullable:!1,required:!0},{name:"refundable_amount",type:"integer",nullable:!1,required:!0},{name:"refundable_tax_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_amount",type:"integer",nullable:!1,required:!0},{name:"refunded_tax_amount",type:"integer",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"status",type:"OrderStatus",nullable:!1,required:!0,enum:["draft","pending","paid","refunded","partially_refunded","void"]},{name:"subscription",type:"union",nullable:!1,required:!0},{name:"subscription_id",type:"union",nullable:!1,required:!0},{name:"subtotal_amount",type:"integer",nullable:!1,required:!0},{name:"tax_amount",type:"integer",nullable:!1,required:!0},{name:"total_amount",type:"integer",nullable:!1,required:!0}],stateCandidates:[{field:"billing_reason",values:["purchase","subscription_create","subscription_cycle","subscription_meter_cycle","subscription_update"]},{field:"is_invoice_generated",values:["false","true"]},{field:"paid",values:["false","true"]},{field:"status",values:["draft","paid","partially_refunded","pending","refunded","void"]}],expandable:[]},{name:"Organization",schema:"Organization",fields:[{name:"account_id",type:"union",nullable:!1,required:!0},{name:"allow_customer_updates",type:"boolean",nullable:!1,required:!0},{name:"avatar_url",type:"union",nullable:!1,required:!0},{name:"capabilities",type:"OrganizationCapabilities",nullable:!1,required:!0},{name:"country",type:"union",nullable:!1},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"customer_email_settings",type:"OrganizationCustomerEmailSettings",nullable:!1,required:!0},{name:"customer_portal_settings",type:"OrganizationCustomerPortalSettings",nullable:!1,required:!0},{name:"default_presentment_currency",type:"string",nullable:!1,required:!0},{name:"default_tax_behavior",type:"TaxBehaviorOption",nullable:!1,required:!0,enum:["location","inclusive","exclusive"]},{name:"details_submitted_at",type:"union",nullable:!1,required:!0},{name:"dispute_settings",type:"OrganizationDisputeSettings",nullable:!1,required:!0},{name:"email",type:"union",nullable:!1,required:!0},{name:"embed_hosts",type:"array",nullable:!1,required:!0},{name:"embed_hosts_enforced",type:"boolean",nullable:!1,required:!0},{name:"feature_settings",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"onboarding_resubmission_requested_at",type:"union",nullable:!1,required:!0},{name:"payout_account_id",type:"union",nullable:!1,required:!0},{name:"proration_behavior",type:"SubscriptionProrationBehavior",nullable:!1,required:!0,enum:["invoice","prorate","next_period","reset"]},{name:"slug",type:"string",nullable:!1,required:!0},{name:"socials",type:"array",nullable:!1,required:!0},{name:"sso_enforced",type:"boolean",nullable:!1,required:!0},{name:"status",type:"OrganizationStatus",nullable:!1,required:!0,enum:["created","review","snoozed","denied","active","blocked","offboarding","offboarded"]},{name:"subscription_settings",type:"OrganizationSubscriptionSettings",nullable:!1,required:!0},{name:"website",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"default_tax_behavior",values:["exclusive","inclusive","location"]},{field:"proration_behavior",values:["invoice","next_period","prorate","reset"]},{field:"status",values:["active","blocked","created","denied","offboarded","offboarding","review","snoozed"]}],expandable:[]},{name:"Product",schema:"Product",fields:[{name:"attached_custom_fields",type:"array",nullable:!1,required:!0},{name:"benefits",type:"array",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"description",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"is_archived",type:"boolean",nullable:!1,required:!0},{name:"is_recurring",type:"boolean",nullable:!1,required:!0},{name:"medias",type:"array",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"meter_interval",type:"union",nullable:!1,required:!0},{name:"meter_interval_count",type:"union",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"string",nullable:!1,required:!0},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"prices",type:"array",nullable:!1,required:!0},{name:"recurring_interval",type:"union",nullable:!1,required:!0},{name:"recurring_interval_count",type:"union",nullable:!1,required:!0},{name:"trial_interval",type:"union",nullable:!1,required:!0},{name:"trial_interval_count",type:"union",nullable:!1,required:!0},{name:"visibility",type:"ProductVisibility",nullable:!1,required:!0,enum:["draft","private","public"]}],stateCandidates:[{field:"is_archived",values:["false","true"]},{field:"is_recurring",values:["false","true"]},{field:"visibility",values:["draft","private","public"]}],expandable:[]},{name:"Subscription",schema:"Subscription",fields:[{name:"amount",type:"integer",nullable:!1,required:!0},{name:"cancel_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"canceled_at",type:"union",nullable:!1,required:!0},{name:"checkout_id",type:"union",nullable:!1,required:!0},{name:"created_at",type:"string",nullable:!1,required:!0},{name:"currency",type:"string",nullable:!1,required:!0},{name:"current_meter_period_end",type:"union",nullable:!1,required:!0},{name:"current_meter_period_start",type:"union",nullable:!1,required:!0},{name:"current_period_end",type:"string",nullable:!1,required:!0},{name:"current_period_start",type:"string",nullable:!1,required:!0},{name:"custom_field_data",type:"object",nullable:!1},{name:"customer",type:"SubscriptionCustomer",nullable:!1,required:!0},{name:"customer_cancellation_comment",type:"union",nullable:!1,required:!0},{name:"customer_cancellation_reason",type:"union",nullable:!1,required:!0},{name:"customer_id",type:"string",nullable:!1,required:!0},{name:"discount",type:"union",nullable:!1,required:!0},{name:"discount_id",type:"union",nullable:!1,required:!0},{name:"ended_at",type:"union",nullable:!1,required:!0},{name:"ends_at",type:"union",nullable:!1,required:!0},{name:"id",type:"string",nullable:!1,required:!0},{name:"metadata",type:"MetadataOutputType",nullable:!1,required:!0},{name:"meters",type:"array",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"past_due_at",type:"union",nullable:!1},{name:"pause_at_period_end",type:"boolean",nullable:!1,required:!0},{name:"paused_at",type:"union",nullable:!1,required:!0},{name:"pending_update",type:"union",nullable:!1,required:!0},{name:"prices",type:"array",nullable:!1,required:!0},{name:"product",type:"Product",nullable:!1,required:!0},{name:"product_id",type:"string",nullable:!1,required:!0},{name:"recurring_interval",type:"RecurringInterval",nullable:!1,required:!0,enum:["day","week","month","year"]},{name:"recurring_interval_count",type:"integer",nullable:!1,required:!0},{name:"resumes_at",type:"union",nullable:!1,required:!0},{name:"seats",type:"union",nullable:!1},{name:"started_at",type:"union",nullable:!1,required:!0},{name:"status",type:"SubscriptionStatus",nullable:!1,required:!0,enum:["incomplete","incomplete_expired","trialing","active","past_due","canceled","unpaid","paused"]},{name:"trial_end",type:"union",nullable:!1,required:!0},{name:"trial_start",type:"union",nullable:!1,required:!0}],stateCandidates:[{field:"recurring_interval",values:["day","month","week","year"]},{field:"status",values:["active","canceled","incomplete","incomplete_expired","past_due","paused","trialing","unpaid"]}],expandable:[]},{name:"WebhookEndpoint",schema:"WebhookEndpoint",fields:[{name:"created_at",type:"string",nullable:!1,required:!0},{name:"enabled",type:"boolean",nullable:!1,required:!0},{name:"events",type:"array",nullable:!1,required:!0},{name:"format",type:"WebhookFormat",nullable:!1,required:!0,enum:["raw","discord","slack"]},{name:"id",type:"string",nullable:!1,required:!0},{name:"modified_at",type:"union",nullable:!1,required:!0},{name:"name",type:"union",nullable:!1},{name:"organization_id",type:"string",nullable:!1,required:!0},{name:"secret",type:"string",nullable:!1,required:!0},{name:"url",type:"string",nullable:!1,required:!0}],stateCandidates:[{field:"format",values:["discord","raw","slack"]}],expandable:[]}],operations:[{id:"benefit-grants:list",method:"get",path:"/v1/benefit-grants/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"is_granted",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_BenefitGrant_"},{id:"benefits:list",method:"get",path:"/v1/benefits/",pathParams:[],query:[{name:"exclude_id",type:"union",required:!1},{name:"id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"type",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Benefit_"},{id:"benefits:create",method:"post",path:"/v1/benefits/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["benefits:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"benefits:get",method:"get",path:"/v1/benefits/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"benefits:update",method:"patch",path:"/v1/benefits/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["benefits:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"benefits:delete",method:"delete",path:"/v1/benefits/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["benefits:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"benefits:files",method:"get",path:"/v1/benefits/{id}/files",pathParams:["id"],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_BenefitDownloadableFile_"},{id:"benefits:grants",method:"get",path:"/v1/benefits/{id}/grants",pathParams:["id"],query:[{name:"customer_id",type:"union",required:!1},{name:"is_granted",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"member_id",type:"union",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["benefits:read","benefits:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_BenefitGrant_"},{id:"checkout-links:list",method:"get",path:"/v1/checkout-links/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkout_links:read","checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!0,key:"items"},class:"list",resource:"CheckoutLink"},{id:"checkout-links:create",method:"post",path:"/v1/checkout-links/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!1},class:"create",resource:"CheckoutLink"},{id:"checkout-links:get",method:"get",path:"/v1/checkout-links/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkout_links:read","checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!1},class:"retrieve",resource:"CheckoutLink"},{id:"checkout-links:update",method:"patch",path:"/v1/checkout-links/{id}",pathParams:["id"],query:[],body:[{name:"allow_discount_codes",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"label",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"products",type:"union",required:!1},{name:"require_billing_address",type:"union",required:!1},{name:"return_url",type:"union",required:!1},{name:"seats",type:"union",required:!1},{name:"success_url",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["checkout_links:write"],credentials:["oat","oidc","pat"],answers:{resource:"CheckoutLink",list:!1},class:"update",resource:"CheckoutLink"},{id:"checkout-links:delete",method:"delete",path:"/v1/checkout-links/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["checkout_links:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"CheckoutLink"},{id:"checkouts:list",method:"get",path:"/v1/checkouts/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkouts:read","checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!0,key:"items"},class:"list",resource:"Checkout"},{id:"checkouts:create",method:"post",path:"/v1/checkouts/",pathParams:[],query:[],body:[{name:"allow_discount_codes",type:"boolean",required:!1},{name:"allow_trial",type:"boolean",required:!1},{name:"amount",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"customer_ip_address",type:"union",required:!1},{name:"customer_metadata",type:"object",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"embed_origin",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"is_business_customer",type:"boolean",required:!1},{name:"locale",type:"union",required:!1},{name:"max_seats",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"min_seats",type:"union",required:!1},{name:"prices",type:"union",required:!1},{name:"products",type:"array",required:!0},{name:"require_billing_address",type:"boolean",required:!1},{name:"return_url",type:"union",required:!1},{name:"seats",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1},{name:"success_url",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!1},class:"create",resource:"Checkout"},{id:"checkouts:get",method:"get",path:"/v1/checkouts/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["checkouts:read","checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!1},class:"retrieve",resource:"Checkout"},{id:"checkouts:update",method:"patch",path:"/v1/checkouts/{id}",pathParams:["id"],query:[],body:[{name:"allow_discount_codes",type:"union",required:!1},{name:"allow_trial",type:"union",required:!1},{name:"amount",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_ip_address",type:"union",required:!1},{name:"customer_metadata",type:"union",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"embed_origin",type:"union",required:!1},{name:"is_business_customer",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"product_id",type:"union",required:!1},{name:"product_price_id",type:"union",required:!1},{name:"require_billing_address",type:"union",required:!1},{name:"return_url",type:"union",required:!1},{name:"seats",type:"union",required:!1},{name:"success_url",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["checkouts:write"],credentials:["oat","oidc","pat"],answers:{resource:"Checkout",list:!1},class:"update",resource:"Checkout"},{id:"checkouts:client_get",method:"get",path:"/v1/checkouts/client/{client_secret}",pathParams:["client_secret"],query:[],body:[],bodyEncoding:"none",successStatus:200,answers:{resource:"CheckoutPublic",list:!1},class:"retrieve",resource:"CheckoutPublic"},{id:"checkouts:client_update",method:"patch",path:"/v1/checkouts/client/{client_secret}",pathParams:["client_secret"],query:[],body:[{name:"allow_trial",type:"union",required:!1},{name:"amount",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_code",type:"union",required:!1},{name:"is_business_customer",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"payment_method_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"product_price_id",type:"union",required:!1},{name:"seats",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,answers:{resource:"CheckoutPublic",list:!1},class:"update",resource:"CheckoutPublic"},{id:"checkouts:client_confirm",method:"post",path:"/v1/checkouts/client/{client_secret}/confirm",pathParams:["client_secret"],query:[],body:[{name:"allow_trial",type:"union",required:!1},{name:"amount",type:"union",required:!1},{name:"confirmation_token_id",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_billing_address",type:"union",required:!1},{name:"customer_billing_name",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_name",type:"union",required:!1},{name:"customer_tax_id",type:"union",required:!1},{name:"discount_code",type:"union",required:!1},{name:"is_business_customer",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"payment_method_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"product_price_id",type:"union",required:!1},{name:"seats",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,credentials:["oidc","pat"],class:"action",resource:"CheckoutPublic"},{id:"custom-fields:list",method:"get",path:"/v1/custom-fields/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"type",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["custom_fields:read","custom_fields:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_CustomField_"},{id:"custom-fields:create",method:"post",path:"/v1/custom-fields/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["custom_fields:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"custom-fields:get",method:"get",path:"/v1/custom-fields/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["custom_fields:read","custom_fields:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"custom-fields:update",method:"patch",path:"/v1/custom-fields/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["custom_fields:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"custom-fields:delete",method:"delete",path:"/v1/custom-fields/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["custom_fields:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"customer_meters:list",method:"get",path:"/v1/customer-meters/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"meter_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_meters:read"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerMeter",list:!0,key:"items"},class:"list",resource:"CustomerMeter"},{id:"customer_meters:get",method:"get",path:"/v1/customer-meters/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_meters:read"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerMeter",list:!1},class:"retrieve",resource:"CustomerMeter"},{id:"customer_portal:benefit-grants:list",method:"get",path:"/v1/customer-portal/benefit-grants/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"checkout_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"member_id",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1},{name:"type",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_CustomerBenefitGrant_"},{id:"customer_portal:benefit-grants:get",method:"get",path:"/v1/customer-portal/benefit-grants/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"computed"},{id:"customer_portal:benefit-grants:update",method:"patch",path:"/v1/customer-portal/benefit-grants/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"non-resource"},{id:"customer_portal:customer-session:introspect",method:"get",path:"/v1/customer-portal/customer-session/introspect",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerCustomerSession"},{id:"customer_portal:customer-session:get_authenticated_user",method:"get",path:"/v1/customer-portal/customer-session/user",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"PortalAuthenticatedUser"},{id:"customer_portal:customers:get",method:"get",path:"/v1/customer-portal/customers/me",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerPortalCustomer",list:!1},class:"retrieve",resource:"CustomerPortalCustomer"},{id:"customer_portal:customers:update",method:"patch",path:"/v1/customer-portal/customers/me",pathParams:[],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"billing_name",type:"union",required:!1},{name:"default_payment_method_id",type:"union",required:!1},{name:"tax_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerPortalCustomer",list:!1},class:"action",resource:"CustomerPortalCustomer"},{id:"customer_portal:customers:check_email_update",method:"get",path:"/v1/customer-portal/customers/me/email-update/check",pathParams:[],query:[{name:"token",type:"string",required:!0}],body:[],bodyEncoding:"none",successStatus:204,class:"computed"},{id:"customer_portal:customers:request_email_update",method:"post",path:"/v1/customer-portal/customers/me/email-update/request",pathParams:[],query:[],body:[{name:"email",type:"string",required:!0}],bodyEncoding:"json",successStatus:202,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"non-resource"},{id:"customer_portal:customers:verify_email_update",method:"post",path:"/v1/customer-portal/customers/me/email-update/verify",pathParams:[],query:[],body:[{name:"token",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,class:"non-resource"},{id:"customer_portal:customers:list_payment_methods",method:"get",path:"/v1/customer-portal/customers/me/payment-methods",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_CustomerPaymentMethod_"},{id:"customer_portal:customers:add_payment_method",method:"post",path:"/v1/customer-portal/customers/me/payment-methods",pathParams:[],query:[],body:[{name:"confirmation_token_id",type:"string",required:!0},{name:"return_url",type:"string",required:!0},{name:"set_default",type:"boolean",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"action",resource:"CustomerPortalCustomer"},{id:"customer_portal:customers:delete_payment_method",method:"delete",path:"/v1/customer-portal/customers/me/payment-methods/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"delete"},{id:"customer_portal:customers:confirm_payment_method",method:"post",path:"/v1/customer-portal/customers/me/payment-methods/confirm",pathParams:[],query:[],body:[{name:"set_default",type:"boolean",required:!0},{name:"setup_intent_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"non-resource"},{id:"customer_portal:downloadables:list",method:"get",path:"/v1/customer-portal/downloadables/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_DownloadableRead_"},{id:"customer_portal:license_keys:list",method:"get",path:"/v1/customer-portal/license-keys/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"ListResource_LicenseKeyRead_"},{id:"customer_portal:license_keys:get",method:"get",path:"/v1/customer-portal/license-keys/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"LicenseKeyWithActivations",list:!1},class:"retrieve",resource:"LicenseKeyWithActivations"},{id:"customer_portal:license_keys:activate",method:"post",path:"/v1/customer-portal/license-keys/activate",pathParams:[],query:[],body:[{name:"conditions",type:"object",required:!1},{name:"key",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"meta",type:"object",required:!1},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,answers:{resource:"LicenseKeyActivationRead",list:!1},class:"action",resource:"LicenseKeyActivationRead"},{id:"customer_portal:license_keys:deactivate",method:"post",path:"/v1/customer-portal/license-keys/deactivate",pathParams:[],query:[],body:[{name:"activation_id",type:"string",required:!0},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:204,class:"non-resource"},{id:"customer_portal:license_keys:validate",method:"post",path:"/v1/customer-portal/license-keys/validate",pathParams:[],query:[],body:[{name:"activation_id",type:"union",required:!1},{name:"benefit_id",type:"union",required:!1},{name:"conditions",type:"object",required:!1},{name:"customer_id",type:"union",required:!1},{name:"increment_usage",type:"union",required:!1},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,class:"non-resource"},{id:"customer_portal:members:list_members",method:"get",path:"/v1/customer-portal/members",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["member_session"],class:"retrieve",resource:"ListResource_CustomerPortalMember_"},{id:"customer_portal:members:add_member",method:"post",path:"/v1/customer-portal/members",pathParams:[],query:[],body:[{name:"email",type:"string",required:!0},{name:"name",type:"union",required:!1},{name:"role",type:"MemberRole",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["customer_portal:write"],credentials:["member_session"],class:"non-resource"},{id:"customer_portal:members:update_member",method:"patch",path:"/v1/customer-portal/members/{id}",pathParams:["id"],query:[],body:[{name:"name",type:"union",required:!1},{name:"role",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["member_session"],class:"non-resource"},{id:"customer_portal:members:remove_member",method:"delete",path:"/v1/customer-portal/members/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["customer_portal:write"],credentials:["member_session"],class:"delete"},{id:"customer_portal:customer_meters:list",method:"get",path:"/v1/customer-portal/meters/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"meter_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerCustomerMeter",list:!0,key:"items"},class:"list",resource:"CustomerCustomerMeter"},{id:"customer_portal:customer_meters:get",method:"get",path:"/v1/customer-portal/meters/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerCustomerMeter",list:!1},class:"retrieve",resource:"CustomerCustomerMeter"},{id:"customer_portal:orders:list",method:"get",path:"/v1/customer-portal/orders/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"product_billing_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerOrder",list:!0,key:"items"},class:"list",resource:"CustomerOrder"},{id:"customer_portal:orders:get",method:"get",path:"/v1/customer-portal/orders/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerOrder",list:!1},class:"retrieve",resource:"CustomerOrder"},{id:"customer_portal:orders:update",method:"patch",path:"/v1/customer-portal/orders/{id}",pathParams:["id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"billing_name",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerOrder",list:!1},class:"update",resource:"CustomerOrder"},{id:"customer_portal:orders:confirm_retry_payment",method:"post",path:"/v1/customer-portal/orders/{id}/confirm-payment",pathParams:["id"],query:[],body:[{name:"confirmation_token_id",type:"union",required:!1},{name:"payment_method_id",type:"union",required:!1},{name:"payment_processor",type:"PaymentProcessor",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],class:"action",resource:"CustomerOrder"},{id:"customer_portal:orders:invoice",method:"get",path:"/v1/customer-portal/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerOrderInvoice"},{id:"customer_portal:orders:generate_invoice",method:"post",path:"/v1/customer-portal/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:202,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"action",resource:"CustomerOrder"},{id:"customer_portal:orders:get_payment_status",method:"get",path:"/v1/customer-portal/orders/{id}/payment-status",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerOrderPaymentStatus"},{id:"customer_portal:orders:receipt",method:"get",path:"/v1/customer-portal/orders/{id}/receipt",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],class:"retrieve",resource:"CustomerOrderReceipt"},{id:"customer_portal:organizations:get",method:"get",path:"/v1/customer-portal/organizations/{slug}",pathParams:["slug"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"customer_portal:seats:list_seats",method:"get",path:"/v1/customer-portal/seats",pathParams:[],query:[{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!0,key:"seats"},class:"list",resource:"CustomerSeat"},{id:"customer_portal:seats:assign_seat",method:"post",path:"/v1/customer-portal/seats",pathParams:[],query:[],body:[{name:"checkout_id",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"external_member_id",type:"union",required:!1},{name:"immediate_claim",type:"boolean",required:!1},{name:"member_id",type:"union",required:!1},{name:"metadata",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!1},class:"create",resource:"CustomerSeat"},{id:"customer_portal:seats:revoke_seat",method:"delete",path:"/v1/customer-portal/seats/{seat_id}",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!1},class:"delete",resource:"CustomerSeat"},{id:"customer_portal:seats:resend_invitation",method:"post",path:"/v1/customer-portal/seats/{seat_id}/resend",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSeat",list:!1},class:"action",resource:"CustomerSeat"},{id:"customer_portal:seats:list_claimed_subscriptions",method:"get",path:"/v1/customer-portal/seats/subscriptions",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!0,key:"items"},class:"list",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:list",method:"get",path:"/v1/customer-portal/subscriptions/",pathParams:[],query:[{name:"active",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!0,key:"items"},class:"list",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:get",method:"get",path:"/v1/customer-portal/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!1},class:"retrieve",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:update",method:"patch",path:"/v1/customer-portal/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!1},class:"update",resource:"CustomerSubscription"},{id:"customer_portal:subscriptions:cancel",method:"delete",path:"/v1/customer-portal/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerSubscription",list:!1},class:"delete",resource:"CustomerSubscription"},{id:"customer_portal:wallets:list",method:"get",path:"/v1/customer-portal/wallets/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerWallet",list:!0,key:"items"},class:"list",resource:"CustomerWallet"},{id:"customer_portal:wallets:get",method:"get",path:"/v1/customer-portal/wallets/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_portal:read","customer_portal:write"],credentials:["customer_session","member_session"],answers:{resource:"CustomerWallet",list:!1},class:"retrieve",resource:"CustomerWallet"},{id:"customer-seats:list_seats",method:"get",path:"/v1/customer-seats",pathParams:[],query:[{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_seats:read"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!0,key:"seats"},class:"list",resource:"CustomerSeat"},{id:"customer-seats:assign_seat",method:"post",path:"/v1/customer-seats",pathParams:[],query:[],body:[{name:"customer_id",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"external_member_id",type:"union",required:!1},{name:"immediate_claim",type:"boolean",required:!1},{name:"member_id",type:"union",required:!1},{name:"metadata",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customer_seats:write"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!1},class:"create",resource:"CustomerSeat"},{id:"customer-seats:revoke_seat",method:"delete",path:"/v1/customer-seats/{seat_id}",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_seats:write"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!1},class:"delete",resource:"CustomerSeat"},{id:"customer-seats:resend_invitation",method:"post",path:"/v1/customer-seats/{seat_id}/resend",pathParams:["seat_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customer_seats:write"],credentials:["oat","oidc","pat"],answers:{resource:"CustomerSeat",list:!1},class:"action",resource:"CustomerSeat"},{id:"customer-seats:claim_seat",method:"post",path:"/v1/customer-seats/claim",pathParams:[],query:[],body:[{name:"invitation_token",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,answers:{resource:"CustomerSeat",list:!1,key:"seat"},class:"action",resource:"CustomerSeat"},{id:"customer-seats:get_claim_info",method:"get",path:"/v1/customer-seats/claim/{invitation_token}",pathParams:["invitation_token"],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed"},{id:"customer-sessions:create",method:"post",path:"/v1/customer-sessions/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["customer_sessions:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:list",method:"get",path:"/v1/customers/",pathParams:[],query:[{name:"active",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Customer_"},{id:"customers:create",method:"post",path:"/v1/customers/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:get",method:"get",path:"/v1/customers/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"customers:update",method:"patch",path:"/v1/customers/{id}",pathParams:["id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"external_id",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"tax_id",type:"union",required:!1},{name:"type",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:delete",method:"delete",path:"/v1/customers/{id}",pathParams:["id"],query:[{name:"anonymize",type:"boolean",required:!1}],body:[],bodyEncoding:"none",successStatus:204,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"customers:members:create",method:"post",path:"/v1/customers/{id}/members",pathParams:["id"],query:[],body:[{name:"email",type:"string",required:!0},{name:"external_id",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"string",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"create",resource:"Member"},{id:"customers:members:get",method:"get",path:"/v1/customers/{id}/members/{member_id}",pathParams:["id","member_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["members:read","members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"retrieve",resource:"Member"},{id:"customers:members:update",method:"patch",path:"/v1/customers/{id}/members/{member_id}",pathParams:["id","member_id"],query:[],body:[{name:"email",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"update",resource:"Member"},{id:"customers:members:delete",method:"delete",path:"/v1/customers/{id}/members/{member_id}",pathParams:["id","member_id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["members:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"Member"},{id:"customers:list_payment_methods",method:"get",path:"/v1/customers/{id}/payment-methods",pathParams:["id"],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_PaymentMethod_"},{id:"customers:get_state",method:"get",path:"/v1/customers/{id}/state",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"CustomerState"},{id:"customers:export",method:"get",path:"/v1/customers/export",pathParams:[],query:[{name:"organization_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"customers:get_external",method:"get",path:"/v1/customers/external/{external_id}",pathParams:["external_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"customers:update_external",method:"patch",path:"/v1/customers/external/{external_id}",pathParams:["external_id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"locale",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"tax_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"customers:delete_external",method:"delete",path:"/v1/customers/external/{external_id}",pathParams:["external_id"],query:[{name:"anonymize",type:"boolean",required:!1}],body:[],bodyEncoding:"none",successStatus:204,scopes:["customers:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"customers:members:create_external",method:"post",path:"/v1/customers/external/{external_id}/members",pathParams:["external_id"],query:[],body:[{name:"email",type:"string",required:!0},{name:"external_id",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"string",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"create",resource:"Member"},{id:"customers:members:get_external",method:"get",path:"/v1/customers/external/{external_id}/members/{member_external_id}",pathParams:["external_id","member_external_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["members:read","members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"retrieve",resource:"Member"},{id:"customers:members:update_external",method:"patch",path:"/v1/customers/external/{external_id}/members/{member_external_id}",pathParams:["external_id","member_external_id"],query:[],body:[{name:"email",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"role",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!1},class:"update",resource:"Member"},{id:"customers:members:delete_external",method:"delete",path:"/v1/customers/external/{external_id}/members/{member_external_id}",pathParams:["external_id","member_external_id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["members:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"Member"},{id:"customers:list_payment_methods_external",method:"get",path:"/v1/customers/external/{external_id}/payment-methods",pathParams:["external_id"],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_PaymentMethod_"},{id:"customers:get_state_external",method:"get",path:"/v1/customers/external/{external_id}/state",pathParams:["external_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["customers:read","customers:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"CustomerState"},{id:"discounts:list",method:"get",path:"/v1/discounts/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["discounts:read","discounts:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Discount_"},{id:"discounts:create",method:"post",path:"/v1/discounts/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["discounts:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"discounts:get",method:"get",path:"/v1/discounts/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["discounts:read","discounts:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"discounts:update",method:"patch",path:"/v1/discounts/{id}",pathParams:["id"],query:[],body:[{name:"amount",type:"union",required:!1},{name:"amounts",type:"union",required:!1},{name:"basis_points",type:"union",required:!1},{name:"code",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"duration",type:"union",required:!1},{name:"duration_in_months",type:"union",required:!1},{name:"ends_at",type:"union",required:!1},{name:"max_redemptions",type:"union",required:!1},{name:"max_redemptions_per_customer",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"products",type:"union",required:!1},{name:"starts_at",type:"union",required:!1},{name:"type",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["discounts:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"discounts:delete",method:"delete",path:"/v1/discounts/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["discounts:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"disputes:list",method:"get",path:"/v1/disputes/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"order_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["disputes:read","disputes:write"],credentials:["oat","oidc","pat"],answers:{resource:"Dispute",list:!0,key:"items"},class:"list",resource:"Dispute"},{id:"disputes:get",method:"get",path:"/v1/disputes/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["disputes:read","disputes:write"],credentials:["oat","oidc","pat"],answers:{resource:"Dispute",list:!1},class:"retrieve",resource:"Dispute"},{id:"disputes:accept",method:"post",path:"/v1/disputes/{id}/accept",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["disputes:write"],credentials:["oat","oidc","pat"],answers:{resource:"Dispute",list:!1},class:"action",resource:"Dispute"},{id:"event-types:list",method:"get",path:"/v1/event-types/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"parent_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"root_events",type:"boolean",required:!1},{name:"sorting",type:"union",required:!1},{name:"source",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_EventTypeWithStats_"},{id:"event-types:update",method:"patch",path:"/v1/event-types/{id}",pathParams:["id"],query:[],body:[{name:"label",type:"string",required:!0},{name:"label_property_selector",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["events:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"events:list",method:"get",path:"/v1/events/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"depth",type:"union",required:!1},{name:"end_timestamp",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"filter",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"meter_id",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"parent_id",type:"union",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"source",type:"union",required:!1},{name:"start_timestamp",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"events:get",method:"get",path:"/v1/events/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"events:ingest",method:"post",path:"/v1/events/ingest",pathParams:[],query:[],body:[{name:"events",type:"array",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["events:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"events:list_names",method:"get",path:"/v1/events/names",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"source",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["events:read","events:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_EventName_"},{id:"files:list",method:"get",path:"/v1/files/",pathParams:[],query:[{name:"ids",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["files:read","files:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_FileRead_"},{id:"files:create",method:"post",path:"/v1/files/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"files:update",method:"patch",path:"/v1/files/{id}",pathParams:["id"],query:[],body:[{name:"name",type:"union",required:!1},{name:"version",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"files:delete",method:"delete",path:"/v1/files/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"delete"},{id:"files:uploaded",method:"post",path:"/v1/files/{id}/uploaded",pathParams:["id"],query:[],body:[{name:"id",type:"string",required:!0},{name:"parts",type:"array",required:!0},{name:"path",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["files:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"license_keys:list",method:"get",path:"/v1/license-keys/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["license_keys:read","license_keys:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_LicenseKeyRead_"},{id:"license_keys:get",method:"get",path:"/v1/license-keys/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["license_keys:read","license_keys:write"],credentials:["oat","oidc","pat"],answers:{resource:"LicenseKeyWithActivations",list:!1},class:"retrieve",resource:"LicenseKeyWithActivations"},{id:"license_keys:update",method:"patch",path:"/v1/license-keys/{id}",pathParams:["id"],query:[],body:[{name:"expires_at",type:"union",required:!1},{name:"limit_activations",type:"union",required:!1},{name:"limit_usage",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"usage",type:"integer",required:!1,minimum:-2147483648,maximum:2147483647}],bodyEncoding:"json",successStatus:200,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"license_keys:get_activation",method:"get",path:"/v1/license-keys/{id}/activations/{activation_id}",pathParams:["id","activation_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["license_keys:read","license_keys:write"],credentials:["oat","oidc","pat"],answers:{resource:"LicenseKeyActivationRead",list:!1},class:"retrieve",resource:"LicenseKeyActivationRead"},{id:"license_keys:activate",method:"post",path:"/v1/license-keys/activate",pathParams:[],query:[],body:[{name:"conditions",type:"object",required:!1},{name:"key",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"meta",type:"object",required:!1},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],answers:{resource:"LicenseKeyActivationRead",list:!1},class:"action",resource:"LicenseKeyActivationRead"},{id:"license_keys:deactivate",method:"post",path:"/v1/license-keys/deactivate",pathParams:[],query:[],body:[{name:"activation_id",type:"string",required:!0},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:204,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"license_keys:validate",method:"post",path:"/v1/license-keys/validate",pathParams:[],query:[],body:[{name:"activation_id",type:"union",required:!1},{name:"benefit_id",type:"union",required:!1},{name:"conditions",type:"object",required:!1},{name:"customer_id",type:"union",required:!1},{name:"increment_usage",type:"union",required:!1},{name:"key",type:"string",required:!0},{name:"organization_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["license_keys:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"members:list_members",method:"get",path:"/v1/members/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"role",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["members:read","members:write"],credentials:["oat","oidc","pat"],answers:{resource:"Member",list:!0,key:"items"},class:"list",resource:"Member"},{id:"meters:list",method:"get",path:"/v1/meters/",pathParams:[],query:[{name:"is_archived",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["meters:read","meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!0,key:"items"},class:"list",resource:"Meter"},{id:"meters:create",method:"post",path:"/v1/meters/",pathParams:[],query:[],body:[{name:"aggregation",type:"union",required:!0},{name:"custom_label",type:"union",required:!1},{name:"custom_multiplier",type:"union",required:!1},{name:"filter",type:"Filter",required:!0},{name:"metadata",type:"object",required:!1},{name:"name",type:"string",required:!0},{name:"organization_id",type:"union",required:!1},{name:"unit",type:"MeterUnit",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!1},class:"create",resource:"Meter"},{id:"meters:get",method:"get",path:"/v1/meters/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["meters:read","meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!1},class:"retrieve",resource:"Meter"},{id:"meters:update",method:"patch",path:"/v1/meters/{id}",pathParams:["id"],query:[],body:[{name:"aggregation",type:"union",required:!1},{name:"custom_label",type:"union",required:!1},{name:"custom_multiplier",type:"union",required:!1},{name:"filter",type:"union",required:!1},{name:"is_archived",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"unit",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"Meter",list:!1},class:"update",resource:"Meter"},{id:"meters:quantities",method:"get",path:"/v1/meters/{id}/quantities",pathParams:["id"],query:[{name:"customer_aggregation_function",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"end_timestamp",type:"string",required:!0},{name:"external_customer_id",type:"union",required:!1},{name:"interval",type:"TimeInterval",required:!0},{name:"metadata",type:"MetadataQuery",required:!1},{name:"start_timestamp",type:"string",required:!0},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["meters:read","meters:write"],credentials:["oat","oidc","pat"],answers:{resource:"MeterQuantity",list:!0,key:"quantities"},class:"list",resource:"MeterQuantity"},{id:"metrics:get",method:"get",path:"/v1/metrics/",pathParams:[],query:[{name:"billing_type",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"end_date",type:"string",required:!0},{name:"interval",type:"TimeInterval",required:!0},{name:"metrics",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"start_date",type:"string",required:!0},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"MetricsResponse"},{id:"metrics:list_dashboards",method:"get",path:"/v1/metrics/dashboards",pathParams:[],query:[{name:"organization_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!0},class:"list",resource:"MetricDashboardSchema"},{id:"metrics:create_dashboard",method:"post",path:"/v1/metrics/dashboards",pathParams:[],query:[],body:[{name:"metrics",type:"array",required:!1},{name:"name",type:"string",required:!0},{name:"organization_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["metrics:write"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!1},class:"create",resource:"MetricDashboardSchema"},{id:"metrics:get_dashboard",method:"get",path:"/v1/metrics/dashboards/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!1},class:"retrieve",resource:"MetricDashboardSchema"},{id:"metrics:update_dashboard",method:"patch",path:"/v1/metrics/dashboards/{id}",pathParams:["id"],query:[],body:[{name:"metrics",type:"union",required:!1},{name:"name",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["metrics:write"],credentials:["oat","oidc","pat"],answers:{resource:"MetricDashboardSchema",list:!1},class:"update",resource:"MetricDashboardSchema"},{id:"metrics:delete_dashboard",method:"delete",path:"/v1/metrics/dashboards/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["metrics:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"MetricDashboardSchema"},{id:"metrics:export",method:"get",path:"/v1/metrics/export",pathParams:[],query:[{name:"billing_type",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"end_date",type:"string",required:!0},{name:"interval",type:"TimeInterval",required:!0},{name:"metrics",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"start_date",type:"string",required:!0},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],class:"computed"},{id:"metrics:limits",method:"get",path:"/v1/metrics/limits",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["metrics:read"],credentials:["oat","oidc","pat"],answers:{resource:"MetricsIntervalsLimits",list:!1,key:"intervals"},class:"retrieve",resource:"MetricsIntervalsLimits"},{id:"oauth2:authorize",method:"get",path:"/v1/oauth2/authorize",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,credentials:["oidc","pat"],class:"computed"},{id:"oauth2:introspect_token",method:"post",path:"/v1/oauth2/introspect",pathParams:[],query:[],body:[{name:"client_id",type:"string",required:!0},{name:"client_secret",type:"string",required:!0},{name:"token",type:"string",required:!0},{name:"token_type_hint",type:"union",required:!1}],bodyEncoding:"form",enums:{token_type_hint:["access_token","refresh_token"]},successStatus:200,class:"non-resource"},{id:"oauth2:clients:oauth2:create_client",method:"post",path:"/v1/oauth2/register",pathParams:[],query:[],body:[{name:"client_name",type:"string",required:!0},{name:"client_uri",type:"union",required:!1},{name:"default_sub_type",type:"SubType",required:!1},{name:"grant_types",type:"array",required:!1},{name:"logo_uri",type:"union",required:!1},{name:"policy_uri",type:"union",required:!1},{name:"redirect_uris",type:"array",required:!0},{name:"response_types",type:"array",required:!1},{name:"scope",type:"string",required:!1},{name:"token_endpoint_auth_method",type:"string",required:!1},{name:"tos_uri",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,credentials:["oidc","pat"],class:"non-resource"},{id:"oauth2:clients:oauth2:get_client",method:"get",path:"/v1/oauth2/register/{client_id}",pathParams:["client_id"],query:[],body:[],bodyEncoding:"none",successStatus:200,credentials:["oidc","pat"],class:"computed"},{id:"oauth2:clients:oauth2:update_client",method:"put",path:"/v1/oauth2/register/{client_id}",pathParams:["client_id"],query:[],body:[{name:"client_id",type:"string",required:!0},{name:"client_name",type:"string",required:!0},{name:"client_uri",type:"union",required:!1},{name:"default_sub_type",type:"SubType",required:!1},{name:"grant_types",type:"array",required:!1},{name:"logo_uri",type:"union",required:!1},{name:"policy_uri",type:"union",required:!1},{name:"redirect_uris",type:"array",required:!0},{name:"response_types",type:"array",required:!1},{name:"scope",type:"string",required:!1},{name:"token_endpoint_auth_method",type:"string",required:!1},{name:"tos_uri",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,credentials:["oidc","pat"],class:"non-resource"},{id:"oauth2:clients:oauth2:delete_client",method:"delete",path:"/v1/oauth2/register/{client_id}",pathParams:["client_id"],query:[],body:[],bodyEncoding:"none",successStatus:204,credentials:["oidc","pat"],class:"delete"},{id:"oauth2:revoke_token",method:"post",path:"/v1/oauth2/revoke",pathParams:[],query:[],body:[{name:"client_id",type:"string",required:!0},{name:"client_secret",type:"string",required:!0},{name:"token",type:"string",required:!0},{name:"token_type_hint",type:"union",required:!1}],bodyEncoding:"form",enums:{token_type_hint:["access_token","refresh_token"]},successStatus:200,class:"non-resource"},{id:"oauth2:request_token",method:"post",path:"/v1/oauth2/token",pathParams:[],query:[],body:[],bodyEncoding:"form",successStatus:200,class:"non-resource"},{id:"oauth2:userinfo",method:"get",path:"/v1/oauth2/userinfo",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,credentials:["oidc"],class:"computed"},{id:"orders:list",method:"get",path:"/v1/orders/",pathParams:[],query:[{name:"checkout_id",type:"union",required:!1},{name:"created_after",type:"union",required:!1},{name:"created_before",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_billing_type",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!0,key:"items"},class:"list",resource:"Order"},{id:"orders:create",method:"post",path:"/v1/orders/",pathParams:[],query:[],body:[{name:"amount",type:"union",required:!1},{name:"currency",type:"union",required:!1},{name:"custom_field_data",type:"object",required:!1},{name:"customer_id",type:"string",required:!0},{name:"description",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"string",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["orders:write"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"create",resource:"Order"},{id:"orders:get",method:"get",path:"/v1/orders/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"retrieve",resource:"Order"},{id:"orders:update",method:"patch",path:"/v1/orders/{id}",pathParams:["id"],query:[],body:[{name:"billing_address",type:"union",required:!1},{name:"billing_name",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["orders:write"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"update",resource:"Order"},{id:"orders:finalize",method:"post",path:"/v1/orders/{id}/finalize",pathParams:["id"],query:[],body:[{name:"payment_method_id",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["orders:write"],credentials:["oat","oidc","pat"],answers:{resource:"Order",list:!1},class:"action",resource:"Order"},{id:"orders:invoice",method:"get",path:"/v1/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"OrderInvoice"},{id:"orders:generate_invoice",method:"post",path:"/v1/orders/{id}/invoice",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:202,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"action",resource:"Order"},{id:"orders:receipt",method:"get",path:"/v1/orders/{id}/receipt",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"OrderReceipt"},{id:"orders:export",method:"get",path:"/v1/orders/export",pathParams:[],query:[{name:"columns",type:"union",required:!1},{name:"created_after",type:"union",required:!1},{name:"created_before",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["orders:read"],credentials:["oat","oidc","pat"],class:"computed"},{id:"organizations:list",method:"get",path:"/v1/organizations/",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"slug",type:"union",required:!1},{name:"sorting",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["organizations:read","organizations:write"],credentials:["oat","oidc","pat"],answers:{resource:"Organization",list:!0,key:"items"},class:"list",resource:"Organization"},{id:"organizations:create",method:"post",path:"/v1/organizations/",pathParams:[],query:[],body:[{name:"avatar_url",type:"union",required:!1},{name:"country",type:"union",required:!1},{name:"customer_email_settings",type:"union",required:!1},{name:"customer_portal_settings",type:"union",required:!1},{name:"default_presentment_currency",type:"PresentmentCurrency",required:!1},{name:"default_tax_behavior",type:"TaxBehaviorOption",required:!1},{name:"details",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"feature_settings",type:"union",required:!1},{name:"legal_entity",type:"union",required:!1},{name:"name",type:"string",required:!0},{name:"slug",type:"string",required:!0},{name:"socials",type:"union",required:!1},{name:"subscription_settings",type:"union",required:!1},{name:"website",type:"union",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["organizations:write"],credentials:["oidc","pat"],answers:{resource:"Organization",list:!1},class:"create",resource:"Organization"},{id:"organizations:get",method:"get",path:"/v1/organizations/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["organizations:read","organizations:write"],credentials:["oat","oidc","pat"],answers:{resource:"Organization",list:!1},class:"retrieve",resource:"Organization"},{id:"organizations:update",method:"patch",path:"/v1/organizations/{id}",pathParams:["id"],query:[],body:[{name:"avatar_url",type:"union",required:!1},{name:"country",type:"union",required:!1},{name:"customer_email_settings",type:"union",required:!1},{name:"customer_portal_settings",type:"union",required:!1},{name:"default_presentment_currency",type:"union",required:!1},{name:"default_tax_behavior",type:"union",required:!1},{name:"details",type:"union",required:!1},{name:"dispute_settings",type:"union",required:!1},{name:"email",type:"union",required:!1},{name:"embed_hosts",type:"union",required:!1},{name:"feature_settings",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"socials",type:"union",required:!1},{name:"sso_enforced",type:"union",required:!1},{name:"subscription_settings",type:"union",required:!1},{name:"website",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["organizations:write"],credentials:["oat","oidc","pat"],answers:{resource:"Organization",list:!1},class:"update",resource:"Organization"},{id:"payments:list",method:"get",path:"/v1/payments/",pathParams:[],query:[{name:"checkout_id",type:"union",required:!1},{name:"customer_email",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"method",type:"union",required:!1},{name:"order_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["payments:read"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Payment_"},{id:"payments:get",method:"get",path:"/v1/payments/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["payments:read"],credentials:["oat","oidc","pat"],class:"computed"},{id:"products:list",method:"get",path:"/v1/products/",pathParams:[],query:[{name:"benefit_id",type:"union",required:!1},{name:"id",type:"union",required:!1},{name:"is_archived",type:"union",required:!1},{name:"is_recurring",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"visibility",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["products:read","products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!0,key:"items"},class:"list",resource:"Product"},{id:"products:create",method:"post",path:"/v1/products/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"create",resource:"Product"},{id:"products:get",method:"get",path:"/v1/products/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["products:read","products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"retrieve",resource:"Product"},{id:"products:update",method:"patch",path:"/v1/products/{id}",pathParams:["id"],query:[],body:[{name:"attached_custom_fields",type:"union",required:!1},{name:"description",type:"union",required:!1},{name:"is_archived",type:"union",required:!1},{name:"medias",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"name",type:"union",required:!1},{name:"prices",type:"union",required:!1},{name:"recurring_interval",type:"union",required:!1},{name:"recurring_interval_count",type:"union",required:!1},{name:"trial_interval",type:"union",required:!1},{name:"trial_interval_count",type:"union",required:!1},{name:"visibility",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"update",resource:"Product"},{id:"products:update_benefits",method:"post",path:"/v1/products/{id}/benefits",pathParams:["id"],query:[],body:[{name:"benefits",type:"array",required:!0}],bodyEncoding:"json",successStatus:200,scopes:["products:write"],credentials:["oat","oidc","pat"],answers:{resource:"Product",list:!1},class:"action",resource:"Product"},{id:"refunds:list",method:"get",path:"/v1/refunds/",pathParams:[],query:[{name:"customer_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"order_id",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"sorting",type:"union",required:!1},{name:"subscription_id",type:"union",required:!1},{name:"succeeded",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["refunds:read","refunds:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_Refund_"},{id:"refunds:create",method:"post",path:"/v1/refunds/",pathParams:[],query:[],body:[{name:"amount",type:"integer",required:!0},{name:"comment",type:"union",required:!1},{name:"metadata",type:"object",required:!1},{name:"order_id",type:"string",required:!0},{name:"reason",type:"string",required:!0},{name:"revoke_benefits",type:"boolean",required:!1}],bodyEncoding:"json",successStatus:201,scopes:["refunds:write"],credentials:["oat","oidc","pat"],class:"non-resource"},{id:"subscriptions:list",method:"get",path:"/v1/subscriptions/",pathParams:[],query:[{name:"active",type:"union",required:!1},{name:"cancel_at_period_end",type:"union",required:!1},{name:"canceled_at_after",type:"union",required:!1},{name:"canceled_at_before",type:"union",required:!1},{name:"customer_cancellation_reason",type:"union",required:!1},{name:"customer_id",type:"union",required:!1},{name:"discount_id",type:"union",required:!1},{name:"external_customer_id",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"metadata",type:"MetadataQuery",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1},{name:"product_id",type:"union",required:!1},{name:"sorting",type:"union",required:!1},{name:"started_after",type:"union",required:!1},{name:"started_before",type:"union",required:!1},{name:"status",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:read","subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!0,key:"items"},class:"list",resource:"Subscription"},{id:"subscriptions:create",method:"post",path:"/v1/subscriptions/",pathParams:[],query:[],body:[],bodyEncoding:"json",successStatus:201,scopes:["subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"create",resource:"Subscription"},{id:"subscriptions:get",method:"get",path:"/v1/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:read","subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"retrieve",resource:"Subscription"},{id:"subscriptions:update",method:"patch",path:"/v1/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"json",successStatus:200,scopes:["subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"update",resource:"Subscription"},{id:"subscriptions:revoke",method:"delete",path:"/v1/subscriptions/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:write"],credentials:["oat","oidc","pat"],answers:{resource:"Subscription",list:!1},class:"delete",resource:"Subscription"},{id:"subscriptions:export",method:"get",path:"/v1/subscriptions/export",pathParams:[],query:[{name:"cancel_at_period_end",type:"union",required:!1},{name:"columns",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"product_id",type:"union",required:!1},{name:"started_after",type:"union",required:!1},{name:"started_before",type:"union",required:!1},{name:"status",type:"union",required:!1},{name:"timezone",type:"string",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["subscriptions:read","subscriptions:write"],credentials:["oat","oidc","pat"],class:"computed"},{id:"webhooks:list_webhook_deliveries",method:"get",path:"/v1/webhooks/deliveries",pathParams:[],query:[{name:"end_timestamp",type:"union",required:!1},{name:"endpoint_id",type:"union",required:!1},{name:"event_type",type:"union",required:!1},{name:"http_code_class",type:"union",required:!1},{name:"limit",type:"integer",required:!1},{name:"page",type:"integer",required:!1},{name:"query",type:"union",required:!1},{name:"start_timestamp",type:"union",required:!1},{name:"succeeded",type:"union",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:read","webhooks:write"],credentials:["oat","oidc","pat"],class:"retrieve",resource:"ListResource_WebhookDelivery_"},{id:"webhooks:list_webhook_endpoints",method:"get",path:"/v1/webhooks/endpoints",pathParams:[],query:[{name:"limit",type:"integer",required:!1},{name:"organization_id",type:"union",required:!1},{name:"page",type:"integer",required:!1}],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:read","webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!0,key:"items"},class:"list",resource:"WebhookEndpoint"},{id:"webhooks:create_webhook_endpoint",method:"post",path:"/v1/webhooks/endpoints",pathParams:[],query:[],body:[{name:"events",type:"array",required:!0},{name:"format",type:"WebhookFormat",required:!0},{name:"name",type:"union",required:!1},{name:"organization_id",type:"union",required:!1},{name:"url",type:"string",required:!0}],bodyEncoding:"json",successStatus:201,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"create",resource:"WebhookEndpoint"},{id:"webhooks:get_webhook_endpoint",method:"get",path:"/v1/webhooks/endpoints/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:read","webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"retrieve",resource:"WebhookEndpoint"},{id:"webhooks:update_webhook_endpoint",method:"patch",path:"/v1/webhooks/endpoints/{id}",pathParams:["id"],query:[],body:[{name:"enabled",type:"union",required:!1},{name:"events",type:"union",required:!1},{name:"format",type:"union",required:!1},{name:"name",type:"union",required:!1},{name:"url",type:"union",required:!1}],bodyEncoding:"json",successStatus:200,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"update",resource:"WebhookEndpoint"},{id:"webhooks:delete_webhook_endpoint",method:"delete",path:"/v1/webhooks/endpoints/{id}",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:204,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],class:"delete",resource:"WebhookEndpoint"},{id:"webhooks:reset_webhook_endpoint_secret",method:"patch",path:"/v1/webhooks/endpoints/{id}/secret",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:200,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],answers:{resource:"WebhookEndpoint",list:!1},class:"action",resource:"WebhookEndpoint"},{id:"webhooks:redeliver_webhook_event",method:"post",path:"/v1/webhooks/events/{id}/redeliver",pathParams:["id"],query:[],body:[],bodyEncoding:"none",successStatus:202,scopes:["webhooks:write"],credentials:["oat","oidc","pat"],class:"non-resource"}]};import{createPackFetch as xt}from"../../engine/v3/volter_world-core.mjs";import{sha256 as it}from"../../engine/v3/volter_world-core.mjs";var ve=()=>Response.json({error:"Unauthorized",detail:"Unauthorized"},{status:401});async function we(t,e){let r=t.call.operation.id==="checkouts:client_confirm"?[]:t.call.operation.credentials??[],a=/^Bearer\s+(\S+)/i.exec(t.call.request.headers.get("authorization")??"")?.[1];return(r.includes("oat")||r.includes("pat"))&&(!a||!t.rowsRaw("_access_token").some(n=>(n._environment??"production")===p(t)&&n._sha256===it(a)&&n.deleted!==!0&&(n.expires_at===null||Date.parse(String(n.expires_at))>Date.parse(t.occurredAt))))?ve():t.validate()??e()}async function ke(t){for(let e of u(t,k).filter(r=>r.status==="open"&&String(r.expires_at)<=t.occurredAt)){let r=await t.at(String(e.expires_at));r.legal("Checkout","status","checkout.update","open","expired",String(e.id),"time"),await r.write(k,String(e.id),{status:"expired",modified_at:r.occurredAt},"checkout.update")}for(let e of u(t,y).filter(r=>["trialing","active"].includes(String(r.status)))){let r=String(e.current_period_end);for(;r<=t.occurredAt;){let a=await t.at(r);if(e.cancel_at_period_end===!0){a.legal("Subscription","status","subscription.update",String(e.status),"canceled",String(e.id),"time"),await a.write(y,String(e.id),{status:"canceled",ended_at:r,ends_at:r,modified_at:r},"subscription.update");break}let s=J(r,String(e.recurring_interval),Number(e.recurring_interval_count??1));a.legal("Subscription","status","subscription.update","trialing","active",String(e.id),"time"),await a.write(y,String(e.id),{status:"active",current_period_start:r,current_period_end:s,modified_at:r},"subscription.update"),await Z(a,{...e,subscription_id:e.id},e.status==="trialing"?"subscription_create":"subscription_cycle",e.status==="trialing"?void 0:{start:String(e.current_period_start),end:r}),e.current_period_start=r,e.status="active",r=s}}}function Se(t){return O(t)}var oe={};Ge(oe,{accessTokens:()=>ut,appCredentials:()=>lt,deliveries:()=>ct,revokeToken:()=>dt});import{sha256 as ie}from"../../engine/v3/volter_world-core.mjs";async function ot(t,e,r){let a=t.mint("_access_token"),s=await A(t,"polar_oat_",`access-token:${a}`);return await t.record("_access_token",{comment:e,_environment:p(t),_sha256:ie(s),created_at:t.occurredAt,expires_at:r===null?null:new Date(Date.parse(t.occurredAt)+r*864e5).toISOString(),deleted:!1},a),{token:s,id:a}}async function ut(t){let e=q(t),r=typeof e.expires_in_days=="number"?e.expires_in_days:null;return Response.json(await ot(t,typeof e.comment=="string"?e.comment:"token",r),{status:201})}async function dt(t){let e=String(t.call.params.n);return t.rowsRaw("_access_token").some(r=>r.id===e&&r.deleted!==!0)?(await t.record("_access_token",{deleted:!0},e),new Response(null,{status:204})):Response.json({error:"no such token"},{status:404})}async function lt(t){let e=await A(t,"polar_oat_",`access-token:app:${p(t)}`);return t.rowsRaw("_access_token",{withDeleted:!0}).some(r=>r.id===`oat_app_${p(t)}`&&r._sha256===ie(e))||await t.record("_access_token",{comment:"world",_environment:p(t),_sha256:ie(e),created_at:t.occurredAt,expires_at:null,deleted:!1},`oat_app_${p(t)}`),Response.json({access_token:e},{status:201})}async function ct(t){let e=new URL(t.call.request.url).searchParams,r=t.rowsRaw("_webhook_delivery").filter(a=>(e.get("to")===null||a.url===e.get("to"))&&(e.get("type")===null||a.event_type===e.get("type"))).sort((a,s)=>Number(a.sent_at)-Number(s.sent_at));return Response.json({data:r.map(a=>({url:a.url,type:a.event_type,sent_at:a.sent_at,headers:a.headers,body:JSON.parse(String(a.body))}))})}var mt=864e5;async function Pe(t){let e=q(t),r=Array.isArray(e.products)?e.products.map(String):[];if(r.length===0)return g("products");let a=d(t,S,r[0]);if(!a||a.deleted===!0)return m(["products",0],"Product does not exist.");let s=[];for(let l of e.prices?.[r[0]]??[]){let h=t.mint("_price");await t.record("_price",{},h),s.push({...l,id:h,source:"ad_hoc"})}let n=(s.length?s:a.prices??[])[0],i=n?.amount_type==="fixed"?Number(n.price_amount??0):Number(e.amount??0),c=e.customer_id!==void 0?w(t,{id:e.customer_id}):void 0;if(e.customer_id!==void 0&&!c)return m(["customer_id"],"Customer does not exist.");let o=E(t,k);return await t.write(k,o,{..._e(t,{id:o,created_at:t.occurredAt,modified_at:null,status:"open",client_secret:await A(t,"polar_c_",`checkout:${o}`),expires_at:new Date(Date.parse(t.occurredAt)+mt).toISOString(),product_id:a.id,products:r,product_price_id:n?.id??null,amount:i,prices:{[String(a.id)]:s.length?s.map(l=>Y(t,l,a)):a.prices},currency:n?.price_currency??"usd",success_url:e.success_url??null,return_url:e.return_url??null,embed_origin:e.embed_origin??null,customer_ip_address:e.customer_ip_address??null,allow_discount_codes:e.allow_discount_codes??!0,require_billing_address:e.require_billing_address??!1,allow_trial:e.allow_trial??null,is_business_customer:e.is_business_customer??!1,customer_id:c?.id??null,customer_email:e.customer_email??c?.email??null,customer_name:e.customer_name??null,external_customer_id:e.external_customer_id??e.customer_external_id??null,metadata:e.metadata??{},customer_metadata:e.customer_metadata??{}}),_environment:p(t)},"checkout.create"),Response.json($(t,d(t,k,o)),{status:201})}var Ee=t=>u(t,k).find(e=>e.client_secret===t.call.params.client_secret),Ce=(t,e)=>{let{trial_interval:r,trial_interval_count:a,metadata:s,external_customer_id:n,subscription_id:i,customer_metadata:c,...o}=$(t,e);return{...o,organization:ne(t)}};async function Oe(t){let e=d(t,k,String(t.call.params.id));return e&&e.deleted!==!0?Response.json($(t,e)):P("Checkout")}async function xe(t){let e=String(t.params.query??"").toLowerCase(),r=u(t,k).filter(a=>C(t,"customer_id",a.customer_id)&&C(t,"external_customer_id",a.external_customer_id)&&C(t,"product_id",a.product_id)&&C(t,"status",a.status)).filter(a=>e===""||String(a.customer_email??"").toLowerCase().includes(e)).sort(T("created_at"));return t.list("Checkout",r.map(a=>$(t,a)))}async function re(t){let e=Ee(t);return e?Response.json(Ce(t,e)):P("Checkout")}async function ae(t){let e=Ee(t);if(!e)return P("Checkout");if(e.status==="expired")return M(410,"ExpiredCheckoutError","The checkout session is expired.");let r=t.legal("Checkout","status","checkouts:client_confirm",e.status,"confirmed",String(e.id),"external");if(r)return t.refuse(r);let a=q(t);if(e.is_payment_required&&!a.confirmation_token_id)return g("confirmation_token_id");let s=a.customer_email??e.customer_email,n=e.customer_id?w(t,{id:e.customer_id}):e.external_customer_id?w(t,{external:e.external_customer_id}):void 0;if(!n&&s&&(n=u(t,b).find(f=>String(f.email).toLowerCase()===s.toLowerCase())),!n&&!s)return g("customer_email");let i=d(t,S,String(e.product_id));if(!i)return m(["products",0],"Product does not exist.");let c=n,o=i.recurring_interval!=null&&c?u(t,y).find(f=>f.customer_id===c.id&&f.product_id===i.id&&["trialing","active"].includes(String(f.status))):void 0;if(o)return t.refuse(t.legal("Subscription","status","checkouts:client_confirm",o.status,void 0,String(o.id),"external"));let l=t.occurredAt,h=!1;if(await t.change("Checkout",String(e.id),f=>{if(f.status==="open")return h=!0,{status:"confirmed",modified_at:l}},"checkout.update"),!h)return M(403,"CheckoutForbiddenError","The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.");if(!n){let f=E(t,b);await t.write(b,f,{...H(t,{id:f,created_at:t.occurredAt,modified_at:null,email:s,name:a.customer_name??e.customer_name??null,external_id:e.external_customer_id??null,email_verified:!1,metadata:{}}),_environment:p(t)},"customer.create"),n=d(t,b,f)}let _=String(n.id);await t.write(k,String(e.id),{customer_id:_,customer_email:n.email,modified_at:l},"checkout.update");let v=null;if(i.recurring_interval){v=E(t,y);let f=i.trial_interval!=null,j=J(l,String(f?i.trial_interval:i.recurring_interval),Number(f?i.trial_interval_count??1:i.recurring_interval_count??1));await t.write(y,v,{...me(t,{id:v,created_at:l,modified_at:null,amount:e.amount,currency:e.currency??"usd",recurring_interval:i.recurring_interval,recurring_interval_count:i.recurring_interval_count??1,status:"incomplete",current_period_start:l,current_period_end:j,trial_start:f?l:null,trial_end:f?j:null,cancel_at_period_end:!1,canceled_at:null,started_at:l,ends_at:null,ended_at:null,customer_id:_,product_id:i.id,checkout_id:e.id,prices:e.prices[String(i.id)],metadata:e.metadata??{}}),_environment:p(t)},"subscription.create"),t.legal("Subscription","status","subscription.activate","incomplete",f?"trialing":"active",v,"vendor"),await t.write(y,v,{status:f?"trialing":"active",modified_at:l},"subscription.activate")}i.trial_interval||await Z(t,{...e,customer_id:_,subscription_id:v},v?"subscription_create":"purchase");let F=await X(t,n),Q={...Ce(t,d(t,k,String(e.id))),customer_session_token:F.token};return t.legal("Checkout","status","checkout.update","confirmed","succeeded",String(e.id),"vendor"),await t.write(k,String(e.id),{status:"succeeded",subscription_id:v,modified_at:l},"checkout.update"),Response.json(Q)}async function Re(t){let e=q(t);if(e.customer_id===void 0&&e.external_customer_id===void 0)return g("customer_id");let r=e.customer_id!==void 0?w(t,{id:e.customer_id}):w(t,{external:e.external_customer_id});return r?Response.json(await X(t,r,e.return_url),{status:201}):m([e.customer_id!==void 0?"customer_id":"external_customer_id"],"Customer does not exist.")}var yt=["email","name","external_id","billing_name","billing_address","tax_id","locale","metadata"];function ft(t,e,r){return typeof e.email=="string"&&u(t,b).some(s=>s.id!==r&&String(s.email).toLowerCase()===String(e.email).toLowerCase())?qt():e.external_id!=null&&u(t,b).some(s=>s.id!==r&&s.external_id===e.external_id)?gt():void 0}async function je(t){let e=q(t);if(typeof e.email!="string"||e.email==="")return g("email");let r=ft(t,e);if(r)return r;let a=E(t,b),s={id:a,created_at:t.occurredAt,modified_at:null,email_verified:!1};for(let n of yt)n in e&&(s[n]=e[n]);return await t.write(b,a,{...H(t,s),_environment:p(t)},"customer.create"),Response.json(x(t,d(t,b,a)),{status:201})}var bt=t=>w(t,{external:decodeURIComponent(t.call.params.external_id??"")});async function ze(t){let e=w(t,{id:t.call.params.id});return e?Response.json(x(t,e)):P("Customer")}async function Me(t){let e=bt(t);return e?Response.json(await fe(t,e)):P("Customer")}async function Ae(t){let e=String(t.params.query??"").toLowerCase(),r=new Set(u(t,y).filter(n=>["trialing","active","past_due"].includes(String(n.status))).map(n=>n.customer_id)),a=t.params.active===void 0?void 0:String(t.params.active)==="true",s=u(t,b).filter(n=>t.params.email===void 0||String(n.email??"").toLowerCase()===String(t.params.email).toLowerCase()).filter(n=>e===""||[n.name,n.email,n.external_id].some(i=>typeof i=="string"&&i.toLowerCase().includes(e))).filter(n=>a===void 0||r.has(n.id)===a).sort(T("created_at"));return t.list(b,s.map(n=>x(t,n)))}function gt(){return m(["external_id"],"A customer with this external ID already exists.")}function qt(){return m(["email"],"A customer with this email address already exists.")}var vt=["checkout_id","customer_id","product_id","subscription_id","status"];async function Te(t){let e=d(t,R,String(t.call.params.id));return e?Response.json(N(t,e)):P("Order")}async function Ie(t){let e=u(t,R).filter(r=>vt.every(a=>t.params[a]===void 0||[].concat(t.params[a]).map(String).includes(String(r[a])))).sort((r,a)=>String(a.created_at).localeCompare(String(r.created_at)));return t.list("Order",e.map(r=>N(t,r)))}var kt=new Set(["fixed","free","custom","metered_unit","seat_based"]);async function Le(t){let e=q(t);if(typeof e.name!="string"||e.name==="")return g("name");let r=Array.isArray(e.prices)?e.prices:[];if(r.length===0)return g("prices");let a=r.findIndex(i=>!kt.has(String(i.amount_type)));if(a>=0)return m(["prices",a,"amount_type"],"Input tag does not match any of the expected tags","union_tag_invalid");let s=E(t,S),n=[];for(let i of r){let c=t.mint("_price");await t.record("_price",{},c),n.push(Y(t,{...i,id:c},{...e,id:s,created_at:t.occurredAt}))}return await t.write(S,s,{...ce(t,{id:s,created_at:t.occurredAt,modified_at:null,name:e.name,description:e.description??null,recurring_interval:e.recurring_interval??null,recurring_interval_count:e.recurring_interval_count??(e.recurring_interval?1:null),trial_interval:e.trial_interval??null,trial_interval_count:e.trial_interval_count??null,visibility:e.visibility??"public",is_archived:!1,prices:n,benefit_ids:[],metadata:e.metadata??{}}),_environment:p(t)},"product.create"),Response.json(L(t,d(t,S,s)),{status:201})}async function De(t){let e=i=>i===void 0?void 0:String(i)==="true",r=e(t.params.is_archived),a=e(t.params.is_recurring),s=String(t.params.query??"").toLowerCase(),n=u(t,S).filter(i=>r===void 0||!!i.is_archived===r).filter(i=>a===void 0||i.recurring_interval!=null===a).filter(i=>s===""||String(i.name).toLowerCase().includes(s)).filter(i=>t.params.benefit_id===void 0||(i.benefit_ids??[]).includes(String(t.params.benefit_id))).sort((i,c)=>String(c.created_at).localeCompare(String(i.created_at)));return t.list("Product",n.map(i=>L(t,i)))}async function Ne(t){let e=q(t);if(typeof e.order_id!="string"||!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e.order_id))return m(["order_id"],"Input should be a valid UUID version 4.");if(!Number.isSafeInteger(e.amount)||Number(e.amount)<1)return m(["amount"],"Amount must be a positive integer.");if(!["duplicate","fraudulent","customer_request","service_disruption","satisfaction_guarantee","other"].includes(String(e.reason)))return m(["reason"],"Choose a documented refund reason.");if(e.revoke_benefits!==void 0&&typeof e.revoke_benefits!="boolean")return m(["revoke_benefits"],"Input should be a valid boolean.");if(e.comment!=null&&typeof e.comment!="string")return m(["comment"],"Input should be a valid string.");let r=e.metadata??{};if(typeof r!="object"||Array.isArray(r)||Object.keys(r).length>50||Object.entries(r).some(([o,l])=>o.length<1||o.length>40||!["string","number","boolean"].includes(typeof l)||typeof l=="string"&&(l.length<1||l.length>500)))return m(["metadata"],"Invalid refund metadata.");let a=d(t,R,e.order_id);if(!a)return m(["order_id"],"Order does not exist.");if(e.revoke_benefits===!0&&a.subscription_id!=null)return m(["revoke_benefits"],"Subscription benefits are revoked by canceling the subscription.");let s=Number(e.amount),n,i=!1;if(await t.change("Order",e.order_id,o=>{if(o.status==="refunded"){n=M(403,"RefundedAlready","Order is already fully refunded.");return}if(!["paid","partially_refunded"].includes(String(o.status))){n=m(["order_id"],"Only a paid order can be refunded.");return}let l=Number(o.refunded_amount??0)+s,h=Number(o.total_amount);if(l>h){n=m(["amount"],"Amount exceeds the remaining refundable balance.");return}let _=l===h?"refunded":"partially_refunded";return t.legal("Order","status","refunds:create",o.status,_,e.order_id,"api"),i=!0,{status:_,refunded_amount:l,refundable_amount:h-l,modified_at:t.occurredAt}},"order.refund"),!i)return n??m(["order_id"],"Order is unavailable.");let c=await t.create("_refund",o=>({id:o,created_at:t.occurredAt,modified_at:t.occurredAt,metadata:r,status:"succeeded",reason:e.reason,amount:s,tax_amount:0,currency:a.currency,organization_id:O(t),order_id:a.id,subscription_id:a.subscription_id??null,customer_id:a.customer_id,revoke_benefits:e.revoke_benefits??!1,dispute:null,_environment:p(t),_comment:e.comment??null}),"refund.create");return Response.json(I(t,c),{status:201})}async function $e(t){let e=d(t,y,String(t.call.params.id));return e?Response.json(W(t,e)):P("Subscription")}async function Ue(t){let e=t.params.external_customer_id===void 0?void 0:[].concat(t.params.external_customer_id).map(s=>String(w(t,{external:String(s)})?.id)),r=t.params.active===void 0?void 0:String(t.params.active)==="true",a=u(t,y).filter(s=>C(t,"customer_id",s.customer_id)&&C(t,"product_id",s.product_id)&&C(t,"status",s.status)).filter(s=>e===void 0||e.includes(String(s.customer_id))).filter(s=>r===void 0||["trialing","active","past_due"].includes(String(s.status))===r).sort(T("started_at"));return t.list("Subscription",a.map(s=>W(t,s)))}async function Fe(t){let e=d(t,y,String(t.call.params.id));if(!e)return P("Subscription");let r=q(t);if(typeof r.cancel_at_period_end!="boolean")return g("cancel_at_period_end");let a=r.cancel_at_period_end,s=t.legal("Subscription","status","subscriptions:update",e.status,void 0,String(e.id),"api");if(s)return t.refuse(s);if(a&&e.cancel_at_period_end===!0)return M(403,"AlreadyCanceledSubscription","Subscription is already canceled or will be at the end of the period, or is not active.");let n=t.occurredAt;return await t.write(y,String(e.id),a?{cancel_at_period_end:!0,canceled_at:n,ends_at:e.current_period_end,modified_at:n}:{cancel_at_period_end:!1,canceled_at:null,ends_at:null,modified_at:n},"subscription.update"),Response.json(W(t,d(t,y,String(e.id))))}var Ct=["raw","discord","slack"];async function Be(t){let e=q(t);if(typeof e.url!="string"||e.url==="")return g("url");if(!/^https?:\/\/[^\s]+$/.test(e.url))return m(["url"],"Input should be a valid URL","url_parsing");if(e.format===void 0)return g("format");if(!Ct.includes(String(e.format)))return m(["format"],"Input should be 'raw', 'discord' or 'slack'","enum");if(!Array.isArray(e.events))return g("events");if(e.api_version!==void 0&&!["2026-04","2026-10"].includes(String(e.api_version)))return m(["api_version"],"Input should be '2026-04' or '2026-10'","enum");let r=E(t,se),a=await A(t,"polar_whs_",`endpoint:${r}`),s={created_at:t.occurredAt,modified_at:null,id:r,url:e.url,name:e.name??null,format:e.format,secret:a,organization_id:O(t),events:e.events,enabled:!0,api_version:e.api_version??"2026-10",uses_standard_webhook_signature:!1};return await t.write(se,r,{...s,_environment:p(t)},"webhook_endpoint.create"),Response.json(s,{status:201})}var We={"checkouts:client_confirm":ae,"checkouts:client_get":re,"checkouts:create":Pe,"checkouts:get":Oe,"checkouts:list":xe,"customer-sessions:create":Re,"customers:create":je,"customers:get":ze,"customers:get_state_external":Me,"customers:list":Ae,"events:ingest":be,"events:list":ge,"orders:get":Te,"orders:list":Ie,"products:create":Le,"products:list":De,"refunds:create":Ne,"subscriptions:get":$e,"subscriptions:list":Ue,"subscriptions:update":Fe,"webhooks:create_webhook_endpoint":Be};var z=t=>String(t??"").replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]);async function Ve(t){let e=String(t.call.params.client_secret),r=new URL(t.call.request.url).pathname.replace(/\/+$/,"").endsWith("/pay"),a=t.publicBase.replace(/\/+$/,""),s=await re(t);if(!s.ok)return new Response("This checkout does not exist.",{status:404,headers:{"content-type":"text/plain; charset=utf-8"}});let n=await s.json();if(r&&t.call.request.method==="POST"){let l=new URLSearchParams(t.text),h=await ae({...t,body:{customer_email:l.get("email")||n.customer_email,confirmation_token_id:await t.secret(`test-stripe-confirmation:${n.id}`)}});return h.ok?new Response(null,{status:303,headers:{location:n.success_url.replace("{CHECKOUT_ID}",n.id)}}):new Response(`The payment could not be completed (${h.status}).`,{status:h.status,headers:{"content-type":"text/plain; charset=utf-8"}})}let i=`$${(Number(n.amount)/100).toFixed(2)}`,c=n.product?.recurring_interval?` / ${n.product.recurring_interval}`:"",o=n.status!=="open"?`<p>This checkout is ${z(n.status)}.</p>`:`<form method="post" action="${z(a)}/${z(e)}/pay"><label>Email<input name="email" type="email" required value="${z(n.customer_email)}"></label><label>Card<input value="4242 4242 4242 4242" readonly></label><button type="submit">Pay ${z(i)}${z(c)}</button></form>`;return new Response(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Checkout</title><style>body{font:16px/1.5 system-ui,sans-serif;background:#f7f7f8;margin:0}main{max-width:440px;margin:48px auto;background:#fff;border:1px solid #e5e5e8;border-radius:12px;padding:28px}h1{font-size:20px;margin:0}p.price{font-size:30px;font-weight:600;margin:10px 0 20px}label{display:block;font-size:13px;color:#555;margin:12px 0}input{display:block;width:100%;box-sizing:border-box;padding:9px;border:1px solid #ccc;border-radius:8px;font:inherit;margin-top:4px}button{margin-top:16px;width:100%;padding:11px;border:0;border-radius:8px;background:#0062ff;color:#fff;font:inherit;cursor:pointer}</style></head><body><main><h1>${z(n.product?.name??"Checkout")}</h1><p class="price">${z(i)}<small>${z(c)}</small></p>${o}</main></body></html>`,{headers:{"content-type":"text/html; charset=utf-8"}})}var V=t=>String(t??"").replace(/[&<>"]/g,e=>({"&":"&","<":"<",">":">",'"':"""})[e]);async function Ke(t){let e=new URL(t.call.request.url).searchParams.get("customer_session_token"),r=u(t,G).find(o=>o.token===e&&String(o.expires_at)>t.occurredAt);if(!r)return new Response("Unauthorized",{status:401});let a=d(t,b,String(r.customer_id));if(!a)return new Response("Customer not found",{status:404});let s=u(t,y).filter(o=>o.customer_id===a.id&&["active","trialing"].includes(String(o.status))),n=u(t,R).filter(o=>o.customer_id===a.id).sort((o,l)=>String(l.created_at).localeCompare(String(o.created_at))),i=s.map(o=>`<li>${V(L(t,d(t,S,String(o.product_id))).name)}: ${V(o.status)}</li>`).join(""),c=n.map(o=>{let l=N(t,o);return`<li>${V(l.invoice_number)} \u2014 ${V(l.currency)} ${(Number(l.total_amount)/100).toFixed(2)}</li>`}).join("");return new Response(`<!doctype html><html lang="en"><title>Customer portal</title><main><h1>Billing for ${V(x(t,a).email)}</h1><h2>Subscriptions</h2><ul>${i||"<li>No active subscriptions</li>"}</ul><h2>Purchase history</h2><ul>${c||"<li>No purchases</li>"}</ul><a href="${V(r.return_url)}">Return to the application</a></main></html>`,{headers:{"content-type":"text/html; charset=utf-8"}})}function ue(t={}){return xt({manifest:ee,surface:te,handlers:We,doors:oe,around:we,clock:ke,tenant:Se,screens:{checkout:Ve,portal:Ke}},t)}import{serveHttp as qr}from"../../engine/v3/volter_world-core.mjs";var Er=jt(Rt(ee,te));export{ue as createTwinFetch};
|