diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30c3bc584b..db2b37e6ed 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,6 +28,7 @@ jobs: gcp: ${{ steps.force.outputs.all || steps.changes.outputs.gcp }} neon: ${{ steps.force.outputs.all || steps.changes.outputs.neon }} planetscale: ${{ steps.force.outputs.all || steps.changes.outputs.planetscale }} + polar: ${{ steps.force.outputs.all || steps.changes.outputs.polar }} prisma-postgres: ${{ steps.force.outputs.all || steps.changes.outputs.prisma-postgres }} stripe: ${{ steps.force.outputs.all || steps.changes.outputs.stripe }} supabase: ${{ steps.force.outputs.all || steps.changes.outputs.supabase }} @@ -68,6 +69,9 @@ jobs: planetscale: - 'packages/planetscale/**' - 'packages/core/**' + polar: + - 'packages/polar/**' + - 'packages/core/**' prisma-postgres: - 'packages/prisma-postgres/**' - 'packages/core/**' @@ -124,6 +128,27 @@ jobs: - run: bun run check working-directory: packages/core + ci-polar: + needs: detect-changes + if: needs.detect-changes.outputs.polar == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - run: bun install --frozen-lockfile + - run: bun run build + working-directory: packages/core + - run: bun run check + working-directory: packages/polar + # Live tests are gated on a Polar sandbox token; they skip without it. + - run: bun run test + working-directory: packages/polar + env: + POLAR_ACCESS_TOKEN: ${{ secrets.POLAR_ACCESS_TOKEN }} + POLAR_SERVER: sandbox + ci-aws: needs: detect-changes if: needs.detect-changes.outputs.aws == 'true' diff --git a/AGENTS.md b/AGENTS.md index 710c196248..9a7befcc18 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,6 +16,7 @@ distilled/ │ ├── mongodb-atlas/ # @distilled.cloud/mongodb-atlas — MongoDB Atlas SDK from OpenAPI spec │ ├── neon/ # @distilled.cloud/neon — Neon SDK from OpenAPI spec │ ├── planetscale/ # @distilled.cloud/planetscale — PlanetScale SDK from OpenAPI spec +│ ├── polar/ # @distilled.cloud/polar — Polar billing SDK from OpenAPI spec │ ├── prisma-postgres/ # @distilled.cloud/prisma-postgres — Prisma Postgres SDK from OpenAPI spec │ ├── stripe/ # @distilled.cloud/stripe — Stripe SDK from OpenAPI spec │ ├── supabase/ # @distilled.cloud/supabase — Supabase SDK from OpenAPI spec diff --git a/README.md b/README.md index a6207ab6a7..e910f46f95 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ For larger SDKs its very likely you hit 5hr limits on claude, you can just run t | [`@distilled.cloud/mongodb-atlas`](./packages/mongodb-atlas) | MongoDB Atlas SDK from OpenAPI spec | | [`@distilled.cloud/neon`](./packages/neon) | Neon serverless Postgres SDK from OpenAPI spec | | [`@distilled.cloud/planetscale`](./packages/planetscale) | PlanetScale MySQL SDK from OpenAPI spec | +| [`@distilled.cloud/polar`](./packages/polar) | Polar billing SDK from OpenAPI spec (products, subscriptions, meters, events, checkouts) | | [`@distilled.cloud/prisma-postgres`](./packages/prisma-postgres) | Prisma Postgres SDK from OpenAPI spec | | [`@distilled.cloud/stripe`](./packages/stripe) | Stripe SDK from OpenAPI spec | | [`@distilled.cloud/supabase`](./packages/supabase) | Supabase Management API SDK from OpenAPI spec | diff --git a/bun.lock b/bun.lock index 0444956dc0..7580268054 100644 --- a/bun.lock +++ b/bun.lock @@ -245,6 +245,22 @@ "effect": "catalog:", }, }, + "packages/polar": { + "name": "@distilled.cloud/polar", + "version": "0.0.0", + "dependencies": { + "@distilled.cloud/core": "workspace:*", + }, + "devDependencies": { + "@types/bun": "catalog:", + "@types/node": "catalog:", + "dotenv": "catalog:", + "vitest": "catalog:", + }, + "peerDependencies": { + "effect": "catalog:", + }, + }, "packages/posthog": { "name": "@distilled.cloud/posthog", "version": "0.28.2", @@ -494,6 +510,8 @@ "@distilled.cloud/planetscale": ["@distilled.cloud/planetscale@workspace:packages/planetscale"], + "@distilled.cloud/polar": ["@distilled.cloud/polar@workspace:packages/polar"], + "@distilled.cloud/posthog": ["@distilled.cloud/posthog@workspace:packages/posthog"], "@distilled.cloud/prisma-postgres": ["@distilled.cloud/prisma-postgres@workspace:packages/prisma-postgres"], diff --git a/packages/core/scripts/generate-openapi.ts b/packages/core/scripts/generate-openapi.ts index 3a38755b58..28c790f50b 100644 --- a/packages/core/scripts/generate-openapi.ts +++ b/packages/core/scripts/generate-openapi.ts @@ -1385,7 +1385,12 @@ function generateInputSchema3( } if (bodyContent?.schema) { let bodySchema = bodyContent.schema; - if (bodySchema.$ref) { + // Unwrap chained `$ref`s (e.g. Polar's `CheckoutCreate` → `$ref` + // `CheckoutProductsCreate`). Resolving only once leaves a bare-ref + // schema with no `properties`/`oneOf`, degenerating to an empty body. + const seenBodyRefs = new Set(); + while (bodySchema.$ref && !seenBodyRefs.has(bodySchema.$ref)) { + seenBodyRefs.add(bodySchema.$ref); bodySchema = resolveRef(spec, bodySchema.$ref); } @@ -1416,6 +1421,53 @@ function generateInputSchema3( }; } + // Flatten a top-level `oneOf`/`anyOf` request body — a discriminated + // union like Polar's `CustomerCreate` / `ProductCreate` — into a single + // permissive struct: the union of every branch's properties, marking a + // field required only when it is required in EVERY branch (so a shared + // field like `name` stays required while variant-only fields like + // `email` / `recurring_interval` become optional). Without this a union + // body has no `.properties` and degenerates to an EMPTY input schema — + // the operation compiles but can never send its body. + const bodyBranches = bodySchema.oneOf ?? bodySchema.anyOf; + if (!bodySchema.properties && bodyBranches && bodyBranches.length > 0) { + const mergedProps: Record = {}; + const requiredSets: Set[] = []; + for (const branch of bodyBranches) { + const resolved = branch.$ref + ? (resolveRef(spec, branch.$ref) as SchemaObject) + : branch; + const branchProps: Record = { + ...resolved.properties, + }; + const branchRequired: string[] = [...(resolved.required ?? [])]; + // A branch may itself be an `allOf` — merge those props too. + for (const sub of resolved.allOf ?? []) { + const resolvedSub = sub.$ref + ? (resolveRef(spec, sub.$ref) as SchemaObject) + : sub; + if (resolvedSub.properties) { + Object.assign(branchProps, resolvedSub.properties); + } + if (resolvedSub.required) { + branchRequired.push(...resolvedSub.required); + } + } + Object.assign(mergedProps, branchProps); + requiredSets.push(new Set(branchRequired)); + } + // Required only where required in every branch (intersection). + const requiredEverywhere = Object.keys(mergedProps).filter((key) => + requiredSets.every((set) => set.has(key)), + ); + bodySchema = { + ...bodySchema, + type: "object", + properties: mergedProps, + required: requiredEverywhere, + }; + } + if (bodySchema.properties) { const required = new Set(bodySchema.required || []); for (const [key, value] of Object.entries(bodySchema.properties)) { diff --git a/packages/polar/README.md b/packages/polar/README.md new file mode 100644 index 0000000000..c1c98171db --- /dev/null +++ b/packages/polar/README.md @@ -0,0 +1,60 @@ +# @distilled.cloud/polar + +Effect-native [Polar](https://polar.sh) billing SDK, generated from the [Polar OpenAPI spec](https://api.polar.sh/openapi.json). Products, prices, subscriptions, customers, meters, events, checkouts, and benefits with exhaustive error typing, retry policies, and streaming pagination. + +## Installation + +```bash +npm install @distilled.cloud/polar effect +``` + +## Quick Start + +```typescript +import { Effect, Layer } from "effect"; +import * as Stream from "effect/Stream"; +import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient"; +import { CredentialsFromEnv } from "@distilled.cloud/polar"; +import { organizationslist } from "@distilled.cloud/polar"; + +const PolarLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv); + +const program = organizationslist({ limit: 20 }).pipe(Effect.provide(PolarLive)); +``` + +Errors are typed and matchable: + +```typescript +import { subscriptionsget } from "@distilled.cloud/polar"; + +subscriptionsget({ id }).pipe( + Effect.catch("NotFound", () => Effect.succeed(null)), +); +``` + +## Configuration + +```bash +POLAR_ACCESS_TOKEN=polar_pat_... # Personal or Organization Access Token +POLAR_SERVER=production # or "sandbox" (default: production) +POLAR_BASE_URL=... # optional, overrides POLAR_SERVER +``` + +Create a token in the [Polar dashboard](https://polar.sh/settings) under **Developers**. Or build credentials directly: + +```typescript +import { layer } from "@distilled.cloud/polar"; + +const creds = layer({ accessToken: token, server: "sandbox" }); +``` + +## Regenerating + +```bash +bun run specs:update # refresh specs/openapi.json from api.polar.sh +bun run generate # regenerate src/operations from the spec +``` + +## License + +Apache-2.0 diff --git a/packages/polar/package.json b/packages/polar/package.json new file mode 100644 index 0000000000..1e75e470fa --- /dev/null +++ b/packages/polar/package.json @@ -0,0 +1,89 @@ +{ + "name": "@distilled.cloud/polar", + "version": "0.0.0", + "repository": { + "type": "git", + "url": "https://github.com/alchemy-run/distilled", + "directory": "packages/polar" + }, + "license": "Apache-2.0", + "type": "module", + "sideEffects": false, + "module": "src/index.ts", + "files": [ + "lib", + "src" + ], + "exports": { + ".": { + "types": "./lib/index.d.ts", + "bun": "./src/index.ts", + "default": "./lib/index.js" + }, + "./Category": { + "types": "./lib/category.d.ts", + "bun": "./src/category.ts", + "default": "./lib/category.js" + }, + "./Client": { + "types": "./lib/client.d.ts", + "bun": "./src/client.ts", + "default": "./lib/client.js" + }, + "./Credentials": { + "types": "./lib/credentials.d.ts", + "bun": "./src/credentials.ts", + "default": "./lib/credentials.js" + }, + "./Errors": { + "types": "./lib/errors.d.ts", + "bun": "./src/errors.ts", + "default": "./lib/errors.js" + }, + "./Operations": { + "types": "./lib/operations/index.d.ts", + "bun": "./src/operations/index.ts", + "default": "./lib/operations/index.js" + }, + "./Retry": { + "types": "./lib/retry.d.ts", + "bun": "./src/retry.ts", + "default": "./lib/retry.js" + }, + "./Sensitive": { + "types": "./lib/sensitive.d.ts", + "bun": "./src/sensitive.ts", + "default": "./lib/sensitive.js" + }, + "./Traits": { + "types": "./lib/traits.d.ts", + "bun": "./src/traits.ts", + "default": "./lib/traits.js" + } + }, + "scripts": { + "typecheck": "tsc", + "build": "tsc -b", + "fmt": "oxfmt --write src", + "lint": "oxlint --fix src", + "check": "tsc && oxlint src && oxfmt --check src", + "nuke": "bun scripts/nuke.ts", + "test": "bunx vitest run test --exclude specs --passWithNoTests", + "publish:npm": "bun run build && bun publish --access public", + "generate": "bun run scripts/generate.ts && oxlint --fix src && oxfmt --write src && oxfmt --write src", + "specs:fetch": "curl -sSL https://api.polar.sh/openapi.json -o specs/openapi.json", + "specs:update": "curl -sSL https://api.polar.sh/openapi.json -o specs/openapi.json" + }, + "dependencies": { + "@distilled.cloud/core": "workspace:*" + }, + "devDependencies": { + "@types/bun": "catalog:", + "@types/node": "catalog:", + "dotenv": "catalog:", + "vitest": "catalog:" + }, + "peerDependencies": { + "effect": "catalog:" + } +} diff --git a/packages/polar/scripts/generate.ts b/packages/polar/scripts/generate.ts new file mode 100644 index 0000000000..6061daf7f9 --- /dev/null +++ b/packages/polar/scripts/generate.ts @@ -0,0 +1,23 @@ +/** + * Polar SDK Code Generator + * + * Uses the shared OpenAPI generator from sdk-core to generate operations from + * the Polar OpenAPI 3.1 spec (https://api.polar.sh/openapi.json). + */ +import * as path from "path"; +import { generateFromOpenAPI } from "@distilled.cloud/core/openapi/generate"; + +const rootDir = path.join(import.meta.dir, ".."); + +generateFromOpenAPI({ + specPath: path.join(rootDir, "specs/openapi.json"), + patchDir: path.join(rootDir, "patches"), + outputDir: path.join(rootDir, "src/operations"), + importPrefix: "..", + clientImport: "../client", + traitsImport: "../traits", + sensitiveImport: "../sensitive", + errorsImport: "../errors", + includeOperationErrors: false, + skipDeprecated: true, +}); diff --git a/packages/polar/scripts/nuke.ts b/packages/polar/scripts/nuke.ts new file mode 100644 index 0000000000..f53837c0a0 --- /dev/null +++ b/packages/polar/scripts/nuke.ts @@ -0,0 +1,314 @@ +#!/usr/bin/env bun +/** + * Polar Nuke Script + * + * Lists and deletes/archives all resources in a Polar account — intended for + * cleaning up test resources. Supports `--dry-run` to preview without acting. + * + * SAFETY: Polar holds real billing data, so this refuses to run against + * production unless `--allow-production` is passed. Point it at the sandbox + * (`POLAR_SERVER=sandbox`) for normal test cleanup. An optional + * `nuke-config.json` (same shape as the other SDKs) excludes resources by id + * or name glob. + * + * Usage: + * POLAR_SERVER=sandbox bun packages/polar/scripts/nuke.ts --dry-run + * POLAR_SERVER=sandbox bun packages/polar/scripts/nuke.ts + */ +import { config } from "dotenv"; +import * as fs from "node:fs"; +import * as nodePath from "node:path"; + +// Load .env from repo root (three levels up from scripts/), then CWD as fallback. +config({ path: nodePath.resolve(import.meta.dir, "../../../.env") }); +config(); + +import { BunRuntime, BunServices } from "@effect/platform-bun"; +import { Console, Effect } from "effect"; +import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient"; +import { Command, Flag } from "effect/unstable/cli"; +import { CredentialsFromEnv } from "../src/credentials.ts"; +import { productslist } from "../src/operations/productslist.ts"; +import { productsupdate } from "../src/operations/productsupdate.ts"; +import { discountslist } from "../src/operations/discountslist.ts"; +import { discountsdelete } from "../src/operations/discountsdelete.ts"; +import { benefitslist } from "../src/operations/benefitslist.ts"; +import { benefitsdelete } from "../src/operations/benefitsdelete.ts"; +import { customerslist } from "../src/operations/customerslist.ts"; +import { customersdelete } from "../src/operations/customersdelete.ts"; + +// ANSI colors +const RED = "\x1b[31m"; +const GREEN = "\x1b[32m"; +const YELLOW = "\x1b[33m"; +const CYAN = "\x1b[36m"; +const BOLD = "\x1b[1m"; +const DIM = "\x1b[2m"; +const RESET = "\x1b[0m"; + +// Counters +let totalFound = 0; +let totalSkipped = 0; +let totalDeleted = 0; +let totalFailed = 0; + +// ============================================================================ +// Nuke Config (exclusions) +// ============================================================================ + +interface ExcludeRule { + type: string; + ids?: string[]; + namePatterns?: string[]; + reason?: string; +} + +interface NukeConfig { + exclude?: ExcludeRule[]; +} + +const PKG_DIR = nodePath.resolve(import.meta.dir, ".."); + +const loadNukeConfig = (): NukeConfig => { + const p = nodePath.join(PKG_DIR, "nuke-config.json"); + if (!fs.existsSync(p)) return {}; + return JSON.parse(fs.readFileSync(p, "utf-8")); +}; + +const matchGlob = (pattern: string, value: string): boolean => + new RegExp("^" + pattern.replace(/\*/g, ".*") + "$").test(value); + +const isExcluded = ( + cfg: NukeConfig, + type: string, + id: string, + name?: string, +): ExcludeRule | undefined => + cfg.exclude?.find((rule) => { + if (rule.type !== type) return false; + if (rule.ids?.includes(id)) return true; + if (name && rule.namePatterns?.some((p) => matchGlob(p, name))) return true; + return false; + }); + +// ============================================================================ +// Pagination +// ============================================================================ + +interface ListItem { + id: string; + name?: string; + is_archived?: boolean; +} + +interface ListPage { + items?: ReadonlyArray; + pagination?: { max_page?: number }; +} + +/** Page through a Polar list endpoint (100 per page) and collect every item. */ +const listAll = ( + listOp: (input: { + page?: number; + limit?: number; + }) => Effect.Effect, +) => + Effect.gen(function* () { + const all: ListItem[] = []; + let page = 1; + while (true) { + const result = (yield* listOp({ page, limit: 100 })) as ListPage; + const items = result.items ?? []; + all.push(...items); + const maxPage = result.pagination?.max_page ?? page; + if (items.length === 0 || page >= maxPage) break; + page += 1; + } + return all; + }); + +// ============================================================================ +// Resource sweeps +// ============================================================================ + +/** + * Sweep a deletable resource: list every item, skip excluded ones, then delete + * (or archive, for products which cannot be deleted). + */ +const sweep = ( + label: string, + type: string, + dryRun: boolean, + cfg: NukeConfig, + listOp: (input: { + page?: number; + limit?: number; + }) => Effect.Effect, + act: (item: ListItem) => Effect.Effect, + actVerb = "DELETE", +) => + Effect.gen(function* () { + yield* Console.log(`\n ${BOLD}${CYAN}${label}${RESET}`); + const items = yield* listAll(listOp).pipe( + Effect.catch(() => + Console.log(` ${RED}Failed to list ${label}${RESET}`).pipe( + Effect.as([] as ListItem[]), + ), + ), + ); + if (items.length === 0) { + yield* Console.log(` ${DIM}None found${RESET}`); + return; + } + for (const item of items) { + const name = item.name ?? "unnamed"; + totalFound++; + const excluded = isExcluded(cfg, type, item.id, item.name); + if (excluded) { + totalSkipped++; + yield* Console.log( + ` ${YELLOW}[SKIP]${RESET} ${name} ${DIM}(${item.id})${RESET} — ${excluded.reason ?? "excluded"}`, + ); + continue; + } + yield* Console.log( + ` ${RED}[${actVerb}]${RESET} ${name} ${DIM}(${item.id})${RESET}`, + ); + if (!dryRun) { + yield* act(item).pipe( + Effect.andThen(() => { + totalDeleted++; + }), + Effect.catch(() => { + totalFailed++; + return Console.log(` ${RED}Failed on ${name}${RESET}`); + }), + ); + } + } + }); + +// ============================================================================ +// Command +// ============================================================================ + +const nuke = Command.make( + "nuke", + { + dryRun: Flag.boolean("dry-run").pipe( + Flag.withDescription("Only list resources without deleting them"), + Flag.withDefault(false), + ), + allowProduction: Flag.boolean("allow-production").pipe( + Flag.withDescription( + "Permit running against the PRODUCTION Polar account", + ), + Flag.withDefault(false), + ), + }, + (opts) => + Effect.gen(function* () { + const server = process.env.POLAR_SERVER ?? "production"; + const isProduction = + server === "production" && + !(process.env.POLAR_BASE_URL ?? "").includes("sandbox"); + if (isProduction && !opts.allowProduction) { + yield* Console.log( + `${RED}${BOLD}Refusing to nuke the PRODUCTION Polar account.${RESET}\n` + + `Set ${BOLD}POLAR_SERVER=sandbox${RESET} for test cleanup, or pass ` + + `${BOLD}--allow-production${RESET} to override.`, + ); + return; + } + + const cfg = loadNukeConfig(); + yield* Console.log( + `${BOLD}Polar Nuke${RESET} ${DIM}(server: ${server}${opts.dryRun ? ", dry-run" : ""})${RESET}`, + ); + if (cfg.exclude?.length) { + yield* Console.log( + `${DIM}Loaded ${cfg.exclude.length} exclusion rule(s)${RESET}`, + ); + } + + // Products cannot be deleted — archive any that are still active. + yield* sweep( + "Products", + "Product", + opts.dryRun, + cfg, + (input) => + productslist(input) as Effect.Effect, + (item) => + productsupdate({ id: item.id, is_archived: true }) as Effect.Effect< + unknown, + unknown, + never + >, + "ARCHIVE", + ); + yield* sweep( + "Discounts", + "Discount", + opts.dryRun, + cfg, + (input) => + discountslist(input) as Effect.Effect, + (item) => + discountsdelete({ id: item.id }) as Effect.Effect< + unknown, + unknown, + never + >, + ); + yield* sweep( + "Benefits", + "Benefit", + opts.dryRun, + cfg, + (input) => + benefitslist(input) as Effect.Effect, + (item) => + benefitsdelete({ id: item.id }) as Effect.Effect< + unknown, + unknown, + never + >, + ); + yield* sweep( + "Customers", + "Customer", + opts.dryRun, + cfg, + (input) => + customerslist(input) as Effect.Effect, + (item) => + customersdelete({ id: item.id }) as Effect.Effect< + unknown, + unknown, + never + >, + ); + + yield* Console.log(`\n${BOLD}Summary${RESET}`); + yield* Console.log(` Total found: ${totalFound}`); + yield* Console.log(` ${YELLOW}Skipped: ${totalSkipped}${RESET}`); + if (!opts.dryRun) { + yield* Console.log(` ${GREEN}Actioned: ${totalDeleted}${RESET}`); + if (totalFailed > 0) { + yield* Console.log(` ${RED}Failed: ${totalFailed}${RESET}`); + } + } + }).pipe( + Effect.provide(CredentialsFromEnv), + Effect.provide(FetchHttpClient.layer), + ), +).pipe(Command.withDescription("List and delete/archive all Polar resources")); + +// ============================================================================ +// Entry Point +// ============================================================================ + +BunRuntime.runMain( + Effect.provide(Command.run(nuke, { version: "1.0.0" }), BunServices.layer), +); diff --git a/packages/polar/specs/openapi.json b/packages/polar/specs/openapi.json new file mode 100644 index 0000000000..aee2df7c22 --- /dev/null +++ b/packages/polar/specs/openapi.json @@ -0,0 +1 @@ +{"openapi":"3.1.0","info":{"title":"Polar API","summary":"Polar HTTP and Webhooks API","description":"Read the docs at https://polar.sh/docs/api-reference","version":"2026-04"},"servers":[{"url":"https://api.polar.sh","description":"Production environment","x-speakeasy-server-id":"production","x-polar-environment":"production"},{"url":"https://sandbox-api.polar.sh","description":"Sandbox environment","x-speakeasy-server-id":"sandbox","x-polar-environment":"sandbox"}],"paths":{"/v1/organizations/":{"get":{"tags":["organizations","public"],"summary":"List Organizations","description":"List organizations.\n\n**Scopes**: `organizations:read` `organizations:write`","operationId":"organizations:list","security":[{"oidc":["organizations:read","organizations:write"]},{"pat":["organizations:read","organizations:write"]},{"oat":["organizations:read","organizations:write"]}],"parameters":[{"name":"slug","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by slug.","title":"Slug"},"description":"Filter by slug."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OrganizationSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Organization_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"organizations","x-speakeasy-name-override":"list_organizations","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Organization"}}},"post":{"tags":["organizations","public"],"summary":"Create Organization","description":"Create an organization.\n\n**Scopes**: `organizations:write`","operationId":"organizations:create","security":[{"oidc":["organizations:write"]},{"pat":["organizations:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreate"}}}},"responses":{"201":{"description":"Organization created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CannotCreateOrganizationError"}}},"description":"Forbidden"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["User"],"x-speakeasy-group":"organizations","x-speakeasy-name-override":"create"}},"/v1/organizations/{id}":{"get":{"tags":["organizations","public"],"summary":"Get Organization","description":"Get an organization by ID.\n\n**Scopes**: `organizations:read` `organizations:write`","operationId":"organizations:get","security":[{"oidc":["organizations:read","organizations:write"]},{"pat":["organizations:read","organizations:write"]},{"oat":["organizations:read","organizations:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID.","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"404":{"description":"Organization not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"organizations","x-speakeasy-name-override":"get"},"patch":{"tags":["organizations","public"],"summary":"Update Organization","description":"Update an organization.\n\n**Scopes**: `organizations:write`","operationId":"organizations:update","security":[{"oidc":["organizations:write"]},{"pat":["organizations:write"]},{"oat":["organizations:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID.","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationUpdate"}}}},"responses":{"200":{"description":"Organization updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}},"403":{"description":"You don't have the permission to update this organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Organization not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"Cannot enforce SSO without an enabled connection.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SSOEnforcementRequiresConnection"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"organizations","x-speakeasy-name-override":"update"}},"/v1/subscriptions/":{"get":{"tags":["subscriptions","public"],"summary":"List Subscriptions","description":"List subscriptions.\n\n**Scopes**: `subscriptions:read` `subscriptions:write`","operationId":"subscriptions:list","security":[{"oidc":["subscriptions:read","subscriptions:write"]},{"pat":["subscriptions:read","subscriptions:write"]},{"oat":["subscriptions:read","subscriptions:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","description":"The customer external ID."},{"type":"array","items":{"type":"string","description":"The customer external ID."}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by customer external ID."},"description":"Filter by customer external ID."},{"name":"discount_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"DiscountID Filter","description":"Filter by discount ID."},"description":"Filter by discount ID."},{"name":"active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by active or inactive subscription.","deprecated":true,"title":"Active"},"description":"Filter by active or inactive subscription.","deprecated":true},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionStatus"},{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionStatus"}},{"type":"null"}],"title":"Status Filter","description":"Filter by subscription status."},"description":"Filter by subscription status."},{"name":"cancel_at_period_end","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by subscriptions that are set to cancel at period end.","title":"Cancel At Period End"},"description":"Filter by subscriptions that are set to cancel at period end."},{"name":"customer_cancellation_reason","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"array","items":{"$ref":"#/components/schemas/CustomerCancellationReason"}},{"type":"null"}],"title":"CustomerCancellationReason Filter","description":"Filter by customer cancellation reason."},"description":"Filter by customer cancellation reason."},{"name":"canceled_at_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter by cancellation date (after or equal to).","title":"Canceled At After"},"description":"Filter by cancellation date (after or equal to)."},{"name":"canceled_at_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter by cancellation date (before or equal to).","title":"Canceled At Before"},"description":"Filter by cancellation date (before or equal to)."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-started_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Subscription_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"subscriptions","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Subscription"}}},"post":{"tags":["subscriptions","public"],"summary":"Create Subscription","description":"Create a subscription programmatically.\n\nThis endpoint only allows to create subscription on free products.\nFor paid products, use the checkout flow.\n\nNo initial order will be created and no confirmation email will be sent.\n\n**Scopes**: `subscriptions:write`","operationId":"subscriptions:create","security":[{"oidc":["subscriptions:write"]},{"pat":["subscriptions:write"]},{"oat":["subscriptions:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionCreateCustomer"},{"$ref":"#/components/schemas/SubscriptionCreateExternalCustomer"}],"title":"Subscription Create"}}}},"responses":{"201":{"description":"Subscription created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"subscriptions","x-speakeasy-name-override":"create"}},"/v1/subscriptions/export":{"get":{"tags":["subscriptions","public"],"summary":"Export Subscriptions","description":"Export subscriptions as a CSV file.\n\n**Scopes**: `subscriptions:read` `subscriptions:write`","operationId":"subscriptions:export","security":[{"oidc":["subscriptions:read","subscriptions:write"]},{"pat":["subscriptions:read","subscriptions:write"]},{"oat":["subscriptions:read","subscriptions:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"description":"Filter by organization ID.","title":"Organization Id"},"description":"Filter by organization ID."}],"responses":{"200":{"description":"Successful Response","content":{"text/csv":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"subscriptions","x-speakeasy-name-override":"export"}},"/v1/subscriptions/{id}":{"get":{"tags":["subscriptions","public"],"summary":"Get Subscription","description":"Get a subscription by ID.\n\n**Scopes**: `subscriptions:read` `subscriptions:write`","operationId":"subscriptions:get","security":[{"oidc":["subscriptions:read","subscriptions:write"]},{"pat":["subscriptions:read","subscriptions:write"]},{"oat":["subscriptions:read","subscriptions:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The subscription ID.","title":"Id"},"description":"The subscription ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"404":{"description":"Subscription not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"subscriptions","x-speakeasy-name-override":"get"},"patch":{"tags":["subscriptions","public"],"summary":"Update Subscription","description":"Update a subscription.\n\n**Scopes**: `subscriptions:write`","operationId":"subscriptions:update","security":[{"oidc":["subscriptions:write"]},{"pat":["subscriptions:write"]},{"oat":["subscriptions:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The subscription ID.","title":"Id"},"description":"The subscription ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionUpdate"}}}},"responses":{"200":{"description":"Subscription updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"402":{"description":"Payment required to apply the subscription update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentFailed"}}}},"403":{"description":"Subscription is already canceled or will be at the end of the period.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlreadyCanceledSubscription"}}}},"404":{"description":"Subscription not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"Subscription is pending an update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionLocked"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"subscriptions","x-speakeasy-name-override":"update"},"delete":{"tags":["subscriptions","public"],"summary":"Revoke Subscription","description":"Revoke a subscription, i.e cancel immediately.\n\n**Scopes**: `subscriptions:write`","operationId":"subscriptions:revoke","security":[{"oidc":["subscriptions:write"]},{"pat":["subscriptions:write"]},{"oat":["subscriptions:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The subscription ID.","title":"Id"},"description":"The subscription ID."}],"responses":{"200":{"description":"Subscription revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"403":{"description":"This subscription is already revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlreadyCanceledSubscription"}}}},"404":{"description":"Subscription not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"Subscription is pending an update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionLocked"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"subscriptions","x-speakeasy-name-override":"revoke"}},"/v1/oauth2/register":{"post":{"tags":["oauth2","clients","public"],"summary":"Create Client","description":"Create an OAuth2 client.","operationId":"oauth2:clients:oauth2:create_client","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuth2ClientConfiguration"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"oidc":[]},{"pat":[]}],"x-polar-allowed-subjects":["Anonymous","User"],"x-speakeasy-group":"oauth2.clients","x-speakeasy-name-override":"create"}},"/v1/oauth2/register/{client_id}":{"get":{"tags":["oauth2","clients","public"],"summary":"Get Client","description":"Get an OAuth2 client by Client ID.","operationId":"oauth2:clients:oauth2:get_client","security":[{"oidc":[]},{"pat":[]}],"parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Anonymous","User"],"x-speakeasy-group":"oauth2.clients","x-speakeasy-name-override":"get"},"put":{"tags":["oauth2","clients","public"],"summary":"Update Client","description":"Update an OAuth2 client.","operationId":"oauth2:clients:oauth2:update_client","security":[{"oidc":[]},{"pat":[]}],"parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuth2ClientConfigurationUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Anonymous","User"],"x-speakeasy-group":"oauth2.clients","x-speakeasy-name-override":"update"},"delete":{"tags":["oauth2","clients","public"],"summary":"Delete Client","description":"Delete an OAuth2 client.","operationId":"oauth2:clients:oauth2:delete_client","security":[{"oidc":[]},{"pat":[]}],"parameters":[{"name":"client_id","in":"path","required":true,"schema":{"type":"string","title":"Client Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Anonymous","User"],"x-speakeasy-group":"oauth2.clients","x-speakeasy-name-override":"delete"}},"/v1/oauth2/authorize":{"get":{"tags":["oauth2","public"],"summary":"Authorize","operationId":"oauth2:authorize","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/AuthorizeResponseUser"},{"$ref":"#/components/schemas/AuthorizeResponseOrganization"}],"title":"Response Oauth2:Authorize","discriminator":{"propertyName":"sub_type","mapping":{"user":"#/components/schemas/AuthorizeResponseUser","organization":"#/components/schemas/AuthorizeResponseOrganization"}}}}}}},"security":[{"oidc":[]},{"pat":[]}],"x-polar-allowed-subjects":["Anonymous","User"],"x-speakeasy-group":"oauth2","x-speakeasy-name-override":"authorize"}},"/v1/oauth2/token":{"post":{"tags":["oauth2","public"],"summary":"Request Token","description":"Request an access token using a valid grant.","operationId":"oauth2:request_token","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"oneOf":[{"$ref":"#/components/schemas/AuthorizationCodeTokenRequest"},{"$ref":"#/components/schemas/RefreshTokenRequest"},{"$ref":"#/components/schemas/WebTokenRequest"}]}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}}},"x-speakeasy-group":"oauth2","x-speakeasy-name-override":"token"}},"/v1/oauth2/revoke":{"post":{"tags":["oauth2","public"],"summary":"Revoke Token","description":"Revoke an access token or a refresh token.","operationId":"oauth2:revoke_token","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/RevokeTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeTokenResponse"}}}}},"x-speakeasy-group":"oauth2","x-speakeasy-name-override":"revoke"}},"/v1/oauth2/introspect":{"post":{"tags":["oauth2","public"],"summary":"Introspect Token","description":"Get information about an access token.","operationId":"oauth2:introspect_token","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/IntrospectTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntrospectTokenResponse"}}}}},"x-speakeasy-group":"oauth2","x-speakeasy-name-override":"introspect"}},"/v1/oauth2/userinfo":{"get":{"tags":["oauth2","public"],"summary":"Get User Info","description":"Get information about the authenticated user.","operationId":"oauth2:userinfo","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/UserInfoUser"},{"$ref":"#/components/schemas/UserInfoOrganization"}],"title":"Response Oauth2:Userinfo"}}}}},"security":[{"oidc":[]}],"x-speakeasy-name-override":"userinfo","x-speakeasy-group":"oauth2"}},"/v1/benefits/":{"get":{"tags":["benefits","public"],"summary":"List Benefits","description":"List benefits.\n\n**Scopes**: `benefits:read` `benefits:write`","operationId":"benefits:list","security":[{"oidc":["benefits:read","benefits:write"]},{"pat":["benefits:read","benefits:write"]},{"oat":["benefits:read","benefits:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/BenefitType"},{"type":"array","items":{"$ref":"#/components/schemas/BenefitType"}},{"type":"null"}],"title":"BenefitType Filter","description":"Filter by benefit type."},"description":"Filter by benefit type."},{"name":"id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The benefit ID."}},{"type":"null"}],"title":"Filter IDs","description":"Filter by benefit IDs."},"description":"Filter by benefit IDs."},{"name":"exclude_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The benefit ID."}},{"type":"null"}],"title":"Exclude IDs","description":"Exclude benefits with these IDs."},"description":"Exclude benefits with these IDs."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Filter by description."},"description":"Filter by description."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BenefitSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Benefit_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"benefits","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Benefit"}}},"post":{"tags":["benefits","public"],"summary":"Create Benefit","description":"Create a benefit.\n\n**Scopes**: `benefits:write`","operationId":"benefits:create","security":[{"oidc":["benefits:write"]},{"pat":["benefits:write"]},{"oat":["benefits:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenefitCreate"}}}},"responses":{"201":{"description":"Benefit created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Benefit","title":"Benefit"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"benefits","x-speakeasy-name-override":"create"}},"/v1/benefits/{id}":{"get":{"tags":["benefits","public"],"summary":"Get Benefit","description":"Get a benefit by ID.\n\n**Scopes**: `benefits:read` `benefits:write`","operationId":"benefits:get","security":[{"oidc":["benefits:read","benefits:write"]},{"pat":["benefits:read","benefits:write"]},{"oat":["benefits:read","benefits:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The benefit ID.","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Benefit","title":"Benefit"}}}},"404":{"description":"Benefit not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"benefits","x-speakeasy-name-override":"get"},"patch":{"tags":["benefits","public"],"summary":"Update Benefit","description":"Update a benefit.\n\n**Scopes**: `benefits:write`","operationId":"benefits:update","security":[{"oidc":["benefits:write"]},{"pat":["benefits:write"]},{"oat":["benefits:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The benefit ID.","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/BenefitCustomUpdate"},{"$ref":"#/components/schemas/BenefitDiscordUpdate"},{"$ref":"#/components/schemas/BenefitGitHubRepositoryUpdate"},{"$ref":"#/components/schemas/BenefitDownloadablesUpdate"},{"$ref":"#/components/schemas/BenefitLicenseKeysUpdate"},{"$ref":"#/components/schemas/BenefitMeterCreditUpdate"},{"$ref":"#/components/schemas/BenefitFeatureFlagUpdate"},{"$ref":"#/components/schemas/BenefitSlackSharedChannelUpdate"}],"title":"Benefit Update"}}}},"responses":{"200":{"description":"Benefit updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Benefit","title":"Benefit"}}}},"404":{"description":"Benefit not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"benefits","x-speakeasy-name-override":"update"},"delete":{"tags":["benefits","public"],"summary":"Delete Benefit","description":"Delete a benefit.\n\n> [!WARNING]\n> Every grants associated with the benefit will be revoked.\n> Users will lose access to the benefit.\n\n**Scopes**: `benefits:write`","operationId":"benefits:delete","security":[{"oidc":["benefits:write"]},{"pat":["benefits:write"]},{"oat":["benefits:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The benefit ID.","title":"Id"}}],"responses":{"204":{"description":"Benefit deleted."},"403":{"description":"This benefit is not deletable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Benefit not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"benefits","x-speakeasy-name-override":"delete"}},"/v1/benefits/{id}/grants":{"get":{"tags":["benefits","public"],"summary":"List Benefit Grants","description":"List the individual grants for a benefit.\n\nIt's especially useful to check if a user has been granted a benefit.\n\n**Scopes**: `benefits:read` `benefits:write`","operationId":"benefits:grants","security":[{"oidc":["benefits:read","benefits:write"]},{"pat":["benefits:read","benefits:write"]},{"oat":["benefits:read","benefits:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The benefit ID.","title":"Id"}},{"name":"is_granted","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. ","title":"Is Granted"},"description":"Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. "},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer."},"description":"Filter by customer."},{"name":"member_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"MemberID Filter","description":"Filter by member."},"description":"Filter by member."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_BenefitGrant_"}}}},"404":{"description":"Benefit not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"benefits","x-speakeasy-name-override":"grants","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/BenefitGrant"}}}},"/v1/benefit-grants/":{"get":{"tags":["benefit-grants","public"],"summary":"List Benefit Grants","description":"List benefit grants across all benefits accessible to the authenticated subject.\n\n**Scopes**: `benefits:read` `benefits:write`","operationId":"benefit-grants:list","security":[{"oidc":["benefits:read","benefits:write"]},{"pat":["benefits:read","benefits:write"]},{"oat":["benefits:read","benefits:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","description":"The customer external ID."},{"type":"array","items":{"type":"string","description":"The customer external ID."}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by customer external ID."},"description":"Filter by customer external ID."},{"name":"is_granted","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. ","title":"Is Granted"},"description":"Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. "},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/BenefitGrantSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_BenefitGrant_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"benefit-grants","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/BenefitGrant"}}}},"/v1/webhooks/endpoints":{"get":{"tags":["webhooks","public"],"summary":"List Webhook Endpoints","description":"List webhook endpoints.\n\n**Scopes**: `webhooks:read` `webhooks:write`","operationId":"webhooks:list_webhook_endpoints","security":[{"oidc":["webhooks:read","webhooks:write"]},{"pat":["webhooks:read","webhooks:write"]},{"oat":["webhooks:read","webhooks:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"description":"Filter by organization ID.","title":"Organization Id"},"description":"Filter by organization ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_WebhookEndpoint_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"list_webhook_endpoints","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}},"post":{"tags":["webhooks","public"],"summary":"Create Webhook Endpoint","description":"Create a webhook endpoint.\n\n**Scopes**: `webhooks:write`","operationId":"webhooks:create_webhook_endpoint","security":[{"oidc":["webhooks:write"]},{"pat":["webhooks:write"]},{"oat":["webhooks:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointCreate"}}}},"responses":{"201":{"description":"Webhook endpoint created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"create_webhook_endpoint"}},"/v1/webhooks/endpoints/{id}":{"get":{"tags":["webhooks","public"],"summary":"Get Webhook Endpoint","description":"Get a webhook endpoint by ID.\n\n**Scopes**: `webhooks:read` `webhooks:write`","operationId":"webhooks:get_webhook_endpoint","security":[{"oidc":["webhooks:read","webhooks:write"]},{"pat":["webhooks:read","webhooks:write"]},{"oat":["webhooks:read","webhooks:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The webhook endpoint ID.","title":"Id"},"description":"The webhook endpoint ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"404":{"description":"Webhook endpoint not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"get_webhook_endpoint"},"patch":{"tags":["webhooks","public"],"summary":"Update Webhook Endpoint","description":"Update a webhook endpoint.\n\n**Scopes**: `webhooks:write`","operationId":"webhooks:update_webhook_endpoint","security":[{"oidc":["webhooks:write"]},{"pat":["webhooks:write"]},{"oat":["webhooks:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The webhook endpoint ID.","title":"Id"},"description":"The webhook endpoint ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpointUpdate"}}}},"responses":{"200":{"description":"Webhook endpoint updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"404":{"description":"Webhook endpoint not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"update_webhook_endpoint"},"delete":{"tags":["webhooks","public"],"summary":"Delete Webhook Endpoint","description":"Delete a webhook endpoint.\n\n**Scopes**: `webhooks:write`","operationId":"webhooks:delete_webhook_endpoint","security":[{"oidc":["webhooks:write"]},{"pat":["webhooks:write"]},{"oat":["webhooks:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The webhook endpoint ID.","title":"Id"},"description":"The webhook endpoint ID."}],"responses":{"204":{"description":"Webhook endpoint deleted."},"404":{"description":"Webhook endpoint not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"delete_webhook_endpoint"}},"/v1/webhooks/endpoints/{id}/secret":{"patch":{"tags":["webhooks","public"],"summary":"Reset Webhook Endpoint Secret","description":"Regenerate a webhook endpoint secret.\n\n**Scopes**: `webhooks:write`","operationId":"webhooks:reset_webhook_endpoint_secret","security":[{"oidc":["webhooks:write"]},{"pat":["webhooks:write"]},{"oat":["webhooks:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The webhook endpoint ID.","title":"Id"},"description":"The webhook endpoint ID."}],"responses":{"200":{"description":"Webhook endpoint secret reset.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEndpoint"}}}},"404":{"description":"Webhook endpoint not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"reset_webhook_endpoint_secret"}},"/v1/webhooks/deliveries":{"get":{"tags":["webhooks","public"],"summary":"List Webhook Deliveries","description":"List webhook deliveries.\n\nDeliveries are all the attempts to deliver a webhook event to an endpoint.\n\n**Scopes**: `webhooks:read` `webhooks:write`","operationId":"webhooks:list_webhook_deliveries","security":[{"oidc":["webhooks:read","webhooks:write"]},{"pat":["webhooks:read","webhooks:write"]},{"oat":["webhooks:read","webhooks:write"]}],"parameters":[{"name":"endpoint_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"description":"Filter by webhook endpoint ID.","title":"Endpoint Id"},"description":"Filter by webhook endpoint ID."},{"name":"start_timestamp","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter deliveries after this timestamp.","title":"Start Timestamp"},"description":"Filter deliveries after this timestamp."},{"name":"end_timestamp","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter deliveries before this timestamp.","title":"End Timestamp"},"description":"Filter deliveries before this timestamp."},{"name":"succeeded","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by delivery success status.","title":"Succeeded"},"description":"Filter by delivery success status."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Query to filter webhook deliveries.","title":"Query"},"description":"Query to filter webhook deliveries."},{"name":"http_code_class","in":"query","required":false,"schema":{"anyOf":[{"enum":["2xx","3xx","4xx","5xx"],"type":"string"},{"type":"null"}],"description":"Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx).","title":"Http Code Class"},"description":"Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx)."},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/WebhookEventType"},{"type":"array","items":{"$ref":"#/components/schemas/WebhookEventType"}},{"type":"null"}],"description":"Filter by webhook event type.","title":"Event Type"},"description":"Filter by webhook event type."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_WebhookDelivery_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"list_webhook_deliveries","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"/v1/webhooks/events/{id}/redeliver":{"post":{"tags":["webhooks","public"],"summary":"Redeliver Webhook Event","description":"Schedule the re-delivery of a webhook event.\n\n**Scopes**: `webhooks:write`","operationId":"webhooks:redeliver_webhook_event","security":[{"oidc":["webhooks:write"]},{"pat":["webhooks:write"]},{"oat":["webhooks:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The webhook event ID.","title":"Id"},"description":"The webhook event ID."}],"responses":{"202":{"description":"Webhook event re-delivery scheduled.","content":{"application/json":{"schema":{}}}},"404":{"description":"Webhook event not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"webhooks","x-speakeasy-name-override":"redeliver_webhook_event"}},"/v1/products/":{"get":{"tags":["products","public"],"summary":"List Products","description":"List products.\n\n**Scopes**: `products:read` `products:write`","operationId":"products:list","security":[{"oidc":["products:read","products:write"]},{"pat":["products:read","products:write"]},{"oat":["products:read","products:write"]}],"parameters":[{"name":"id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by product name.","title":"Query"},"description":"Filter by product name."},{"name":"is_archived","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter on archived products.","title":"Is Archived"},"description":"Filter on archived products."},{"name":"is_recurring","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. ","title":"Is Recurring"},"description":"Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. "},{"name":"benefit_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The benefit ID."}},{"type":"null"}],"title":"BenefitID Filter","description":"Filter products granting specific benefit."},"description":"Filter products granting specific benefit."},{"name":"visibility","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ProductVisibility"}},{"type":"null"}],"description":"Filter by visibility.","title":"Visibility"},"description":"Filter by visibility."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/ProductSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Product_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"products","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Product"}}},"post":{"tags":["products","public"],"summary":"Create Product","description":"Create a product.\n\n**Scopes**: `products:write`","operationId":"products:create","security":[{"oidc":["products:write"]},{"pat":["products:write"]},{"oat":["products:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductCreate"}}}},"responses":{"201":{"description":"Product created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"products","x-speakeasy-name-override":"create"}},"/v1/products/{id}":{"get":{"tags":["products","public"],"summary":"Get Product","description":"Get a product by ID.\n\n**Scopes**: `products:read` `products:write`","operationId":"products:get","security":[{"oidc":["products:read","products:write"]},{"pat":["products:read","products:write"]},{"oat":["products:read","products:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The product ID.","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"404":{"description":"Product not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"products","x-speakeasy-name-override":"get"},"patch":{"tags":["products","public"],"summary":"Update Product","description":"Update a product.\n\n**Scopes**: `products:write`","operationId":"products:update","security":[{"oidc":["products:write"]},{"pat":["products:write"]},{"oat":["products:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The product ID.","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductUpdate"}}}},"responses":{"200":{"description":"Product updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"403":{"description":"You don't have the permission to update this product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Product not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"products","x-speakeasy-name-override":"update"}},"/v1/products/{id}/benefits":{"post":{"tags":["products","public"],"summary":"Update Product Benefits","description":"Update benefits granted by a product.\n\n**Scopes**: `products:write`","operationId":"products:update_benefits","security":[{"oidc":["products:write"]},{"pat":["products:write"]},{"oat":["products:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The product ID.","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductBenefitsUpdate"}}}},"responses":{"200":{"description":"Product benefits updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Product"}}}},"403":{"description":"You don't have the permission to update this product.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Product not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"products","x-speakeasy-name-override":"update_benefits"}},"/v1/orders/":{"get":{"tags":["orders","public"],"summary":"List Orders","description":"List orders.\n\n**Scopes**: `orders:read`","operationId":"orders:list","security":[{"oidc":["orders:read"]},{"pat":["orders:read"]},{"oat":["orders:read"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"product_billing_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ProductBillingType"},{"type":"array","items":{"$ref":"#/components/schemas/ProductBillingType"}},{"type":"null"}],"title":"ProductBillingType Filter","description":"Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},"description":"Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},{"name":"discount_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"DiscountID Filter","description":"Filter by discount ID."},"description":"Filter by discount ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","description":"The customer external ID."},{"type":"array","items":{"type":"string","description":"The customer external ID."}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by customer external ID."},"description":"Filter by customer external ID."},{"name":"checkout_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"CheckoutID Filter","description":"Filter by checkout ID."},"description":"Filter by checkout ID."},{"name":"subscription_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The subscription ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The subscription ID."}},{"type":"null"}],"title":"SubscriptionID Filter","description":"Filter by subscription ID."},"description":"Filter by subscription ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/OrderSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Order_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"orders","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Order"}}},"post":{"tags":["orders","public"],"summary":"Create Order","description":"Create a draft order for an off-session charge against a saved payment\nmethod. The order is created with `status=draft` and no invoice number;\ncall `POST /v1/orders/{id}/finalize` to attempt the charge.\n\nThe organization must have the `off_session_charges_enabled` feature flag.\n\n**Scopes**: `orders:write`","operationId":"orders:create","security":[{"oidc":["orders:write"]},{"pat":["orders:write"]},{"oat":["orders:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"create"}},"/v1/orders/export":{"get":{"tags":["orders","public"],"summary":"Export Orders","description":"Export orders as a CSV file.\n\n**Scopes**: `orders:read`","operationId":"orders:export","security":[{"oidc":["orders:read"]},{"pat":["orders:read"]},{"oat":["orders:read"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."}],"responses":{"200":{"description":"Successful Response","content":{"text/csv":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"export"}},"/v1/orders/{id}":{"get":{"tags":["orders","public"],"summary":"Get Order","description":"Get an order by ID.\n\n**Scopes**: `orders:read`","operationId":"orders:get","security":[{"oidc":["orders:read"]},{"pat":["orders:read"]},{"oat":["orders:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"get"},"patch":{"tags":["orders","public"],"summary":"Update Order","description":"Update an order.\n\n**Scopes**: `orders:write`","operationId":"orders:update","security":[{"oidc":["orders:write"]},{"pat":["orders:write"]},{"oat":["orders:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"update"}},"/v1/orders/{id}/finalize":{"post":{"tags":["orders","public"],"summary":"Finalize Order","description":"Finalize a draft order and synchronously attempt an off-session charge.\n\nOn success, the order transitions to `paid` and benefit grants fire\nbefore the response returns. On failure (decline, missing payment method,\nSCA challenge), the order stays in `draft` and a 4xx error is returned.\n\nThe request fails with 412 if the order is not in `draft` status.\n\n**Scopes**: `orders:write`","operationId":"orders:finalize","security":[{"oidc":["orders:write"]},{"pat":["orders:write"]},{"oat":["orders:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderFinalize","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"402":{"description":"The charge failed, or requires customer authentication (e.g. a 3DS challenge) that can't be completed off-session.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PaymentFailed"},{"$ref":"#/components/schemas/PaymentActionRequired"}],"title":"Response 402 Orders:Finalize"}}}},"403":{"description":"Off-session charges are not enabled for this organization, or its account can't currently accept payments.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/OffSessionChargesNotEnabled"},{"$ref":"#/components/schemas/OrganizationNotReadyForPayments"}],"title":"Response 403 Orders:Finalize"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"412":{"description":"The order is not in `draft` status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderNotDraft"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"finalize"}},"/v1/orders/{id}/invoice":{"post":{"tags":["orders","public"],"summary":"Generate Order Invoice","description":"Trigger generation of an order's invoice.\n\n**Scopes**: `orders:read`","operationId":"orders:generate_invoice","security":[{"oidc":["orders:read"]},{"pat":["orders:read"]},{"oat":["orders:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"Order is not eligible for invoice generation (invalid status).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderNotEligibleForInvoice"}}}},"422":{"description":"Order is missing billing name or address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingInvoiceBillingDetails"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"generate_invoice"},"get":{"tags":["orders","public"],"summary":"Get Order Invoice","description":"Get an order's invoice data.\n\n**Scopes**: `orders:read`","operationId":"orders:invoice","security":[{"oidc":["orders:read"]},{"pat":["orders:read"]},{"oat":["orders:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderInvoice"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"invoice"}},"/v1/orders/{id}/receipt":{"get":{"tags":["orders","public"],"summary":"Get Order Receipt","description":"Get a presigned URL to download an order's receipt PDF.\n\n**Scopes**: `orders:read`","operationId":"orders:receipt","security":[{"oidc":["orders:read"]},{"pat":["orders:read"]},{"oat":["orders:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderReceipt"}}}},"202":{"description":"Receipt generation in progress."},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"orders","x-speakeasy-name-override":"receipt"}},"/v1/refunds/":{"get":{"tags":["refunds","public"],"summary":"List Refunds","description":"List refunds.\n\n**Scopes**: `refunds:read` `refunds:write`","operationId":"refunds:list","security":[{"oidc":["refunds:read","refunds:write"]},{"pat":["refunds:read","refunds:write"]},{"oat":["refunds:read","refunds:write"]}],"parameters":[{"name":"id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The refund ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The refund ID."}},{"type":"null"}],"title":"RefundID Filter","description":"Filter by refund ID."},"description":"Filter by refund ID."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"order_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The order ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The order ID."}},{"type":"null"}],"title":"OrderID Filter","description":"Filter by order ID."},"description":"Filter by order ID."},{"name":"subscription_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The subscription ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The subscription ID."}},{"type":"null"}],"title":"SubscriptionID Filter","description":"Filter by subscription ID."},"description":"Filter by subscription ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","description":"The customer external ID."},{"type":"array","items":{"type":"string","description":"The customer external ID."}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by customer external ID."},"description":"Filter by customer external ID."},{"name":"succeeded","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"RefundStatus Filter","description":"Filter by `succeeded`."},"description":"Filter by `succeeded`."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/RefundSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Refund_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"refunds","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Refund"}}},"post":{"tags":["refunds","public"],"summary":"Create Refund","description":"Create a refund.\n\n**Scopes**: `refunds:write`","operationId":"refunds:create","security":[{"oidc":["refunds:write"]},{"pat":["refunds:write"]},{"oat":["refunds:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundCreate"}}}},"responses":{"201":{"description":"Refund created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Refund"}}}},"403":{"description":"Order is already fully refunded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundedAlready"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"refunds","x-speakeasy-name-override":"create"}},"/v1/disputes/":{"get":{"tags":["disputes","public"],"summary":"List Disputes","description":"List disputes.\n\n**Scopes**: `disputes:read` `disputes:write`","operationId":"disputes:list","security":[{"oidc":["disputes:read","disputes:write"]},{"pat":["disputes:read","disputes:write"]},{"oat":["disputes:read","disputes:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"order_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The order ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The order ID."}},{"type":"null"}],"title":"OrderID Filter","description":"Filter by order ID."},"description":"Filter by order ID."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/DisputeStatus"},{"type":"array","items":{"$ref":"#/components/schemas/DisputeStatus"}},{"type":"null"}],"title":"Status Filter","description":"Filter by dispute status."},"description":"Filter by dispute status."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DisputeSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Dispute_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"disputes","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Dispute"}}}},"/v1/disputes/{id}":{"get":{"tags":["disputes","public"],"summary":"Get Dispute","description":"Get a dispute by ID.\n\n**Scopes**: `disputes:read` `disputes:write`","operationId":"disputes:get","security":[{"oidc":["disputes:read","disputes:write"]},{"pat":["disputes:read","disputes:write"]},{"oat":["disputes:read","disputes:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The dispute ID.","title":"Id"},"description":"The dispute ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dispute"}}}},"404":{"description":"Dispute not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"disputes","x-speakeasy-name-override":"get"}},"/v1/disputes/{id}/accept":{"post":{"tags":["disputes","public"],"summary":"Accept Dispute","description":"Accept a dispute, conceding the chargeback.\n\nCloses the dispute with the processor (settling it as `lost`) and records\nthe merchant's decision on the dispute's support case.\n\n**Scopes**: `disputes:write`","operationId":"disputes:accept","security":[{"oidc":["disputes:write"]},{"pat":["disputes:write"]},{"oat":["disputes:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The dispute ID.","title":"Id"},"description":"The dispute ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Dispute"}}}},"404":{"description":"Dispute not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisputeNotOpenError"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"disputes","x-speakeasy-name-override":"accept"}},"/v1/checkouts/":{"get":{"tags":["checkouts","public"],"summary":"List Checkout Sessions","description":"List checkout sessions.\n\n**Scopes**: `checkouts:read` `checkouts:write`","operationId":"checkouts:list","security":[{"oidc":["checkouts:read","checkouts:write"]},{"pat":["checkouts:read","checkouts:write"]},{"oat":["checkouts:read","checkouts:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","description":"The customer external ID."},{"type":"array","items":{"type":"string","description":"The customer external ID."}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by customer external ID."},"description":"Filter by customer external ID."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckoutStatus"},{"type":"array","items":{"$ref":"#/components/schemas/CheckoutStatus"}},{"type":"null"}],"title":"Status Filter","description":"Filter by checkout session status."},"description":"Filter by checkout session status."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by customer email.","title":"Query"},"description":"Filter by customer email."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CheckoutSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Checkout_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Checkout"}}},"post":{"tags":["checkouts","public"],"summary":"Create Checkout Session","description":"Create a checkout session.\n\n**Scopes**: `checkouts:write`","operationId":"checkouts:create","security":[{"oidc":["checkouts:write"]},{"pat":["checkouts:write"]},{"oat":["checkouts:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutCreate"}}}},"responses":{"201":{"description":"Checkout session created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"create"}},"/v1/checkouts/{id}":{"get":{"tags":["checkouts","public"],"summary":"Get Checkout Session","description":"Get a checkout session by ID.\n\n**Scopes**: `checkouts:read` `checkouts:write`","operationId":"checkouts:get","security":[{"oidc":["checkouts:read","checkouts:write"]},{"pat":["checkouts:read","checkouts:write"]},{"oat":["checkouts:read","checkouts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The checkout session ID.","title":"Id"},"description":"The checkout session ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"}}}},"404":{"description":"Checkout session not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"get"},"patch":{"tags":["checkouts","public"],"summary":"Update Checkout Session","description":"Update a checkout session.\n\n**Scopes**: `checkouts:write`","operationId":"checkouts:update","security":[{"oidc":["checkouts:write"]},{"pat":["checkouts:write"]},{"oat":["checkouts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The checkout session ID.","title":"Id"},"description":"The checkout session ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutUpdate"}}}},"responses":{"200":{"description":"Checkout session updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Checkout"}}}},"404":{"description":"Checkout session not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"403":{"description":"The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutForbiddenError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"update"}},"/v1/checkouts/client/{client_secret}":{"get":{"tags":["checkouts","public"],"summary":"Get Checkout Session from Client","description":"Get a checkout session by client secret.","operationId":"checkouts:client_get","parameters":[{"name":"client_secret","in":"path","required":true,"schema":{"type":"string","description":"The checkout session client secret.","title":"Client Secret"},"description":"The checkout session client secret."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutPublic"}}}},"404":{"description":"Checkout session not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"410":{"description":"The checkout session is expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpiredCheckoutError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"client_get"},"patch":{"tags":["checkouts","public"],"summary":"Update Checkout Session from Client","description":"Update a checkout session by client secret.","operationId":"checkouts:client_update","parameters":[{"name":"client_secret","in":"path","required":true,"schema":{"type":"string","description":"The checkout session client secret.","title":"Client Secret"},"description":"The checkout session client secret."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutUpdatePublic"}}}},"responses":{"200":{"description":"Checkout session updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutPublic"}}}},"404":{"description":"Checkout session not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"403":{"description":"The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutForbiddenError"}}}},"410":{"description":"The checkout session is expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpiredCheckoutError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"client_update"}},"/v1/checkouts/client/{client_secret}/confirm":{"post":{"tags":["checkouts","public"],"summary":"Confirm Checkout Session from Client","description":"Confirm a checkout session by client secret.\n\nOrders and subscriptions will be processed.","operationId":"checkouts:client_confirm","security":[{"oidc":[]},{"pat":[]}],"parameters":[{"name":"client_secret","in":"path","required":true,"schema":{"type":"string","description":"The checkout session client secret.","title":"Client Secret"},"description":"The checkout session client secret."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutConfirmStripe"}}}},"responses":{"200":{"description":"Checkout session confirmed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutPublicConfirmed"}}}},"400":{"description":"The payment failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentError"}}}},"404":{"description":"Checkout session not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"403":{"description":"The checkout is expired, the customer already has an active subscription, or the organization is not ready to accept payments.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutForbiddenError"}}}},"410":{"description":"The checkout session is expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpiredCheckoutError"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Anonymous","User"],"x-speakeasy-group":"checkouts","x-speakeasy-name-override":"client_confirm"}},"/v1/files/":{"get":{"tags":["files","public"],"summary":"List Files","description":"List files.\n\n**Scopes**: `files:read` `files:write`","operationId":"files:list","security":[{"oidc":["files:read","files:write"]},{"pat":["files:read","files:write"]},{"oat":["files:read","files:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"FileID Filter","description":"Filter by file ID."},"description":"Filter by file ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_FileRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"files","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/FileRead"}}},"post":{"tags":["files","public"],"summary":"Create File","description":"Create a file.\n\n**Scopes**: `files:write`","operationId":"files:create","security":[{"oidc":["files:write"]},{"pat":["files:write"]},{"oat":["files:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileCreate"}}}},"responses":{"201":{"description":"File created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUpload"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"files","x-speakeasy-name-override":"create"}},"/v1/files/{id}/uploaded":{"post":{"tags":["files","public"],"summary":"Complete File Upload","description":"Complete a file upload.\n\n**Scopes**: `files:write`","operationId":"files:uploaded","security":[{"oidc":["files:write"]},{"pat":["files:write"]},{"oat":["files:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The file ID.","title":"Id"},"description":"The file ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadCompleted"}}}},"responses":{"200":{"description":"File upload completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileRead"}}}},"403":{"description":"You don't have the permission to update this file.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"File not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"files","x-speakeasy-name-override":"uploaded"}},"/v1/files/{id}":{"patch":{"tags":["files","public"],"summary":"Update File","description":"Update a file.\n\n**Scopes**: `files:write`","operationId":"files:update","security":[{"oidc":["files:write"]},{"pat":["files:write"]},{"oat":["files:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The file ID.","title":"Id"},"description":"The file ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FilePatch"}}}},"responses":{"200":{"description":"File updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileRead"}}}},"403":{"description":"You don't have the permission to update this file.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"File not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"files","x-speakeasy-name-override":"update"},"delete":{"tags":["files","public"],"summary":"Delete File","description":"Delete a file.\n\n**Scopes**: `files:write`","operationId":"files:delete","security":[{"oidc":["files:write"]},{"pat":["files:write"]},{"oat":["files:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Id"}}],"responses":{"204":{"description":"File deleted."},"403":{"description":"You don't have the permission to delete this file.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"File not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"files","x-speakeasy-name-override":"delete"}},"/v1/metrics/":{"get":{"tags":["metrics","public"],"summary":"Get Metrics","description":"Get metrics about your orders and subscriptions.\n\nCurrency values are output in cents.\n\n**Scopes**: `metrics:read`","operationId":"metrics:get","security":[{"oidc":["metrics:read"]},{"pat":["metrics:read"]},{"oat":["metrics:read"]}],"parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"Start date.","title":"Start Date"},"description":"Start date."},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"End date.","title":"End Date"},"description":"End date."},{"name":"timezone","in":"query","required":false,"schema":{"type":"string","minLength":1,"description":"Timezone to use for the timestamps. Default is UTC.","enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Factory","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu","localtime"],"default":"UTC","title":"Timezone"},"description":"Timezone to use for the timestamps. Default is UTC."},{"name":"interval","in":"query","required":true,"schema":{"$ref":"#/components/schemas/TimeInterval","description":"Interval between two timestamps."},"description":"Interval between two timestamps."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"billing_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ProductBillingType"},{"type":"array","items":{"$ref":"#/components/schemas/ProductBillingType"}},{"type":"null"}],"title":"ProductBillingType Filter","description":"Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},"description":"Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"metrics","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Metrics","description":"List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned."},"description":"List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"get"}},"/v1/metrics/export":{"get":{"tags":["metrics","public"],"summary":"Export Metrics","description":"Export metrics as a CSV file.\n\n**Scopes**: `metrics:read`","operationId":"metrics:export","security":[{"oidc":["metrics:read"]},{"pat":["metrics:read"]},{"oat":["metrics:read"]}],"parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"Start date.","title":"Start Date"},"description":"Start date."},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date","description":"End date.","title":"End Date"},"description":"End date."},{"name":"timezone","in":"query","required":false,"schema":{"type":"string","minLength":1,"description":"Timezone to use for the timestamps. Default is UTC.","enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Factory","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu","localtime"],"default":"UTC","title":"Timezone"},"description":"Timezone to use for the timestamps. Default is UTC."},{"name":"interval","in":"query","required":true,"schema":{"$ref":"#/components/schemas/TimeInterval","description":"Interval between two timestamps."},"description":"Interval between two timestamps."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"billing_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ProductBillingType"},{"type":"array","items":{"$ref":"#/components/schemas/ProductBillingType"}},{"type":"null"}],"title":"ProductBillingType Filter","description":"Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},"description":"Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"metrics","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Metrics","description":"List of metric slugs to include in the export. If not provided, all metrics are exported."},"description":"List of metric slugs to include in the export. If not provided, all metrics are exported."}],"responses":{"200":{"description":"Successful Response","content":{"text/csv":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"export"}},"/v1/metrics/limits":{"get":{"tags":["metrics","public"],"summary":"Get Metrics Limits","description":"Get the interval limits for the metrics endpoint.\n\n**Scopes**: `metrics:read`","operationId":"metrics:limits","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricsLimits"}}}}},"security":[{"oidc":["metrics:read"]},{"pat":["metrics:read"]},{"oat":["metrics:read"]}],"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"limits"}},"/v1/metrics/dashboards":{"get":{"tags":["metrics","public"],"summary":"List Metric Dashboards","description":"List user-defined metric dashboards.\n\n**Scopes**: `metrics:read`","operationId":"metrics:list_dashboards","security":[{"oidc":["metrics:read"]},{"pat":["metrics:read"]},{"oat":["metrics:read"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MetricDashboardSchema"},"title":"Response Metrics:List Dashboards"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"list_dashboards"},"post":{"tags":["metrics","public"],"summary":"Create Metric Dashboard","description":"Create a user-defined metric dashboard.\n\n**Scopes**: `metrics:write`","operationId":"metrics:create_dashboard","security":[{"oidc":["metrics:write"]},{"pat":["metrics:write"]},{"oat":["metrics:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricDashboardCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricDashboardSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"create_dashboard"}},"/v1/metrics/dashboards/{id}":{"get":{"tags":["metrics","public"],"summary":"Get Metric Dashboard","description":"Get a user-defined metric dashboard by ID.\n\n**Scopes**: `metrics:read`","operationId":"metrics:get_dashboard","security":[{"oidc":["metrics:read"]},{"pat":["metrics:read"]},{"oat":["metrics:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The metric dashboard ID.","title":"Id"},"description":"The metric dashboard ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricDashboardSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"get_dashboard"},"patch":{"tags":["metrics","public"],"summary":"Update Metric Dashboard","description":"Update a user-defined metric dashboard.\n\n**Scopes**: `metrics:write`","operationId":"metrics:update_dashboard","security":[{"oidc":["metrics:write"]},{"pat":["metrics:write"]},{"oat":["metrics:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The metric dashboard ID.","title":"Id"},"description":"The metric dashboard ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricDashboardUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricDashboardSchema"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"update_dashboard"},"delete":{"tags":["metrics","public"],"summary":"Delete Metric Dashboard","description":"Delete a user-defined metric dashboard.\n\n**Scopes**: `metrics:write`","operationId":"metrics:delete_dashboard","security":[{"oidc":["metrics:write"]},{"pat":["metrics:write"]},{"oat":["metrics:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The metric dashboard ID.","title":"Id"},"description":"The metric dashboard ID."}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"metrics","x-speakeasy-name-override":"delete_dashboard"}},"/v1/license-keys/":{"get":{"tags":["license_keys","public"],"summary":"List License Keys","description":"Get license keys connected to the given organization & filters.\n\n**Scopes**: `license_keys:read` `license_keys:write`","operationId":"license_keys:list","security":[{"oidc":["license_keys:read","license_keys:write"]},{"pat":["license_keys:read","license_keys:write"]},{"oat":["license_keys:read","license_keys:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"benefit_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The benefit ID."}},{"type":"null"}],"title":"BenefitID Filter","description":"Filter by benefit ID."},"description":"Filter by benefit ID."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/LicenseKeyStatus"},{"type":"array","items":{"$ref":"#/components/schemas/LicenseKeyStatus"}},{"type":"null"}],"title":"LicenseKeyStatus Filter","description":"Filter by license key status."},"description":"Filter by license key status."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_LicenseKeyRead_"}}}},"401":{"description":"Not authorized to manage license key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/LicenseKeyRead"}}}},"/v1/license-keys/{id}":{"get":{"tags":["license_keys","public"],"summary":"Get License Key","description":"Get a license key.\n\n**Scopes**: `license_keys:read` `license_keys:write`","operationId":"license_keys:get","security":[{"oidc":["license_keys:read","license_keys:write"]},{"pat":["license_keys:read","license_keys:write"]},{"oat":["license_keys:read","license_keys:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyWithActivations"}}}},"401":{"description":"Not authorized to manage license key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"get"},"patch":{"tags":["license_keys","public"],"summary":"Update License Key","description":"Update a license key.\n\n**Scopes**: `license_keys:write`","operationId":"license_keys:update","security":[{"oidc":["license_keys:write"]},{"pat":["license_keys:write"]},{"oat":["license_keys:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyRead"}}}},"401":{"description":"Not authorized to manage license key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"update"}},"/v1/license-keys/{id}/activations/{activation_id}":{"get":{"tags":["license_keys","public"],"summary":"Get Activation","description":"Get a license key activation.\n\n**Scopes**: `license_keys:read` `license_keys:write`","operationId":"license_keys:get_activation","security":[{"oidc":["license_keys:read","license_keys:write"]},{"pat":["license_keys:read","license_keys:write"]},{"oat":["license_keys:read","license_keys:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Id"}},{"name":"activation_id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Activation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyActivationRead"}}}},"401":{"description":"Not authorized to manage license key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"get_activation"}},"/v1/license-keys/validate":{"post":{"tags":["license_keys","public"],"summary":"Validate License Key","description":"Validate a license key.\n\n**Scopes**: `license_keys:write`","operationId":"license_keys:validate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyValidate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidatedLicenseKey"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"oidc":["license_keys:write"]},{"pat":["license_keys:write"]},{"oat":["license_keys:write"]}],"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"validate"}},"/v1/license-keys/activate":{"post":{"tags":["license_keys","public"],"summary":"Activate License Key","description":"Activate a license key instance.\n\n**Scopes**: `license_keys:write`","operationId":"license_keys:activate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyActivate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyActivationRead"}}}},"403":{"description":"License key activation not supported or limit reached. Use /validate endpoint for licenses without activations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"oidc":["license_keys:write"]},{"pat":["license_keys:write"]},{"oat":["license_keys:write"]}],"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"activate"}},"/v1/license-keys/deactivate":{"post":{"tags":["license_keys","public"],"summary":"Deactivate License Key","description":"Deactivate a license key instance.\n\n**Scopes**: `license_keys:write`","operationId":"license_keys:deactivate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyDeactivate"}}},"required":true},"responses":{"204":{"description":"License key activation deactivated."},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"oidc":["license_keys:write"]},{"pat":["license_keys:write"]},{"oat":["license_keys:write"]}],"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"license_keys","x-speakeasy-name-override":"deactivate"}},"/v1/checkout-links/":{"get":{"tags":["checkout-links","public"],"summary":"List Checkout Links","description":"List checkout links.\n\n**Scopes**: `checkout_links:read` `checkout_links:write`","operationId":"checkout-links:list","security":[{"oidc":["checkout_links:read","checkout_links:write"]},{"pat":["checkout_links:read","checkout_links:write"]},{"oat":["checkout_links:read","checkout_links:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CheckoutLinkSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CheckoutLink_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"checkout-links","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CheckoutLink"}}},"post":{"tags":["checkout-links","public"],"summary":"Create Checkout Link","description":"Create a checkout link.\n\n**Scopes**: `checkout_links:write`","operationId":"checkout-links:create","security":[{"oidc":["checkout_links:write"]},{"pat":["checkout_links:write"]},{"oat":["checkout_links:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutLinkCreate"}}}},"responses":{"201":{"description":"Checkout link created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutLink"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkout-links","x-speakeasy-name-override":"create"}},"/v1/checkout-links/{id}":{"get":{"tags":["checkout-links","public"],"summary":"Get Checkout Link","description":"Get a checkout link by ID.\n\n**Scopes**: `checkout_links:read` `checkout_links:write`","operationId":"checkout-links:get","security":[{"oidc":["checkout_links:read","checkout_links:write"]},{"pat":["checkout_links:read","checkout_links:write"]},{"oat":["checkout_links:read","checkout_links:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The checkout link ID.","title":"Id"},"description":"The checkout link ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutLink"}}}},"404":{"description":"Checkout link not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkout-links","x-speakeasy-name-override":"get"},"patch":{"tags":["checkout-links","public"],"summary":"Update Checkout Link","description":"Update a checkout link.\n\n**Scopes**: `checkout_links:write`","operationId":"checkout-links:update","security":[{"oidc":["checkout_links:write"]},{"pat":["checkout_links:write"]},{"oat":["checkout_links:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The checkout link ID.","title":"Id"},"description":"The checkout link ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutLinkUpdate"}}}},"responses":{"200":{"description":"Checkout link updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutLink"}}}},"404":{"description":"Checkout link not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkout-links","x-speakeasy-name-override":"update"},"delete":{"tags":["checkout-links","public"],"summary":"Delete Checkout Link","description":"Delete a checkout link.\n\n**Scopes**: `checkout_links:write`","operationId":"checkout-links:delete","security":[{"oidc":["checkout_links:write"]},{"pat":["checkout_links:write"]},{"oat":["checkout_links:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The checkout link ID.","title":"Id"},"description":"The checkout link ID."}],"responses":{"204":{"description":"Checkout link deleted."},"404":{"description":"Checkout link not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"checkout-links","x-speakeasy-name-override":"delete"}},"/v1/custom-fields/":{"get":{"tags":["custom-fields","public"],"summary":"List Custom Fields","description":"List custom fields.\n\n**Scopes**: `custom_fields:read` `custom_fields:write`","operationId":"custom-fields:list","security":[{"oidc":["custom_fields:read","custom_fields:write"]},{"pat":["custom_fields:read","custom_fields:write"]},{"oat":["custom_fields:read","custom_fields:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by custom field name or slug.","title":"Query"},"description":"Filter by custom field name or slug."},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomFieldType"},{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldType"}},{"type":"null"}],"title":"CustomFieldType Filter","description":"Filter by custom field type."},"description":"Filter by custom field type."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomFieldSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["slug"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomField_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"custom-fields","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomField"}}},"post":{"tags":["custom-fields","public"],"summary":"Create Custom Field","description":"Create a custom field.\n\n**Scopes**: `custom_fields:write`","operationId":"custom-fields:create","security":[{"oidc":["custom_fields:write"]},{"pat":["custom_fields:write"]},{"oat":["custom_fields:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldCreate"}}}},"responses":{"201":{"description":"Custom field created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomField","title":"CustomField"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"custom-fields","x-speakeasy-name-override":"create"}},"/v1/custom-fields/{id}":{"get":{"tags":["custom-fields","public"],"summary":"Get Custom Field","description":"Get a custom field by ID.\n\n**Scopes**: `custom_fields:read` `custom_fields:write`","operationId":"custom-fields:get","security":[{"oidc":["custom_fields:read","custom_fields:write"]},{"pat":["custom_fields:read","custom_fields:write"]},{"oat":["custom_fields:read","custom_fields:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The custom field ID.","title":"Id"},"description":"The custom field ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomField","title":"CustomField"}}}},"404":{"description":"Custom field not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"custom-fields","x-speakeasy-name-override":"get"},"patch":{"tags":["custom-fields","public"],"summary":"Update Custom Field","description":"Update a custom field.\n\n**Scopes**: `custom_fields:write`","operationId":"custom-fields:update","security":[{"oidc":["custom_fields:write"]},{"pat":["custom_fields:write"]},{"oat":["custom_fields:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The custom field ID.","title":"Id"},"description":"The custom field ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldUpdate"}}}},"responses":{"200":{"description":"Custom field updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomField","title":"CustomField"}}}},"404":{"description":"Custom field not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"custom-fields","x-speakeasy-name-override":"update"},"delete":{"tags":["custom-fields","public"],"summary":"Delete Custom Field","description":"Delete a custom field.\n\n**Scopes**: `custom_fields:write`","operationId":"custom-fields:delete","security":[{"oidc":["custom_fields:write"]},{"pat":["custom_fields:write"]},{"oat":["custom_fields:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The custom field ID.","title":"Id"},"description":"The custom field ID."}],"responses":{"204":{"description":"Custom field deleted."},"404":{"description":"Custom field not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"custom-fields","x-speakeasy-name-override":"delete"}},"/v1/discounts/":{"get":{"tags":["discounts","public"],"summary":"List Discounts","description":"List discounts.\n\n**Scopes**: `discounts:read` `discounts:write`","operationId":"discounts:list","security":[{"oidc":["discounts:read","discounts:write"]},{"pat":["discounts:read","discounts:write"]},{"oat":["discounts:read","discounts:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by name.","title":"Query"},"description":"Filter by name."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/DiscountSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Discount_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"discounts","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Discount"}}},"post":{"tags":["discounts","public"],"summary":"Create Discount","description":"Create a discount.\n\n**Scopes**: `discounts:write`","operationId":"discounts:create","security":[{"oidc":["discounts:write"]},{"pat":["discounts:write"]},{"oat":["discounts:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountCreate"}}}},"responses":{"201":{"description":"Discount created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Discount","title":"Discount"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"discounts","x-speakeasy-name-override":"create"}},"/v1/discounts/{id}":{"get":{"tags":["discounts","public"],"summary":"Get Discount","description":"Get a discount by ID.\n\n**Scopes**: `discounts:read` `discounts:write`","operationId":"discounts:get","security":[{"oidc":["discounts:read","discounts:write"]},{"pat":["discounts:read","discounts:write"]},{"oat":["discounts:read","discounts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The discount ID.","title":"Id"},"description":"The discount ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Discount","title":"Discount"}}}},"404":{"description":"Discount not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"discounts","x-speakeasy-name-override":"get"},"patch":{"tags":["discounts","public"],"summary":"Update Discount","description":"Update a discount.\n\n**Scopes**: `discounts:write`","operationId":"discounts:update","security":[{"oidc":["discounts:write"]},{"pat":["discounts:write"]},{"oat":["discounts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The discount ID.","title":"Id"},"description":"The discount ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiscountUpdate"}}}},"responses":{"200":{"description":"Discount updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Discount","title":"Discount"}}}},"404":{"description":"Discount not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"discounts","x-speakeasy-name-override":"update"},"delete":{"tags":["discounts","public"],"summary":"Delete Discount","description":"Delete a discount.\n\n**Scopes**: `discounts:write`","operationId":"discounts:delete","security":[{"oidc":["discounts:write"]},{"pat":["discounts:write"]},{"oat":["discounts:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The discount ID.","title":"Id"},"description":"The discount ID."}],"responses":{"204":{"description":"Discount deleted."},"404":{"description":"Discount not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"discounts","x-speakeasy-name-override":"delete"}},"/v1/customers/":{"get":{"tags":["customers","public"],"summary":"List Customers","description":"List customers.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:list","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by exact email.","title":"Email"},"description":"Filter by exact email."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by name, email, or external ID.","title":"Query"},"description":"Filter by name, email, or external ID."},{"name":"active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by active customers, i.e. customers with at least one trialing, active or past_due subscription.","title":"Active"},"description":"Filter by active customers, i.e. customers with at least one trialing, active or past_due subscription."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Customer_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customers","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Customer"}}},"post":{"tags":["customers","public"],"summary":"Create Customer","description":"Create a customer.\n\n**Scopes**: `customers:write`","operationId":"customers:create","security":[{"oidc":["customers:write"]},{"pat":["customers:write"]},{"oat":["customers:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreate"}}}},"responses":{"201":{"description":"Customer created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"create"}},"/v1/customers/export":{"get":{"tags":["customers","public"],"summary":"Export Customers","description":"Export customers as a CSV file.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:export","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"description":"Filter by organization ID.","title":"Organization Id"},"description":"Filter by organization ID."}],"responses":{"200":{"description":"Successful Response","content":{"text/csv":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"export"}},"/v1/customers/{id}":{"get":{"tags":["customers","public"],"summary":"Get Customer","description":"Get a customer by ID.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:get","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"get"},"patch":{"tags":["customers","public"],"summary":"Update Customer","description":"Update a customer.\n\n**Scopes**: `customers:write`","operationId":"customers:update","security":[{"oidc":["customers:write"]},{"pat":["customers:write"]},{"oat":["customers:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUpdate"}}}},"responses":{"200":{"description":"Customer updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"update"},"delete":{"tags":["customers","public"],"summary":"Delete Customer","description":"Delete a customer.\n\nThis action cannot be undone and will immediately:\n- Cancel any active subscriptions for the customer\n- Revoke all their benefits\n- Clear any `external_id`\n\nUse it only in the context of deleting a user within your\nown service. Otherwise, use more granular API endpoints to cancel\na specific subscription or revoke certain benefits.\n\nNote: The customers information will nonetheless be retained for historic\norders and subscriptions.\n\nSet `anonymize=true` to also anonymize PII for GDPR compliance.\n\n**Scopes**: `customers:write`","operationId":"customers:delete","security":[{"oidc":["customers:write"]},{"pat":["customers:write"]},{"oat":["customers:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."},{"name":"anonymize","in":"query","required":false,"schema":{"type":"boolean","description":"If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data.","default":false,"title":"Anonymize"},"description":"If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data."}],"responses":{"204":{"description":"Customer deleted."},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"delete"}},"/v1/customers/external/{external_id}":{"get":{"tags":["customers","public"],"summary":"Get Customer by External ID","description":"Get a customer by external ID.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:get_external","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"get_external"},"patch":{"tags":["customers","public"],"summary":"Update Customer by External ID","description":"Update a customer by external ID.\n\n**Scopes**: `customers:write`","operationId":"customers:update_external","security":[{"oidc":["customers:write"]},{"pat":["customers:write"]},{"oat":["customers:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUpdateExternalID"}}}},"responses":{"200":{"description":"Customer updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"update_external"},"delete":{"tags":["customers","public"],"summary":"Delete Customer by External ID","description":"Delete a customer by external ID.\n\nImmediately cancels any active subscriptions and revokes any active benefits.\n\nSet `anonymize=true` to also anonymize PII for GDPR compliance.\n\n**Scopes**: `customers:write`","operationId":"customers:delete_external","security":[{"oidc":["customers:write"]},{"pat":["customers:write"]},{"oat":["customers:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."},{"name":"anonymize","in":"query","required":false,"schema":{"type":"boolean","description":"If true, also anonymize the customer's personal data for GDPR compliance.","default":false,"title":"Anonymize"},"description":"If true, also anonymize the customer's personal data for GDPR compliance."}],"responses":{"204":{"description":"Customer deleted."},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"delete_external"}},"/v1/customers/{id}/state":{"get":{"tags":["customers","public"],"summary":"Get Customer State","description":"Get a customer state by ID.\n\nThe customer state includes information about\nthe customer's active subscriptions and benefits.\n\nIt's the ideal endpoint to use when you need to get a full overview\nof a customer's status.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:get_state","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerState"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"get_state"}},"/v1/customers/external/{external_id}/state":{"get":{"tags":["customers","public"],"summary":"Get Customer State by External ID","description":"Get a customer state by external ID.\n\nThe customer state includes information about\nthe customer's active subscriptions and benefits.\n\nIt's the ideal endpoint to use when you need to get a full overview\nof a customer's status.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:get_state_external","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerState"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers","x-speakeasy-name-override":"get_state_external"}},"/v1/customers/{id}/payment-methods":{"get":{"tags":["customers","public"],"summary":"List Customer Payment Methods","description":"Get saved payment methods of a customer.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:list_payment_methods","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_PaymentMethod_"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customers","x-speakeasy-name-override":"list_payment_methods","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/PaymentMethod"}}}},"/v1/customers/external/{external_id}/payment-methods":{"get":{"tags":["customers","public"],"summary":"List Customer Payment Methods by External ID","description":"Get saved payment methods of a customer by external ID.\n\n**Scopes**: `customers:read` `customers:write`","operationId":"customers:list_payment_methods_external","security":[{"oidc":["customers:read","customers:write"]},{"pat":["customers:read","customers:write"]},{"oat":["customers:read","customers:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_PaymentMethod_"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customers","x-speakeasy-name-override":"list_payment_methods_external","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/PaymentMethod"}}}},"/v1/members/":{"get":{"tags":["members","public"],"summary":"List Members","description":"List members with optional customer ID filter.\n\n**Scopes**: `members:read` `members:write`","operationId":"members:list_members","security":[{"oidc":["members:read","members:write"]},{"pat":["members:read","members:write"]},{"oat":["members:read","members:write"]}],"parameters":[{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by customer ID.","title":"Customer Id"},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","description":"The customer external ID."},{"type":"null"}],"description":"Filter by customer external ID.","title":"External Customer Id"},"description":"Filter by customer external ID."},{"name":"role","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/MemberRole"},{"type":"null"}],"description":"Filter by member role.","title":"Role"},"description":"Filter by member role."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MemberSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Member_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"members","x-speakeasy-name-override":"list_members","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Member"}}}},"/v1/customers/{id}/members":{"post":{"tags":["customers","members","public"],"summary":"Create Member","description":"Create a new member for a customer.\n\nOnly B2B customers with the member management feature enabled can add members.\nThe authenticated user or organization must have access to the customer's organization.\n\n**Scopes**: `members:write`","operationId":"customers:members:create","security":[{"oidc":["members:write"]},{"pat":["members:write"]},{"oat":["members:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberCreateFromCustomer"}}}},"responses":{"201":{"description":"Member created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"403":{"description":"Not permitted to add members.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"create"}},"/v1/customers/external/{external_id}/members":{"post":{"tags":["customers","members","public"],"summary":"Create Member by Customer External ID","description":"Create a new member for a customer identified by its external ID.\n\n**Scopes**: `members:write`","operationId":"customers:members:create_external","security":[{"oidc":["members:write"]},{"pat":["members:write"]},{"oat":["members:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberCreateFromCustomer"}}}},"responses":{"201":{"description":"Member created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"403":{"description":"Not permitted to add members.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Customer not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"The external customer ID matches customers in several accessible organizations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AmbiguousExternalCustomerID"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"create_external"}},"/v1/customers/{id}/members/{member_id}":{"get":{"tags":["customers","members","public"],"summary":"Get Member","description":"Get a member of a customer by its ID.\n\n**Scopes**: `members:read` `members:write`","operationId":"customers:members:get","security":[{"oidc":["members:read","members:write"]},{"pat":["members:read","members:write"]},{"oat":["members:read","members:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."},{"name":"member_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member Id"}}],"responses":{"200":{"description":"Member retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"404":{"description":"Member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"get"},"patch":{"tags":["customers","members","public"],"summary":"Update Member","description":"Update a member of a customer.\n\nOnly name, email and role can be updated.\n\n**Scopes**: `members:write`","operationId":"customers:members:update","security":[{"oidc":["members:write"]},{"pat":["members:write"]},{"oat":["members:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."},{"name":"member_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberUpdate"}}}},"responses":{"200":{"description":"Member updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"404":{"description":"Member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"update"},"delete":{"tags":["customers","members","public"],"summary":"Delete Member","description":"Delete a member of a customer.\n\n**Scopes**: `members:write`","operationId":"customers:members:delete","security":[{"oidc":["members:write"]},{"pat":["members:write"]},{"oat":["members:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer ID.","title":"Id"},"description":"The customer ID."},{"name":"member_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member Id"}}],"responses":{"204":{"description":"Member deleted."},"404":{"description":"Member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"delete"}},"/v1/customers/external/{external_id}/members/{member_external_id}":{"get":{"tags":["customers","members","public"],"summary":"Get Member by External ID","description":"Get a member by external ID for a customer identified by its external ID.\n\n**Scopes**: `members:read` `members:write`","operationId":"customers:members:get_external","security":[{"oidc":["members:read","members:write"]},{"pat":["members:read","members:write"]},{"oat":["members:read","members:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."},{"name":"member_external_id","in":"path","required":true,"schema":{"type":"string","description":"The member external ID.","title":"Member External Id"},"description":"The member external ID."}],"responses":{"200":{"description":"Member retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"404":{"description":"Member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"The external customer ID matches customers in several accessible organizations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AmbiguousExternalCustomerID"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"get_external"},"patch":{"tags":["customers","members","public"],"summary":"Update Member by External ID","description":"Update a member by external ID for a customer identified by its external ID.\n\n**Scopes**: `members:write`","operationId":"customers:members:update_external","security":[{"oidc":["members:write"]},{"pat":["members:write"]},{"oat":["members:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."},{"name":"member_external_id","in":"path","required":true,"schema":{"type":"string","description":"The member external ID.","title":"Member External Id"},"description":"The member external ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberUpdate"}}}},"responses":{"200":{"description":"Member updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"404":{"description":"Member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"The external customer ID matches customers in several accessible organizations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AmbiguousExternalCustomerID"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"update_external"},"delete":{"tags":["customers","members","public"],"summary":"Delete Member by External ID","description":"Delete a member by external ID for a customer identified by its external ID.\n\n**Scopes**: `members:write`","operationId":"customers:members:delete_external","security":[{"oidc":["members:write"]},{"pat":["members:write"]},{"oat":["members:write"]}],"parameters":[{"name":"external_id","in":"path","required":true,"schema":{"type":"string","description":"The customer external ID.","title":"External Id"},"description":"The customer external ID."},{"name":"member_external_id","in":"path","required":true,"schema":{"type":"string","description":"The member external ID.","title":"Member External Id"},"description":"The member external ID."}],"responses":{"204":{"description":"Member deleted."},"404":{"description":"Member not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"The external customer ID matches customers in several accessible organizations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AmbiguousExternalCustomerID"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customers.members","x-speakeasy-name-override":"delete_external"}},"/v1/customer-portal/benefit-grants/":{"get":{"tags":["customer_portal","benefit-grants","public"],"summary":"List Benefit Grants","description":"List benefits grants of the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:benefit-grants:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by benefit description.","title":"Query"},"description":"Filter by benefit description."},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/BenefitType"},{"type":"array","items":{"$ref":"#/components/schemas/BenefitType"}},{"type":"null"}],"title":"BenefitType Filter","description":"Filter by benefit type."},"description":"Filter by benefit type."},{"name":"benefit_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"BenefitID Filter","description":"Filter by benefit ID."},"description":"Filter by benefit ID."},{"name":"checkout_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"CheckoutID Filter","description":"Filter by checkout ID."},"description":"Filter by checkout ID."},{"name":"order_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The order ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The order ID."}},{"type":"null"}],"title":"OrderID Filter","description":"Filter by order ID."},"description":"Filter by order ID."},{"name":"subscription_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The subscription ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The subscription ID."}},{"type":"null"}],"title":"SubscriptionID Filter","description":"Filter by subscription ID."},"description":"Filter by subscription ID."},{"name":"member_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"MemberID Filter","description":"Filter by member ID."},"description":"Filter by member ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerBenefitGrantSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["product_benefit","-granted_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerBenefitGrant_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.benefit-grants","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerBenefitGrant"}}}},"/v1/customer-portal/benefit-grants/{id}":{"get":{"tags":["customer_portal","benefit-grants","public"],"summary":"Get Benefit Grant","description":"Get a benefit grant by ID for the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:benefit-grants:get","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The benefit grant ID.","title":"Id"},"description":"The benefit grant ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerBenefitGrant","title":"CustomerBenefitGrant"}}}},"404":{"description":"Benefit grant not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.benefit-grants","x-speakeasy-name-override":"get"},"patch":{"tags":["customer_portal","benefit-grants","public"],"summary":"Update Benefit Grant","description":"Update a benefit grant for the authenticated customer.\n\n**Scopes**: `customer_portal:write`","operationId":"customer_portal:benefit-grants:update","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The benefit grant ID.","title":"Id"},"description":"The benefit grant ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerBenefitGrantUpdate","title":"CustomerBenefitGrantUpdate"}}}},"responses":{"200":{"description":"Benefit grant updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerBenefitGrant","title":"CustomerBenefitGrant"}}}},"403":{"description":"The benefit grant is revoked and cannot be updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"Benefit grant not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.benefit-grants","x-speakeasy-name-override":"update"}},"/v1/customer-portal/customers/me":{"get":{"tags":["customer_portal","customers","public"],"summary":"Get Customer","description":"Get authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:customers:get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalCustomer"}}}}},"security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"get"},"patch":{"tags":["customer_portal","customers","public"],"summary":"Update Customer","description":"Update authenticated customer.","operationId":"customer_portal:customers:update","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalCustomerUpdate"}}},"required":true},"responses":{"200":{"description":"Customer updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalCustomer"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"update"}},"/v1/customer-portal/customers/me/payment-methods":{"get":{"tags":["customer_portal","customers","public"],"summary":"List Customer Payment Methods","description":"Get saved payment methods of the authenticated customer.","operationId":"customer_portal:customers:list_payment_methods","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerPaymentMethod_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"list_payment_methods","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerPaymentMethod"}}},"post":{"tags":["customer_portal","customers","public"],"summary":"Add Customer Payment Method","description":"Add a payment method to the authenticated customer.","operationId":"customer_portal:customers:add_payment_method","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPaymentMethodCreate"}}}},"responses":{"201":{"description":"Payment method created or setup initiated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPaymentMethodCreateResponse","title":"CustomerPaymentMethodCreateResponse"}}}},"400":{"description":"The card was declined while setting up the payment method.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodSetupFailed"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"add_payment_method"}},"/v1/customer-portal/customers/me/payment-methods/confirm":{"post":{"tags":["customer_portal","customers","public"],"summary":"Confirm Customer Payment Method","description":"Confirm a payment method for the authenticated customer.","operationId":"customer_portal:customers:confirm_payment_method","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPaymentMethodConfirm"}}},"required":true},"responses":{"201":{"description":"Payment method created or setup initiated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPaymentMethodCreateResponse","title":"CustomerPaymentMethodCreateResponse"}}}},"400":{"description":"Customer is not ready to confirm a payment method.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNotReady"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"confirm_payment_method"}},"/v1/customer-portal/customers/me/payment-methods/{id}":{"delete":{"tags":["customer_portal","customers","public"],"summary":"Delete Customer Payment Method","description":"Delete a payment method from the authenticated customer.","operationId":"customer_portal:customers:delete_payment_method","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Id"}}],"responses":{"204":{"description":"Payment method deleted."},"400":{"description":"Payment method is used by active subscription(s).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodInUseByActiveSubscription"}}}},"404":{"description":"Payment method not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"delete_payment_method"}},"/v1/customer-portal/customers/me/email-update/request":{"post":{"tags":["customer_portal","customers","public"],"summary":"Request Email Change","description":"Request an email change for the authenticated customer.","operationId":"customer_portal:customers:request_email_update","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerEmailUpdateRequest"}}},"required":true},"responses":{"202":{"description":"Verification email sent.","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"request_email_update"}},"/v1/customer-portal/customers/me/email-update/check":{"get":{"tags":["customer_portal","customers","public"],"summary":"Check Email Change Token","description":"Check if an email change verification token is still valid.","operationId":"customer_portal:customers:check_email_update","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"204":{"description":"Token is valid."},"401":{"description":"Invalid or expired verification token."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"check_email_update"}},"/v1/customer-portal/customers/me/email-update/verify":{"post":{"tags":["customer_portal","customers","public"],"summary":"Verify Email Change","description":"Verify an email change using the token from the verification email.","operationId":"customer_portal:customers:verify_email_update","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerEmailUpdateVerifyRequest"}}},"required":true},"responses":{"200":{"description":"Email updated successfully. Returns a new session token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerEmailUpdateVerifyResponse"}}}},"401":{"description":"Invalid or expired verification token."},"422":{"description":"Email address is already in use."}},"x-speakeasy-group":"customer_portal.customers","x-speakeasy-name-override":"verify_email_update"}},"/v1/customer-portal/meters/":{"get":{"tags":["customer_portal","customer_meters","public"],"summary":"List Meters","description":"List meters of the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:customer_meters:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"meter_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The meter ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The meter ID."}},{"type":"null"}],"title":"MeterID Filter","description":"Filter by meter ID."},"description":"Filter by meter ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by meter name.","title":"Query"},"description":"Filter by meter name."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerCustomerMeterSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-modified_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerCustomerMeter_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.customer_meters","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerCustomerMeter"}}}},"/v1/customer-portal/meters/{id}":{"get":{"tags":["customer_portal","customer_meters","public"],"summary":"Get Customer Meter","description":"Get a meter by ID for the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:customer_meters:get","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer meter ID.","title":"Id"},"description":"The customer meter ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCustomerMeter"}}}},"404":{"description":"Customer meter not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.customer_meters","x-speakeasy-name-override":"get"}},"/v1/customer-portal/seats":{"get":{"tags":["customer_portal","seats","public"],"summary":"List Seats","description":"**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:seats:list_seats","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"subscription_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"description":"Subscription ID","title":"Subscription Id"},"description":"Subscription ID"},{"name":"order_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"description":"Order ID","title":"Order Id"},"description":"Order ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeatsList"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Subscription or order not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.seats","x-speakeasy-name-override":"list_seats"},"post":{"tags":["customer_portal","seats","public"],"summary":"Assign Seat","operationId":"customer_portal:seats:assign_seat","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeatAssign"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeat"}}}},"400":{"description":"No available seats or customer already has a seat"},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Subscription, order, or customer not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.seats","x-speakeasy-name-override":"assign_seat"}},"/v1/customer-portal/seats/{seat_id}":{"delete":{"tags":["customer_portal","seats","public"],"summary":"Revoke Seat","operationId":"customer_portal:seats:revoke_seat","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"seat_id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Seat Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeat"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Seat not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.seats","x-speakeasy-name-override":"revoke_seat"}},"/v1/customer-portal/seats/{seat_id}/resend":{"post":{"tags":["customer_portal","seats","public"],"summary":"Resend Invitation","operationId":"customer_portal:seats:resend_invitation","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"seat_id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Seat Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeat"}}}},"400":{"description":"Seat is not pending or already claimed"},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Seat not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.seats","x-speakeasy-name-override":"resend_invitation"}},"/v1/customer-portal/seats/subscriptions":{"get":{"tags":["customer_portal","seats","public"],"summary":"List Claimed Subscriptions","description":"List all subscriptions where the authenticated customer has claimed a seat.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:seats:list_claimed_subscriptions","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerSubscription_"}}}},"401":{"description":"Authentication required"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.seats","x-speakeasy-name-override":"list_claimed_subscriptions","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerSubscription"}}}},"/v1/customer-portal/customer-session/introspect":{"get":{"tags":["customer_portal","customer-session","public"],"summary":"Introspect Customer Session","description":"Introspect the current session and return its information.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:customer-session:introspect","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCustomerSession"}}}}},"security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.customer-session","x-speakeasy-name-override":"introspect"}},"/v1/customer-portal/customer-session/user":{"get":{"tags":["customer_portal","customer-session","public"],"summary":"Get Authenticated Portal User","description":"Get information about the currently authenticated portal user.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:customer-session:get_authenticated_user","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalAuthenticatedUser"}}}}},"security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.customer-session","x-speakeasy-name-override":"get_authenticated_user"}},"/v1/customer-portal/downloadables/":{"get":{"tags":["customer_portal","downloadables","public"],"summary":"List Downloadables","description":"**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:downloadables:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"benefit_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The benefit ID."}},{"type":"null"}],"title":"BenefitID Filter","description":"Filter by benefit ID."},"description":"Filter by benefit ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_DownloadableRead_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.downloadables","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/DownloadableRead"}}}},"/v1/customer-portal/license-keys/":{"get":{"tags":["customer_portal","license_keys","public"],"summary":"List License Keys","description":"**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:license_keys:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"benefit_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"null"}],"description":"Filter by a specific benefit","title":"Benefit Id"},"description":"Filter by a specific benefit"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_LicenseKeyRead_"}}}},"401":{"description":"Not authorized to manage license key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unauthorized"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.license_keys","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/LicenseKeyRead"}}}},"/v1/customer-portal/license-keys/{id}":{"get":{"tags":["customer_portal","license_keys","public"],"summary":"Get License Key","description":"Get a license key.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:license_keys:get","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyWithActivations"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.license_keys","x-speakeasy-name-override":"get"}},"/v1/customer-portal/license-keys/validate":{"post":{"tags":["customer_portal","license_keys","public"],"summary":"Validate License Key","description":"Validate a license key.\n\n> This endpoint doesn't require authentication and can be safely used on a public\n> client, like a desktop application or a mobile app.\n> If you plan to validate a license key on a server, use the `/v1/license-keys/validate`\n> endpoint instead.","operationId":"customer_portal:license_keys:validate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyValidate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidatedLicenseKey"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.license_keys","x-speakeasy-name-override":"validate"}},"/v1/customer-portal/license-keys/activate":{"post":{"tags":["customer_portal","license_keys","public"],"summary":"Activate License Key","description":"Activate a license key instance.\n\n> This endpoint doesn't require authentication and can be safely used on a public\n> client, like a desktop application or a mobile app.\n> If you plan to validate a license key on a server, use the `/v1/license-keys/activate`\n> endpoint instead.","operationId":"customer_portal:license_keys:activate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyActivate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyActivationRead"}}}},"403":{"description":"License key activation not supported or limit reached. Use /validate endpoint for licenses without activations.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotPermitted"}}}},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.license_keys","x-speakeasy-name-override":"activate"}},"/v1/customer-portal/license-keys/deactivate":{"post":{"tags":["customer_portal","license_keys","public"],"summary":"Deactivate License Key","description":"Deactivate a license key instance.\n\n> This endpoint doesn't require authentication and can be safely used on a public\n> client, like a desktop application or a mobile app.\n> If you plan to validate a license key on a server, use the `/v1/license-keys/deactivate`\n> endpoint instead.","operationId":"customer_portal:license_keys:deactivate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseKeyDeactivate"}}},"required":true},"responses":{"204":{"description":"License key activation deactivated."},"404":{"description":"License key not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.license_keys","x-speakeasy-name-override":"deactivate"}},"/v1/customer-portal/members":{"get":{"tags":["customer_portal","members","public"],"summary":"List Members","description":"List all members of the customer's team.\n\nOnly available to owners and billing managers of team customers.","operationId":"customer_portal:members:list_members","security":[{"member_session":["customer_portal:write"]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerPortalMember_"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not permitted - requires owner or billing manager role"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.members","x-speakeasy-name-override":"list_members","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerPortalMember"}}},"post":{"tags":["customer_portal","members","public"],"summary":"Add Member","description":"Add a new member to the customer's team.\n\nOnly available to owners and billing managers of team customers.\n\nRules:\n- Cannot add a member with the owner role (there must be exactly one owner)\n- If a member with this email already exists, the existing member is returned","operationId":"customer_portal:members:add_member","security":[{"member_session":["customer_portal:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalMemberCreate"}}}},"responses":{"201":{"description":"Member added.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalMember"}}}},"400":{"description":"Invalid request or member already exists."},"401":{"description":"Authentication required"},"403":{"description":"Not permitted - requires owner or billing manager role"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.members","x-speakeasy-name-override":"add_member"}},"/v1/customer-portal/members/{id}":{"patch":{"tags":["customer_portal","members","public"],"summary":"Update Member","description":"Update a member's name or role.\n\nOnly available to owners and billing managers of team customers.\n\nRules:\n- Cannot modify your own role (to prevent self-demotion)\n- Customer must have exactly one owner at all times","operationId":"customer_portal:members:update_member","security":[{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalMemberUpdate"}}}},"responses":{"200":{"description":"Member updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerPortalMember"}}}},"400":{"description":"Invalid role change."},"401":{"description":"Authentication required"},"403":{"description":"Not permitted - requires owner or billing manager role"},"404":{"description":"Member not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.members","x-speakeasy-name-override":"update_member"},"delete":{"tags":["customer_portal","members","public"],"summary":"Remove Member","description":"Remove a member from the team.\n\nOnly available to owners and billing managers of team customers.\n\nRules:\n- Cannot remove yourself\n- Cannot remove the only owner","operationId":"customer_portal:members:remove_member","security":[{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"204":{"description":"Member removed."},"400":{"description":"Cannot remove the only owner."},"401":{"description":"Authentication required"},"403":{"description":"Not permitted - requires owner or billing manager role"},"404":{"description":"Member not found."},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.members","x-speakeasy-name-override":"remove_member"}},"/v1/customer-portal/orders/":{"get":{"tags":["customer_portal","orders","public"],"summary":"List Orders","description":"List orders of the authenticated customer.","operationId":"customer_portal:orders:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"product_billing_type","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ProductBillingType"},{"type":"array","items":{"$ref":"#/components/schemas/ProductBillingType"}},{"type":"null"}],"title":"ProductBillingType Filter","description":"Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},"description":"Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases."},{"name":"subscription_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The subscription ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The subscription ID."}},{"type":"null"}],"title":"SubscriptionID Filter","description":"Filter by subscription ID."},"description":"Filter by subscription ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search by product or organization name.","title":"Query"},"description":"Search by product or organization name."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerOrderSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerOrder_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerOrder"}}}},"/v1/customer-portal/orders/{id}":{"get":{"tags":["customer_portal","orders","public"],"summary":"Get Order","description":"Get an order by ID for the authenticated customer.","operationId":"customer_portal:orders:get","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrder"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"get"},"patch":{"tags":["customer_portal","orders","public"],"summary":"Update Order","description":"Update an order for the authenticated customer.","operationId":"customer_portal:orders:update","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrderUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrder"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"update"}},"/v1/customer-portal/orders/{id}/invoice":{"post":{"tags":["customer_portal","orders","public"],"summary":"Generate Order Invoice","description":"Trigger generation of an order's invoice.","operationId":"customer_portal:orders:generate_invoice","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"Order is not eligible for invoice generation (invalid status).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderNotEligibleForInvoice"}}}},"422":{"description":"Order is missing billing name or address.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissingInvoiceBillingDetails"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"generate_invoice"},"get":{"tags":["customer_portal","orders","public"],"summary":"Get Order Invoice","description":"Get an order's invoice data.","operationId":"customer_portal:orders:invoice","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrderInvoice"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"invoice"}},"/v1/customer-portal/orders/{id}/receipt":{"get":{"tags":["customer_portal","orders","public"],"summary":"Get Order Receipt","description":"Get a presigned URL to download an order's receipt PDF.","operationId":"customer_portal:orders:receipt","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrderReceipt"}}}},"202":{"description":"Receipt generation in progress."},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"receipt"}},"/v1/customer-portal/orders/{id}/payment-status":{"get":{"tags":["customer_portal","orders","public"],"summary":"Get Order Payment Status","description":"Get the current payment status for an order.","operationId":"customer_portal:orders:get_payment_status","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrderPaymentStatus"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"get_payment_status"}},"/v1/customer-portal/orders/{id}/confirm-payment":{"post":{"tags":["customer_portal","orders","public"],"summary":"Confirm Retry Payment","description":"Confirm a retry payment using a Stripe confirmation token.","operationId":"customer_portal:orders:confirm_retry_payment","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The order ID.","title":"Id"},"description":"The order ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrderConfirmPayment"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrderPaymentConfirmation"}}}},"404":{"description":"Order not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"409":{"description":"Payment already in progress.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentAlreadyInProgress"}}}},"422":{"description":"Order not eligible for retry or payment confirmation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderNotEligibleForRetry"}}}},"429":{"description":"Manual retry limit exceeded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualRetryLimitExceeded"}}}}},"x-speakeasy-group":"customer_portal.orders","x-speakeasy-name-override":"confirm_retry_payment"}},"/v1/customer-portal/organizations/{slug}":{"get":{"tags":["customer_portal","organizations","public"],"summary":"Get Organization","description":"Get a customer portal's organization by slug.","operationId":"customer_portal:organizations:get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","description":"The organization slug.","title":"Slug"},"description":"The organization slug."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerOrganizationData"}}}},"404":{"description":"Organization not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.organizations","x-speakeasy-name-override":"get"}},"/v1/customer-portal/subscriptions/":{"get":{"tags":["customer_portal","subscriptions","public"],"summary":"List Subscriptions","description":"List subscriptions of the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:subscriptions:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"product_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The product ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The product ID."}},{"type":"null"}],"title":"ProductID Filter","description":"Filter by product ID."},"description":"Filter by product ID."},{"name":"active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by active or cancelled subscription.","title":"Active"},"description":"Filter by active or cancelled subscription."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search by product or organization name.","title":"Query"},"description":"Search by product or organization name."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerSubscriptionSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-started_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerSubscription_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.subscriptions","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerSubscription"}}}},"/v1/customer-portal/subscriptions/{id}":{"get":{"tags":["customer_portal","subscriptions","public"],"summary":"Get Subscription","description":"Get a subscription for the authenticated customer.\n\n**Scopes**: `customer_portal:read` `customer_portal:write`","operationId":"customer_portal:subscriptions:get","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The subscription ID.","title":"Id"},"description":"The subscription ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSubscription"}}}},"404":{"description":"Customer subscription was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Customer","Member"],"x-speakeasy-group":"customer_portal.subscriptions","x-speakeasy-name-override":"get"},"patch":{"tags":["customer_portal","subscriptions","public"],"summary":"Update Subscription","description":"Update a subscription of the authenticated customer.","operationId":"customer_portal:subscriptions:update","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The subscription ID.","title":"Id"},"description":"The subscription ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSubscriptionUpdate"}}}},"responses":{"200":{"description":"Customer subscription updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSubscription"}}}},"402":{"description":"Payment required to apply the subscription update.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentFailed"}}}},"403":{"description":"Customer subscription is already canceled or will be at the end of the period, the user lacks billing permissions, or pausing/resuming is not enabled for the organization.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/AlreadyCanceledSubscription"},{"$ref":"#/components/schemas/PauseResumeNotAllowed"}],"title":"Response 403 Customer Portal:Subscriptions:Update"}}}},"404":{"description":"Customer subscription was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.subscriptions","x-speakeasy-name-override":"update"},"delete":{"tags":["customer_portal","subscriptions","public"],"summary":"Cancel Subscription","description":"Cancel a subscription of the authenticated customer.","operationId":"customer_portal:subscriptions:cancel","security":[{"customer_session":["customer_portal:write"]},{"member_session":["customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The subscription ID.","title":"Id"},"description":"The subscription ID."}],"responses":{"200":{"description":"Customer subscription is canceled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSubscription"}}}},"403":{"description":"Customer subscription is already canceled or will be at the end of the period, or the user lacks billing permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlreadyCanceledSubscription"}}}},"404":{"description":"Customer subscription was not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.subscriptions","x-speakeasy-name-override":"cancel"}},"/v1/customer-portal/wallets/":{"get":{"tags":["customer_portal","wallets","public"],"summary":"List Wallets","description":"List wallets of the authenticated customer.","operationId":"customer_portal:wallets:list","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerWalletSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerWallet_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_portal.wallets","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerWallet"}}}},"/v1/customer-portal/wallets/{id}":{"get":{"tags":["customer_portal","wallets","public"],"summary":"Get Wallet","description":"Get a wallet by ID for the authenticated customer.","operationId":"customer_portal:wallets:get","security":[{"customer_session":["customer_portal:read","customer_portal:write"]},{"member_session":["customer_portal:read","customer_portal:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The wallet ID.","title":"Id"},"description":"The wallet ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerWallet"}}}},"404":{"description":"Wallet not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer_portal.wallets","x-speakeasy-name-override":"get"}},"/v1/customer-seats":{"post":{"tags":["customer-seats","public"],"summary":"Assign Seat","description":"**Scopes**: `customer_seats:write`","operationId":"customer-seats:assign_seat","security":[{"oidc":["customer_seats:write"]},{"pat":["customer_seats:write"]},{"oat":["customer_seats:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeatAssign"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeat"}}}},"400":{"description":"No available seats or customer already has a seat"},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Subscription, order, or customer not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customer-seats","x-speakeasy-name-override":"assign_seat"},"get":{"tags":["customer-seats","public"],"summary":"List Seats","description":"**Scopes**: `customer_seats:read`","operationId":"customer-seats:list_seats","security":[{"oidc":["customer_seats:read"]},{"pat":["customer_seats:read"]},{"oat":["customer_seats:read"]}],"parameters":[{"name":"subscription_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"}},{"name":"order_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeatsList"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Subscription or order not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customer-seats","x-speakeasy-name-override":"list_seats"}},"/v1/customer-seats/{seat_id}":{"delete":{"tags":["customer-seats","public"],"summary":"Revoke Seat","description":"**Scopes**: `customer_seats:write`","operationId":"customer-seats:revoke_seat","security":[{"oidc":["customer_seats:write"]},{"pat":["customer_seats:write"]},{"oat":["customer_seats:write"]}],"parameters":[{"name":"seat_id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Seat Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeat"}}}},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Seat not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customer-seats","x-speakeasy-name-override":"revoke_seat"}},"/v1/customer-seats/{seat_id}/resend":{"post":{"tags":["customer-seats","public"],"summary":"Resend Invitation","description":"**Scopes**: `customer_seats:write`","operationId":"customer-seats:resend_invitation","security":[{"oidc":["customer_seats:write"]},{"pat":["customer_seats:write"]},{"oat":["customer_seats:write"]}],"parameters":[{"name":"seat_id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","title":"Seat Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeat"}}}},"400":{"description":"Seat is not pending or already claimed"},"401":{"description":"Authentication required"},"403":{"description":"Not permitted or seat-based pricing not enabled"},"404":{"description":"Seat not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customer-seats","x-speakeasy-name-override":"resend_invitation"}},"/v1/customer-seats/claim/{invitation_token}":{"get":{"tags":["customer-seats","public"],"summary":"Get Claim Info","operationId":"customer-seats:get_claim_info","parameters":[{"name":"invitation_token","in":"path","required":true,"schema":{"type":"string","title":"Invitation Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeatClaimInfo"}}}},"400":{"description":"Invalid or expired invitation token"},"403":{"description":"Seat-based pricing not enabled for organization"},"404":{"description":"Seat not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer-seats","x-speakeasy-name-override":"get_claim_info"}},"/v1/customer-seats/claim":{"post":{"tags":["customer-seats","public"],"summary":"Claim Seat","operationId":"customer-seats:claim_seat","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeatClaim"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSeatClaimResponse"}}}},"400":{"description":"Invalid, expired, or already claimed token"},"403":{"description":"Seat-based pricing not enabled for organization"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-speakeasy-group":"customer-seats","x-speakeasy-name-override":"claim_seat"}},"/v1/customer-sessions/":{"post":{"tags":["customer-sessions","public"],"summary":"Create Customer Session","description":"Create a customer session.\n\nFor organizations with `member_model_enabled`, this will automatically\ncreate a member session for the owner member of the customer.\n\n**Scopes**: `customer_sessions:write`","operationId":"customer-sessions:create","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomerSessionCustomerIDCreate"},{"$ref":"#/components/schemas/CustomerSessionCustomerExternalIDCreate"}],"title":"Customer Session Create"}}},"required":true},"responses":{"201":{"description":"Customer session created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerSession"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"oidc":["customer_sessions:write"]},{"pat":["customer_sessions:write"]},{"oat":["customer_sessions:write"]}],"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customer-sessions","x-speakeasy-name-override":"create"}},"/v1/events/":{"get":{"tags":["events","public"],"summary":"List Events","description":"List events.\n\n**Scopes**: `events:read` `events:write`","operationId":"events:list","security":[{"oidc":["events:read","events:write"]},{"pat":["events:read","events:write"]},{"oat":["events:read","events:write"]}],"parameters":[{"name":"filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter events following filter clauses. JSON string following the same schema a meter filter clause. ","title":"Filter"},"description":"Filter events following filter clauses. JSON string following the same schema a meter filter clause. "},{"name":"start_timestamp","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter events after this timestamp.","title":"Start Timestamp"},"description":"Filter events after this timestamp."},{"name":"end_timestamp","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter events before this timestamp.","title":"End Timestamp"},"description":"Filter events before this timestamp."},{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by external customer ID."},"description":"Filter by external customer ID."},{"name":"meter_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The meter ID."},{"type":"null"}],"title":"MeterID Filter","description":"Filter by a meter filter clause."},"description":"Filter by a meter filter clause."},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Name Filter","description":"Filter by event name."},"description":"Filter by event name."},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/EventSource"},{"type":"array","items":{"$ref":"#/components/schemas/EventSource"}},{"type":"null"}],"title":"Source Filter","description":"Filter by event source."},"description":"Filter by event source."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Query to filter events."},"description":"Query to filter events."},{"name":"parent_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The event ID."},{"type":"null"}],"description":"When combined with depth, use this event as the anchor instead of root events.","title":"Parent Id"},"description":"When combined with depth, use this event as the anchor instead of root events."},{"name":"depth","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":5,"minimum":0},{"type":"null"}],"description":"Fetch descendants up to this depth. When set: 0=root events only, 1=roots+children, etc. Max 5. When not set, returns all events.","title":"Depth"},"description":"Fetch descendants up to this depth. When set: 0=root events only, 1=roots+children, etc. Max 5. When not set, returns all events."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-timestamp"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/ListResource_Event_"},{"$ref":"#/components/schemas/ListResourceWithCursorPagination_Event_"}],"title":"Response Events:List"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"events","x-speakeasy-name-override":"list"}},"/v1/events/names":{"get":{"tags":["events","public"],"summary":"List Event Names","description":"List event names.\n\n**Scopes**: `events:read` `events:write`","operationId":"events:list_names","security":[{"oidc":["events:read","events:write"]},{"pat":["events:read","events:write"]},{"oat":["events:read","events:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by external customer ID."},"description":"Filter by external customer ID."},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/EventSource"},{"type":"array","items":{"$ref":"#/components/schemas/EventSource"}},{"type":"null"}],"title":"Source Filter","description":"Filter by event source."},"description":"Filter by event source."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Query to filter event names."},"description":"Query to filter event names."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventNamesSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-last_seen"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_EventName_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"events","x-speakeasy-name-override":"list_names","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/EventName"}}}},"/v1/events/{id}":{"get":{"tags":["events","public"],"summary":"Get Event","description":"Get an event by ID.\n\n**Scopes**: `events:read` `events:write`","operationId":"events:get","security":[{"oidc":["events:read","events:write"]},{"pat":["events:read","events:write"]},{"oat":["events:read","events:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The event ID.","title":"Id"},"description":"The event ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"404":{"description":"Event not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"events","x-speakeasy-name-override":"get"}},"/v1/events/ingest":{"post":{"tags":["events","public"],"summary":"Ingest Events","description":"Ingest batch of events.\n\n**Scopes**: `events:write`","operationId":"events:ingest","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsIngest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventsIngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"oidc":["events:write"]},{"pat":["events:write"]},{"oat":["events:write"]}],"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"events","x-speakeasy-name-override":"ingest"}},"/v1/event-types/":{"get":{"tags":["event-types","public"],"summary":"List Event Types","description":"List event types with aggregated statistics.\n\n**Scopes**: `events:read` `events:write`","operationId":"event-types:list","security":[{"oidc":["events:read","events:write"]},{"pat":["events:read","events:write"]},{"oat":["events:read","events:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by external customer ID."},"description":"Filter by external customer ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","description":"Query to filter event types by name or label."},"description":"Query to filter event types by name or label."},{"name":"root_events","in":"query","required":false,"schema":{"type":"boolean","title":"Root Events Filter","description":"When true, only return event types with root events (parent_id IS NULL).","default":false},"description":"When true, only return event types with root events (parent_id IS NULL)."},{"name":"parent_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"ParentID Filter","description":"Filter by specific parent event ID."},"description":"Filter by specific parent event ID."},{"name":"source","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/EventSource"},{"type":"null"}],"title":"EventSource Filter","description":"Filter by event source (system or user)."},"description":"Filter by event source (system or user)."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/EventTypesSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-last_seen"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_EventTypeWithStats_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"event-types","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/EventTypeWithStats"}}}},"/v1/event-types/{id}":{"patch":{"tags":["event-types","public"],"summary":"Update Event Type","description":"Update an event type's label.\n\n**Scopes**: `events:write`","operationId":"event-types:update","security":[{"oidc":["events:write"]},{"pat":["events:write"]},{"oat":["events:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The event type ID.","title":"Id"},"description":"The event type ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventTypeUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventType"}}}},"404":{"description":"Not Found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"event-types","x-speakeasy-name-override":"update"}},"/v1/meters/":{"get":{"tags":["meters","public"],"summary":"List Meters","description":"List meters.\n\n**Scopes**: `meters:read` `meters:write`","operationId":"meters:list","security":[{"oidc":["meters:read","meters:write"]},{"pat":["meters:read","meters:write"]},{"oat":["meters:read","meters:write"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by name.","title":"Query"},"description":"Filter by name."},{"name":"is_archived","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter on archived meters.","title":"Is Archived"},"description":"Filter on archived meters."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/MeterSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["name"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Meter_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"meters","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Meter"}}},"post":{"tags":["meters","public"],"summary":"Create Meter","description":"Create a meter.\n\n**Scopes**: `meters:write`","operationId":"meters:create","security":[{"oidc":["meters:write"]},{"pat":["meters:write"]},{"oat":["meters:write"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterCreate"}}}},"responses":{"201":{"description":"Meter created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Meter"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"meters","x-speakeasy-name-override":"create"}},"/v1/meters/{id}":{"get":{"tags":["meters","public"],"summary":"Get Meter","description":"Get a meter by ID.\n\n**Scopes**: `meters:read` `meters:write`","operationId":"meters:get","security":[{"oidc":["meters:read","meters:write"]},{"pat":["meters:read","meters:write"]},{"oat":["meters:read","meters:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The meter ID.","title":"Id"},"description":"The meter ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Meter"}}}},"404":{"description":"Meter not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"meters","x-speakeasy-name-override":"get"},"patch":{"tags":["meters","public"],"summary":"Update Meter","description":"Update a meter.\n\n**Scopes**: `meters:write`","operationId":"meters:update","security":[{"oidc":["meters:write"]},{"pat":["meters:write"]},{"oat":["meters:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The meter ID.","title":"Id"},"description":"The meter ID."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterUpdate"}}}},"responses":{"200":{"description":"Meter updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Meter"}}}},"404":{"description":"Meter not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"meters","x-speakeasy-name-override":"update"}},"/v1/meters/{id}/quantities":{"get":{"tags":["meters","public"],"summary":"Get Meter Quantities","description":"Get quantities of a meter over a time period.\n\n**Scopes**: `meters:read` `meters:write`","operationId":"meters:quantities","security":[{"oidc":["meters:read","meters:write"]},{"pat":["meters:read","meters:write"]},{"oat":["meters:read","meters:write"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The meter ID.","title":"Id"},"description":"The meter ID."},{"name":"start_timestamp","in":"query","required":true,"schema":{"type":"string","format":"date-time","description":"Start timestamp.","title":"Start Timestamp"},"description":"Start timestamp."},{"name":"end_timestamp","in":"query","required":true,"schema":{"type":"string","format":"date-time","description":"End timestamp.","title":"End Timestamp"},"description":"End timestamp."},{"name":"interval","in":"query","required":true,"schema":{"$ref":"#/components/schemas/TimeInterval","description":"Interval between two timestamps."},"description":"Interval between two timestamps."},{"name":"timezone","in":"query","required":false,"schema":{"type":"string","minLength":1,"description":"Timezone to use for the timestamps. Default is UTC.","enum":["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Asmera","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Timbuktu","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/ComodRivadavia","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Atka","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Buenos_Aires","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Catamarca","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Coral_Harbour","America/Cordoba","America/Costa_Rica","America/Coyhaique","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Ensenada","America/Fort_Nelson","America/Fort_Wayne","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Indianapolis","America/Inuvik","America/Iqaluit","America/Jamaica","America/Jujuy","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Knox_IN","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Louisville","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Mendoza","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Acre","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Rosario","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Virgin","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Ashkhabad","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Chungking","Asia/Colombo","Asia/Dacca","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Istanbul","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Kolkata","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macao","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Saigon","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Tel_Aviv","Asia/Thimbu","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ujung_Pandang","Asia/Ulaanbaatar","Asia/Ulan_Bator","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faeroe","Atlantic/Faroe","Atlantic/Jan_Mayen","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/ACT","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Canberra","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/LHI","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/NSW","Australia/North","Australia/Perth","Australia/Queensland","Australia/South","Australia/Sydney","Australia/Tasmania","Australia/Victoria","Australia/West","Australia/Yancowinna","Brazil/Acre","Brazil/DeNoronha","Brazil/East","Brazil/West","CET","CST6CDT","Canada/Atlantic","Canada/Central","Canada/Eastern","Canada/Mountain","Canada/Newfoundland","Canada/Pacific","Canada/Saskatchewan","Canada/Yukon","Chile/Continental","Chile/EasterIsland","Cuba","EET","EST","EST5EDT","Egypt","Eire","Etc/GMT","Etc/GMT+0","Etc/GMT+1","Etc/GMT+10","Etc/GMT+11","Etc/GMT+12","Etc/GMT+2","Etc/GMT+3","Etc/GMT+4","Etc/GMT+5","Etc/GMT+6","Etc/GMT+7","Etc/GMT+8","Etc/GMT+9","Etc/GMT-0","Etc/GMT-1","Etc/GMT-10","Etc/GMT-11","Etc/GMT-12","Etc/GMT-13","Etc/GMT-14","Etc/GMT-2","Etc/GMT-3","Etc/GMT-4","Etc/GMT-5","Etc/GMT-6","Etc/GMT-7","Etc/GMT-8","Etc/GMT-9","Etc/GMT0","Etc/Greenwich","Etc/UCT","Etc/UTC","Etc/Universal","Etc/Zulu","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belfast","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Nicosia","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Tiraspol","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Factory","GB","GB-Eire","GMT","GMT+0","GMT-0","GMT0","Greenwich","HST","Hongkong","Iceland","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Iran","Israel","Jamaica","Japan","Kwajalein","Libya","MET","MST","MST7MDT","Mexico/BajaNorte","Mexico/BajaSur","Mexico/General","NZ","NZ-CHAT","Navajo","PRC","PST8PDT","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Samoa","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","Pacific/Yap","Poland","Portugal","ROC","ROK","Singapore","Turkey","UCT","US/Alaska","US/Aleutian","US/Arizona","US/Central","US/East-Indiana","US/Eastern","US/Hawaii","US/Indiana-Starke","US/Michigan","US/Mountain","US/Pacific","US/Samoa","UTC","Universal","W-SU","WET","Zulu","localtime"],"default":"UTC","title":"Timezone"},"description":"Timezone to use for the timestamps. Default is UTC."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by external customer ID."},"description":"Filter by external customer ID."},{"name":"customer_aggregation_function","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/AggregationFunction"},{"type":"null"}],"description":"If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.","title":"Customer Aggregation Function"},"description":"If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events."},{"name":"metadata","in":"query","required":false,"style":"deepObject","schema":{"$ref":"#/components/schemas/MetadataQuery"},"description":"Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeterQuantities"}}}},"404":{"description":"Meter not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"meters","x-speakeasy-name-override":"quantities"}},"/v1/customer-meters/":{"get":{"tags":["customer_meters","public"],"summary":"List Customer Meters","description":"List customer meters.\n\n**Scopes**: `customer_meters:read`","operationId":"customer_meters:list","security":[{"oidc":["customer_meters:read"]},{"pat":["customer_meters:read"]},{"oat":["customer_meters:read"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"external_customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"ExternalCustomerID Filter","description":"Filter by external customer ID."},"description":"Filter by external customer ID."},{"name":"meter_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The meter ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The meter ID."}},{"type":"null"}],"title":"MeterID Filter","description":"Filter by meter ID."},"description":"Filter by meter ID."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/CustomerMeterSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-modified_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_CustomerMeter_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"customer_meters","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/CustomerMeter"}}}},"/v1/customer-meters/{id}":{"get":{"tags":["customer_meters","public"],"summary":"Get Customer Meter","description":"Get a customer meter by ID.\n\n**Scopes**: `customer_meters:read`","operationId":"customer_meters:get","security":[{"oidc":["customer_meters:read"]},{"pat":["customer_meters:read"]},{"oat":["customer_meters:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The customer meter ID.","title":"Id"},"description":"The customer meter ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerMeter"}}}},"404":{"description":"Customer meter not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"customer_meters","x-speakeasy-name-override":"get"}},"/v1/payments/":{"get":{"tags":["payments","public"],"summary":"List Payments","description":"List payments.\n\n**Scopes**: `payments:read`","operationId":"payments:list","security":[{"oidc":["payments:read"]},{"pat":["payments:read"]},{"oat":["payments:read"]}],"parameters":[{"name":"organization_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."},{"type":"array","items":{"type":"string","format":"uuid4","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"],"description":"The organization ID."}},{"type":"null"}],"title":"OrganizationID Filter","description":"Filter by organization ID."},"description":"Filter by organization ID."},{"name":"checkout_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"CheckoutID Filter","description":"Filter by checkout ID."},"description":"Filter by checkout ID."},{"name":"order_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"array","items":{"type":"string","format":"uuid4"}},{"type":"null"}],"title":"OrderID Filter","description":"Filter by order ID."},"description":"Filter by order ID."},{"name":"customer_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid4","description":"The customer ID."},{"type":"array","items":{"type":"string","format":"uuid4","description":"The customer ID."}},{"type":"null"}],"title":"CustomerID Filter","description":"Filter by customer ID."},"description":"Filter by customer ID."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/PaymentStatus"},{"type":"array","items":{"$ref":"#/components/schemas/PaymentStatus"}},{"type":"null"}],"title":"Status Filter","description":"Filter by payment status."},"description":"Filter by payment status."},{"name":"method","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Method Filter","description":"Filter by payment method."},"description":"Filter by payment method."},{"name":"customer_email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"CustomerEmail Filter","description":"Filter by customer email."},"description":"Filter by customer email."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Page number, defaults to 1.","default":1,"title":"Page"},"description":"Page number, defaults to 1."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","exclusiveMinimum":0,"description":"Size of a page, defaults to 10. Maximum is 100.","default":10,"title":"Limit"},"description":"Size of a page, defaults to 10. Maximum is 100."},{"name":"sorting","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"$ref":"#/components/schemas/PaymentSortProperty"}},{"type":"null"}],"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order.","default":["-created_at"],"title":"Sorting"},"description":"Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListResource_Payment_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-pagination":{"type":"offsetLimit","inputs":[{"name":"page","in":"parameters","type":"page"},{"name":"limit","in":"parameters","type":"limit"}],"outputs":{"results":"$.items","numPages":"$.pagination.max_page"}},"x-speakeasy-group":"payments","x-speakeasy-name-override":"list","x-polar-pagination":{"type":"page_limit","item_schema":{"$ref":"#/components/schemas/Payment"}}}},"/v1/payments/{id}":{"get":{"tags":["payments","public"],"summary":"Get Payment","description":"Get a payment by ID.\n\n**Scopes**: `payments:read`","operationId":"payments:get","security":[{"oidc":["payments:read"]},{"pat":["payments:read"]},{"oat":["payments:read"]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid4","description":"The payment ID.","title":"Id"},"description":"The payment ID."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"404":{"description":"Payment not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceNotFound"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-polar-allowed-subjects":["Organization","User"],"x-speakeasy-group":"payments","x-speakeasy-name-override":"get"}}},"webhooks":{"checkout.created":{"post":{"summary":"checkout.created","description":"Sent when a new checkout is created.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcheckout_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCheckoutCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"checkout.updated":{"post":{"summary":"checkout.updated","description":"Sent when a checkout is updated.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcheckout_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCheckoutUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"checkout.expired":{"post":{"summary":"checkout.expired","description":"Sent when a checkout expires.\n\nThis event fires when a checkout reaches its expiration time without being completed.\nDevelopers can use this to send reminder emails or track checkout abandonment.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcheckout_expired_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCheckoutExpiredPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer.created":{"post":{"summary":"customer.created","description":"Sent when a new customer is created.\n\nA customer can be created:\n\n* After a successful checkout.\n* Programmatically via the API.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcustomer_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer.updated":{"post":{"summary":"customer.updated","description":"Sent when a customer is updated.\n\nThis event is fired when the customer details are updated.\n\nIf you want to be notified when a customer subscription or benefit state changes, you should listen to the `customer_state_changed` event.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcustomer_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer.deleted":{"post":{"summary":"customer.deleted","description":"Sent when a customer is deleted.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcustomer_deleted_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerDeletedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer.state_changed":{"post":{"summary":"customer.state_changed","description":"Sent when a customer state has changed.\n\nIt's triggered when:\n\n* Customer is created, updated or deleted.\n* A subscription is created or updated.\n* A benefit is granted or revoked.\n\n**Discord & Slack support:** Basic","operationId":"_endpointcustomer_state_changed_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerStateChangedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer_seat.assigned":{"post":{"summary":"customer_seat.assigned","description":"Sent when a new customer seat is assigned.\n\nThis event is triggered when a seat is assigned to a customer by the organization.\nThe customer will receive an invitation email to claim the seat.","operationId":"_endpointcustomer_seat_assigned_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerSeatAssignedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer_seat.claimed":{"post":{"summary":"customer_seat.claimed","description":"Sent when a customer seat is claimed.\n\nThis event is triggered when a customer accepts the seat invitation and claims their access.","operationId":"_endpointcustomer_seat_claimed_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerSeatClaimedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"customer_seat.revoked":{"post":{"summary":"customer_seat.revoked","description":"Sent when a customer seat is revoked.\n\nThis event is triggered when access to a seat is revoked, either manually by the organization or automatically when a subscription is canceled.","operationId":"_endpointcustomer_seat_revoked_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCustomerSeatRevokedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"member.created":{"post":{"summary":"member.created","description":"Sent when a new member is created.\n\nA member represents an individual within a customer (team).\nThis event is triggered when a member is added to a customer,\neither programmatically via the API or when an owner is automatically\ncreated for a new customer.\n\n**Discord & Slack support:** Basic","operationId":"_endpointmember_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookMemberCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"member.updated":{"post":{"summary":"member.updated","description":"Sent when a member is updated.\n\nThis event is triggered when member details are updated,\nsuch as their name or role within the customer.\n\n**Discord & Slack support:** Basic","operationId":"_endpointmember_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookMemberUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"member.deleted":{"post":{"summary":"member.deleted","description":"Sent when a member is deleted.\n\nThis event is triggered when a member is removed from a customer.\nAny active seats assigned to the member will be automatically revoked.\n\n**Discord & Slack support:** Basic","operationId":"_endpointmember_deleted_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookMemberDeletedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"order.created":{"post":{"summary":"order.created","description":"Sent when a new order is created.\n\nA new order is created when:\n\n* A customer purchases a one-time product. In this case, `billing_reason` is set to `purchase`.\n* A customer starts a subscription. In this case, `billing_reason` is set to `subscription_create`.\n* A subscription is renewed. In this case, `billing_reason` is set to `subscription_cycle`.\n* A subscription is upgraded or downgraded with an immediate proration invoice. In this case, `billing_reason` is set to `subscription_update`.\n\n> [!WARNING]\n> The order might not be paid yet, so the `status` field might be `pending`.\n\n**Discord & Slack support:** Full","operationId":"_endpointorder_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookOrderCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"order.updated":{"post":{"summary":"order.updated","description":"Sent when an order is updated.\n\nAn order is updated when:\n\n* Its status changes, e.g. from `pending` to `paid`.\n* It's refunded, partially or fully.\n\n**Discord & Slack support:** Full","operationId":"_endpointorder_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookOrderUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"order.paid":{"post":{"summary":"order.paid","description":"Sent when an order is paid.\n\nWhen you receive this event, the order is fully processed and payment has been received.\n\n**Discord & Slack support:** Full","operationId":"_endpointorder_paid_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookOrderPaidPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"order.refunded":{"post":{"summary":"order.refunded","description":"Sent when an order is fully or partially refunded.\n\n**Discord & Slack support:** Full","operationId":"_endpointorder_refunded_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookOrderRefundedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.created":{"post":{"summary":"subscription.created","description":"Sent when a new subscription is created.\n\nWhen this event occurs, the subscription `status` might not be `active` yet, as we can still have to wait for the first payment to be processed.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.updated":{"post":{"summary":"subscription.updated","description":"Sent when a subscription is updated. This event fires for all changes to the subscription, including renewals.\n\nIf you want more specific events, you can listen to `subscription.active`, `subscription.canceled`, `subscription.past_due`, and `subscription.revoked`.\n\nTo listen specifically for renewals, you can listen to `order.created` events and check the `billing_reason` field.\n\n**Discord & Slack support:** On cancellation, past due, and revocation. Renewals are skipped.","operationId":"_endpointsubscription_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.active":{"post":{"summary":"subscription.active","description":"Sent when a subscription becomes active,\nwhether because it's a new paid subscription or because payment was recovered.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_active_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionActivePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.canceled":{"post":{"summary":"subscription.canceled","description":"Sent when a subscription is canceled.\nCustomers might still have access until the end of the current period.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_canceled_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionCanceledPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.uncanceled":{"post":{"summary":"subscription.uncanceled","description":"Sent when a customer revokes a pending cancellation.\n\nWhen a customer cancels with \"at period end\", they retain access until the\nsubscription would renew. During this time, they can change their mind and\nundo the cancellation. This event is triggered when they do so.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_uncanceled_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionUncanceledPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.revoked":{"post":{"summary":"subscription.revoked","description":"Sent when a subscription is revoked and the user loses access immediately.\nHappens when the subscription is canceled or payment retries are exhausted (status becomes `unpaid`).\n\nFor payment failures that can still be recovered, see `subscription.past_due`.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_revoked_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionRevokedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.past_due":{"post":{"summary":"subscription.past_due","description":"Sent when a subscription payment fails and the subscription enters `past_due` status.\n\nThis is a recoverable state - the customer can update their payment method to restore the subscription.\nBenefits may be revoked depending on the organization's grace period settings.\n\nIf payment retries are exhausted, a `subscription.revoked` event will be sent.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_past_due_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionPastDuePayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.paused":{"post":{"summary":"subscription.paused","description":"Sent when a subscription is paused and the customer temporarily loses access.\n\nNo order is created while paused. The subscription resumes either on its\nscheduled resume date or when resumed manually, starting a new billing period.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_paused_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionPausedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"subscription.resumed":{"post":{"summary":"subscription.resumed","description":"Sent when a paused subscription resumes, restoring the customer's access.\n\nResuming starts a new billing period and charges the customer immediately.\n\n**Discord & Slack support:** Full","operationId":"_endpointsubscription_resumed_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionResumedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"refund.created":{"post":{"summary":"refund.created","description":"Sent when a refund is created regardless of status.\n\n**Discord & Slack support:** Full","operationId":"_endpointrefund_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRefundCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"refund.updated":{"post":{"summary":"refund.updated","description":"Sent when a refund is updated.\n\n**Discord & Slack support:** Full","operationId":"_endpointrefund_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookRefundUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"product.created":{"post":{"summary":"product.created","description":"Sent when a new product is created.\n\n**Discord & Slack support:** Basic","operationId":"_endpointproduct_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookProductCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"product.updated":{"post":{"summary":"product.updated","description":"Sent when a product is updated.\n\n**Discord & Slack support:** Basic","operationId":"_endpointproduct_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookProductUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"organization.updated":{"post":{"summary":"organization.updated","description":"Sent when a organization is updated.\n\n**Discord & Slack support:** Basic","operationId":"_endpointorganization_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookOrganizationUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"benefit.created":{"post":{"summary":"benefit.created","description":"Sent when a new benefit is created.\n\n**Discord & Slack support:** Basic","operationId":"_endpointbenefit_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBenefitCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"benefit.updated":{"post":{"summary":"benefit.updated","description":"Sent when a benefit is updated.\n\n**Discord & Slack support:** Basic","operationId":"_endpointbenefit_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBenefitUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"benefit_grant.created":{"post":{"summary":"benefit_grant.created","description":"Sent when a new benefit grant is created.\n\n**Discord & Slack support:** Basic","operationId":"_endpointbenefit_grant_created_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBenefitGrantCreatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"benefit_grant.updated":{"post":{"summary":"benefit_grant.updated","description":"Sent when a benefit grant is updated.\n\n**Discord & Slack support:** Basic","operationId":"_endpointbenefit_grant_updated_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBenefitGrantUpdatedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"benefit_grant.cycled":{"post":{"summary":"benefit_grant.cycled","description":"Sent when a benefit grant is cycled,\nmeaning the related subscription has been renewed for another period.\n\n**Discord & Slack support:** Basic","operationId":"_endpointbenefit_grant_cycled_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBenefitGrantCycledPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"benefit_grant.revoked":{"post":{"summary":"benefit_grant.revoked","description":"Sent when a benefit grant is revoked.\n\n**Discord & Slack support:** Basic","operationId":"_endpointbenefit_grant_revoked_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBenefitGrantRevokedPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Address":{"properties":{"line1":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Line1"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Line2"},"postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Code"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"},"country":{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2","examples":["US","SE","FR"],"x-speakeasy-enums":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]}},"type":"object","required":["country"],"title":"Address"},"AddressDict":{"properties":{"line1":{"type":"string","title":"Line1"},"line2":{"type":"string","title":"Line2"},"postal_code":{"type":"string","title":"Postal Code"},"city":{"type":"string","title":"City"},"state":{"type":"string","title":"State"},"country":{"type":"string","title":"Country"}},"type":"object","required":["country"],"title":"AddressDict"},"AddressInput":{"properties":{"line1":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Line1"},"line2":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Line2"},"postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Postal Code"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"},"country":{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2Input","examples":["US","SE","FR"],"x-speakeasy-enums":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]}},"type":"object","required":["country"],"title":"AddressInput"},"AggregateField":{"type":"string","maxLength":255,"minLength":1},"AggregationFunction":{"type":"string","enum":["count","sum","max","min","avg","unique"],"title":"AggregationFunction"},"AlreadyActiveSubscriptionError":{"properties":{"error":{"type":"string","const":"AlreadyActiveSubscriptionError","title":"Error","examples":["AlreadyActiveSubscriptionError"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"AlreadyActiveSubscriptionError"},"AlreadyCanceledSubscription":{"properties":{"error":{"type":"string","const":"AlreadyCanceledSubscription","title":"Error","examples":["AlreadyCanceledSubscription"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"AlreadyCanceledSubscription"},"AmbiguousExternalCustomerID":{"properties":{"error":{"type":"string","const":"AmbiguousExternalCustomerID","title":"Error","examples":["AmbiguousExternalCustomerID"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"AmbiguousExternalCustomerID"},"AttachedCustomField":{"properties":{"custom_field_id":{"type":"string","format":"uuid4","title":"Custom Field Id","description":"ID of the custom field."},"custom_field":{"$ref":"#/components/schemas/CustomField","title":"CustomField"},"order":{"type":"integer","title":"Order","description":"Order of the custom field in the resource."},"required":{"type":"boolean","title":"Required","description":"Whether the value is required for this custom field."}},"type":"object","required":["custom_field_id","custom_field","order","required"],"title":"AttachedCustomField","description":"Schema of a custom field attached to a resource."},"AttachedCustomFieldCreate":{"properties":{"custom_field_id":{"type":"string","format":"uuid4","title":"Custom Field Id","description":"ID of the custom field to attach."},"required":{"type":"boolean","title":"Required","description":"Whether the value is required for this custom field."}},"type":"object","required":["custom_field_id","required"],"title":"AttachedCustomFieldCreate","description":"Schema to attach a custom field to a resource."},"AuthorizeOrganization":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"slug":{"type":"string","title":"Slug"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"}},"type":"object","required":["id","slug","avatar_url"],"title":"AuthorizeOrganization"},"AuthorizeResponseOrganization":{"properties":{"client":{"$ref":"#/components/schemas/OAuth2ClientPublic"},"sub_type":{"type":"string","const":"organization","title":"Sub Type"},"sub":{"anyOf":[{"$ref":"#/components/schemas/AuthorizeOrganization"},{"type":"null"}]},"scopes":{"items":{"$ref":"#/components/schemas/Scope"},"type":"array","title":"Scopes"},"organizations":{"items":{"$ref":"#/components/schemas/AuthorizeOrganization"},"type":"array","title":"Organizations"},"requires_single_organization":{"type":"boolean","title":"Requires Single Organization","default":false},"scope_display_names":{"additionalProperties":{"type":"string"},"type":"object","title":"Scope Display Names","default":{"openid":"OpenID","profile":"Read your profile","email":"Read your email address","user:read":"Read your user account","user:write":"Manage your user account","organizations:read":"Read your organizations","organizations:write":"Create or modify organizations","custom_fields:read":"Read custom fields","custom_fields:write":"Create or modify custom fields","discounts:read":"Read discounts","discounts:write":"Create or modify discounts","checkout_links:read":"Read checkout links","checkout_links:write":"Create or modify checkout links","checkouts:read":"Read checkout sessions","checkouts:write":"Create or modify checkout sessions","transactions:read":"Read transactions","transactions:write":"Create or modify transactions","payouts:read":"Read payouts","payouts:write":"Create or modify payouts","products:read":"Read products","products:write":"Create or modify products","benefits:read":"Read benefits","benefits:write":"Create or modify benefits","events:read":"Read events","events:write":"Create events","meters:read":"Read meters","meters:write":"Create or modify meters","files:read":"Read file uploads","files:write":"Create or modify file uploads","subscriptions:read":"Read subscriptions made on your organizations","subscriptions:write":"Create or modify subscriptions made on your organizations","customers:read":"Read customers","customers:write":"Create or modify customers","members:read":"Read members","members:write":"Create or modify members","wallets:read":"Read wallets","wallets:write":"Create or modify wallets","disputes:read":"Read disputes","disputes:write":"Create or modify disputes","customer_meters:read":"Read customer meters","customer_sessions:write":"Create or modify customer sessions","member_sessions:write":"Create or modify member sessions","customer_seats:read":"Read customer seats","customer_seats:write":"Create or modify customer seats","orders:read":"Read orders made on your organizations","orders:write":"Modify orders made on your organizations","refunds:read":"Read refunds made on your organizations","refunds:write":"Create or modify refunds","payments:read":"Read payments made on your organizations","metrics:read":"Read metrics","metrics:write":"Create or modify metric definitions","webhooks:read":"Read webhooks","webhooks:write":"Create or modify webhooks","license_keys:read":"Read license keys","license_keys:write":"Modify license keys","customer_portal:read":"Read your orders, subscriptions and benefits","customer_portal:write":"Create or modify your orders, subscriptions and benefits","notifications:read":"Read notifications","notifications:write":"Mark notifications as read","notification_recipients:read":"Read notification recipients","notification_recipients:write":"Create or modify notification recipients","organization_access_tokens:read":"Read organization access tokens","organization_access_tokens:write":"Create or modify organization access tokens"}}},"type":"object","required":["client","sub_type","sub","scopes","organizations"],"title":"AuthorizeResponseOrganization"},"AuthorizeResponseUser":{"properties":{"client":{"$ref":"#/components/schemas/OAuth2ClientPublic"},"sub_type":{"type":"string","const":"user","title":"Sub Type"},"sub":{"anyOf":[{"$ref":"#/components/schemas/AuthorizeUser"},{"type":"null"}]},"scopes":{"items":{"$ref":"#/components/schemas/Scope"},"type":"array","title":"Scopes"},"organizations":{"items":{"$ref":"#/components/schemas/AuthorizeOrganization"},"type":"array","title":"Organizations"},"requires_single_organization":{"type":"boolean","title":"Requires Single Organization","default":false},"scope_display_names":{"additionalProperties":{"type":"string"},"type":"object","title":"Scope Display Names","default":{"openid":"OpenID","profile":"Read your profile","email":"Read your email address","user:read":"Read your user account","user:write":"Manage your user account","organizations:read":"Read your organizations","organizations:write":"Create or modify organizations","custom_fields:read":"Read custom fields","custom_fields:write":"Create or modify custom fields","discounts:read":"Read discounts","discounts:write":"Create or modify discounts","checkout_links:read":"Read checkout links","checkout_links:write":"Create or modify checkout links","checkouts:read":"Read checkout sessions","checkouts:write":"Create or modify checkout sessions","transactions:read":"Read transactions","transactions:write":"Create or modify transactions","payouts:read":"Read payouts","payouts:write":"Create or modify payouts","products:read":"Read products","products:write":"Create or modify products","benefits:read":"Read benefits","benefits:write":"Create or modify benefits","events:read":"Read events","events:write":"Create events","meters:read":"Read meters","meters:write":"Create or modify meters","files:read":"Read file uploads","files:write":"Create or modify file uploads","subscriptions:read":"Read subscriptions made on your organizations","subscriptions:write":"Create or modify subscriptions made on your organizations","customers:read":"Read customers","customers:write":"Create or modify customers","members:read":"Read members","members:write":"Create or modify members","wallets:read":"Read wallets","wallets:write":"Create or modify wallets","disputes:read":"Read disputes","disputes:write":"Create or modify disputes","customer_meters:read":"Read customer meters","customer_sessions:write":"Create or modify customer sessions","member_sessions:write":"Create or modify member sessions","customer_seats:read":"Read customer seats","customer_seats:write":"Create or modify customer seats","orders:read":"Read orders made on your organizations","orders:write":"Modify orders made on your organizations","refunds:read":"Read refunds made on your organizations","refunds:write":"Create or modify refunds","payments:read":"Read payments made on your organizations","metrics:read":"Read metrics","metrics:write":"Create or modify metric definitions","webhooks:read":"Read webhooks","webhooks:write":"Create or modify webhooks","license_keys:read":"Read license keys","license_keys:write":"Modify license keys","customer_portal:read":"Read your orders, subscriptions and benefits","customer_portal:write":"Create or modify your orders, subscriptions and benefits","notifications:read":"Read notifications","notifications:write":"Mark notifications as read","notification_recipients:read":"Read notification recipients","notification_recipients:write":"Create or modify notification recipients","organization_access_tokens:read":"Read organization access tokens","organization_access_tokens:write":"Create or modify organization access tokens"}}},"type":"object","required":["client","sub_type","sub","scopes","organizations"],"title":"AuthorizeResponseUser"},"AuthorizeUser":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"email":{"type":"string","format":"email","title":"Email"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"}},"type":"object","required":["id","email","avatar_url"],"title":"AuthorizeUser"},"BalanceCreditOrderEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"balance.credit_order","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BalanceCreditOrderMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BalanceCreditOrderEvent","description":"An event created by Polar when an order is paid via customer balance."},"BalanceCreditOrderMetadata":{"properties":{"order_id":{"type":"string","title":"Order Id"},"product_id":{"type":"string","title":"Product Id"},"subscription_id":{"type":"string","title":"Subscription Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"tax_amount":{"type":"integer","title":"Tax Amount"},"tax_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax State"},"tax_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Country"},"fee":{"type":"integer","title":"Fee"},"exchange_rate":{"type":"number","title":"Exchange Rate"}},"type":"object","required":["order_id","amount","currency","tax_amount","fee"],"title":"BalanceCreditOrderMetadata"},"BalanceDisputeEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"balance.dispute","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BalanceDisputeMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BalanceDisputeEvent","description":"An event created by Polar when an order is disputed."},"BalanceDisputeMetadata":{"properties":{"transaction_id":{"type":"string","title":"Transaction Id"},"dispute_id":{"type":"string","title":"Dispute Id"},"order_id":{"type":"string","title":"Order Id"},"order_created_at":{"type":"string","title":"Order Created At"},"product_id":{"type":"string","title":"Product Id"},"subscription_id":{"type":"string","title":"Subscription Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"presentment_amount":{"type":"integer","title":"Presentment Amount"},"presentment_currency":{"type":"string","title":"Presentment Currency"},"tax_amount":{"type":"integer","title":"Tax Amount"},"tax_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax State"},"tax_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Country"},"fee":{"type":"integer","title":"Fee"},"exchange_rate":{"type":"number","title":"Exchange Rate"}},"type":"object","required":["transaction_id","dispute_id","amount","currency","presentment_amount","presentment_currency","tax_amount","fee"],"title":"BalanceDisputeMetadata"},"BalanceDisputeReversalEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"balance.dispute_reversal","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BalanceDisputeMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BalanceDisputeReversalEvent","description":"An event created by Polar when a dispute is won and funds are reinstated."},"BalanceOrderEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"balance.order","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BalanceOrderMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BalanceOrderEvent","description":"An event created by Polar when an order is paid."},"BalanceOrderMetadata":{"properties":{"transaction_id":{"type":"string","title":"Transaction Id"},"order_id":{"type":"string","title":"Order Id"},"product_id":{"type":"string","title":"Product Id"},"subscription_id":{"type":"string","title":"Subscription Id"},"amount":{"type":"integer","title":"Amount"},"net_amount":{"type":"integer","title":"Net Amount"},"currency":{"type":"string","title":"Currency"},"presentment_amount":{"type":"integer","title":"Presentment Amount"},"presentment_currency":{"type":"string","title":"Presentment Currency"},"tax_amount":{"type":"integer","title":"Tax Amount"},"tax_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax State"},"tax_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Country"},"fee":{"type":"integer","title":"Fee"},"exchange_rate":{"type":"number","title":"Exchange Rate"}},"type":"object","required":["transaction_id","order_id","amount","currency","presentment_amount","presentment_currency","tax_amount","fee"],"title":"BalanceOrderMetadata"},"BalanceRefundEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"balance.refund","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BalanceRefundMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BalanceRefundEvent","description":"An event created by Polar when an order is refunded."},"BalanceRefundMetadata":{"properties":{"transaction_id":{"type":"string","title":"Transaction Id"},"refund_id":{"type":"string","title":"Refund Id"},"order_id":{"type":"string","title":"Order Id"},"order_created_at":{"type":"string","title":"Order Created At"},"product_id":{"type":"string","title":"Product Id"},"subscription_id":{"type":"string","title":"Subscription Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"presentment_amount":{"type":"integer","title":"Presentment Amount"},"presentment_currency":{"type":"string","title":"Presentment Currency"},"refundable_amount":{"type":"integer","title":"Refundable Amount"},"tax_amount":{"type":"integer","title":"Tax Amount"},"tax_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax State"},"tax_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Country"},"fee":{"type":"integer","title":"Fee"},"exchange_rate":{"type":"number","title":"Exchange Rate"}},"type":"object","required":["transaction_id","refund_id","amount","currency","presentment_amount","presentment_currency","tax_amount","fee"],"title":"BalanceRefundMetadata"},"BalanceRefundReversalEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"balance.refund_reversal","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BalanceRefundMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BalanceRefundReversalEvent","description":"An event created by Polar when a refund is reverted."},"Benefit":{"oneOf":[{"$ref":"#/components/schemas/BenefitCustom"},{"$ref":"#/components/schemas/BenefitDiscord"},{"$ref":"#/components/schemas/BenefitGitHubRepository"},{"$ref":"#/components/schemas/BenefitDownloadables"},{"$ref":"#/components/schemas/BenefitLicenseKeys"},{"$ref":"#/components/schemas/BenefitMeterCredit"},{"$ref":"#/components/schemas/BenefitFeatureFlag"},{"$ref":"#/components/schemas/BenefitSlackSharedChannel"}],"discriminator":{"propertyName":"type","mapping":{"custom":"#/components/schemas/BenefitCustom","discord":"#/components/schemas/BenefitDiscord","downloadables":"#/components/schemas/BenefitDownloadables","feature_flag":"#/components/schemas/BenefitFeatureFlag","github_repository":"#/components/schemas/BenefitGitHubRepository","license_keys":"#/components/schemas/BenefitLicenseKeys","meter_credit":"#/components/schemas/BenefitMeterCredit","slack_shared_channel":"#/components/schemas/BenefitSlackSharedChannel"}}},"BenefitCreate":{"oneOf":[{"$ref":"#/components/schemas/BenefitCustomCreate"},{"$ref":"#/components/schemas/BenefitDiscordCreate"},{"$ref":"#/components/schemas/BenefitGitHubRepositoryCreate"},{"$ref":"#/components/schemas/BenefitDownloadablesCreate"},{"$ref":"#/components/schemas/BenefitLicenseKeysCreate"},{"$ref":"#/components/schemas/BenefitMeterCreditCreate"},{"$ref":"#/components/schemas/BenefitFeatureFlagCreate"},{"$ref":"#/components/schemas/BenefitSlackSharedChannelCreate"}],"discriminator":{"propertyName":"type","mapping":{"custom":"#/components/schemas/BenefitCustomCreate","discord":"#/components/schemas/BenefitDiscordCreate","downloadables":"#/components/schemas/BenefitDownloadablesCreate","feature_flag":"#/components/schemas/BenefitFeatureFlagCreate","github_repository":"#/components/schemas/BenefitGitHubRepositoryCreate","license_keys":"#/components/schemas/BenefitLicenseKeysCreate","meter_credit":"#/components/schemas/BenefitMeterCreditCreate","slack_shared_channel":"#/components/schemas/BenefitSlackSharedChannelCreate"}}},"BenefitCustom":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"custom","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitCustomProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitCustom","description":"A benefit of type `custom`.\n\nUse it to grant any kind of benefit that doesn't fit in the other types."},"BenefitCustomCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"custom","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitCustomCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitCustomCreate","description":"Schema to create a benefit of type `custom`."},"BenefitCustomCreateProperties":{"properties":{"note":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Private note to be shared with customers who have this benefit granted."},{"type":"null"}],"title":"Note"}},"type":"object","title":"BenefitCustomCreateProperties","description":"Properties for creating a benefit of type `custom`."},"BenefitCustomProperties":{"properties":{"note":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Private note to be shared with customers who have this benefit granted."},{"type":"null"}],"title":"Note"}},"type":"object","required":["note"],"title":"BenefitCustomProperties","description":"Properties for a benefit of type `custom`."},"BenefitCustomSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"custom","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitCustomSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitCustomSubscriber"},"BenefitCustomSubscriberProperties":{"properties":{"note":{"anyOf":[{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Private note to be shared with customers who have this benefit granted."},{"type":"null"}],"title":"Note"}},"type":"object","required":["note"],"title":"BenefitCustomSubscriberProperties","description":"Properties available to subscribers for a benefit of type `custom`."},"BenefitCustomUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"type":{"type":"string","const":"custom","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitCustomProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitCustomUpdate"},"BenefitCycledEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"benefit.cycled","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BenefitGrantMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BenefitCycledEvent","description":"An event created by Polar when a benefit is cycled."},"BenefitDiscord":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"discord","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitDiscordProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitDiscord","description":"A benefit of type `discord`.\n\nUse it to automatically invite your backers to a Discord server."},"BenefitDiscordCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"discord","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitDiscordCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitDiscordCreate"},"BenefitDiscordCreateProperties":{"properties":{"guild_token":{"type":"string","title":"Guild Token"},"role_id":{"type":"string","title":"Role Id","description":"The ID of the Discord role to grant."},"kick_member":{"type":"boolean","title":"Kick Member","description":"Whether to kick the member from the Discord server on revocation."}},"type":"object","required":["guild_token","role_id","kick_member"],"title":"BenefitDiscordCreateProperties","description":"Properties to create a benefit of type `discord`."},"BenefitDiscordProperties":{"properties":{"guild_id":{"type":"string","title":"Guild Id","description":"The ID of the Discord server."},"role_id":{"type":"string","title":"Role Id","description":"The ID of the Discord role to grant."},"kick_member":{"type":"boolean","title":"Kick Member","description":"Whether to kick the member from the Discord server on revocation."},"guild_token":{"type":"string","title":"Guild Token","readOnly":true}},"type":"object","required":["guild_id","role_id","kick_member","guild_token"],"title":"BenefitDiscordProperties","description":"Properties for a benefit of type `discord`."},"BenefitDiscordSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"discord","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitDiscordSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitDiscordSubscriber"},"BenefitDiscordSubscriberProperties":{"properties":{"guild_id":{"type":"string","title":"Guild Id","description":"The ID of the Discord server."}},"type":"object","required":["guild_id"],"title":"BenefitDiscordSubscriberProperties","description":"Properties available to subscribers for a benefit of type `discord`."},"BenefitDiscordUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"type":{"type":"string","const":"discord","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitDiscordCreateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitDiscordUpdate"},"BenefitDownloadables":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"downloadables","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitDownloadablesProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitDownloadables"},"BenefitDownloadablesCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"downloadables","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitDownloadablesCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitDownloadablesCreate"},"BenefitDownloadablesCreateProperties":{"properties":{"archived":{"additionalProperties":{"type":"boolean"},"propertyNames":{"format":"uuid4"},"type":"object","title":"Archived","default":{}},"files":{"items":{"type":"string","format":"uuid4"},"type":"array","minItems":1,"title":"Files"}},"type":"object","required":["files"],"title":"BenefitDownloadablesCreateProperties"},"BenefitDownloadablesProperties":{"properties":{"archived":{"additionalProperties":{"type":"boolean"},"propertyNames":{"format":"uuid4"},"type":"object","title":"Archived"},"files":{"items":{"type":"string","format":"uuid4"},"type":"array","title":"Files"}},"type":"object","required":["archived","files"],"title":"BenefitDownloadablesProperties"},"BenefitDownloadablesSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"downloadables","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitDownloadablesSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitDownloadablesSubscriber"},"BenefitDownloadablesSubscriberProperties":{"properties":{"active_files":{"items":{"type":"string","format":"uuid4"},"type":"array","title":"Active Files"}},"type":"object","required":["active_files"],"title":"BenefitDownloadablesSubscriberProperties"},"BenefitDownloadablesUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"type":{"type":"string","const":"downloadables","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitDownloadablesCreateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitDownloadablesUpdate"},"BenefitFeatureFlag":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"feature_flag","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitFeatureFlagProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitFeatureFlag","description":"A benefit of type `feature_flag`.\n\nUse it to grant feature flags with key-value metadata\nthat can be queried via the API and webhooks."},"BenefitFeatureFlagCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"feature_flag","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitFeatureFlagCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitFeatureFlagCreate","description":"Schema to create a benefit of type `feature_flag`."},"BenefitFeatureFlagCreateProperties":{"properties":{},"type":"object","title":"BenefitFeatureFlagCreateProperties","description":"Properties for creating a benefit of type `feature_flag`."},"BenefitFeatureFlagProperties":{"properties":{},"type":"object","title":"BenefitFeatureFlagProperties","description":"Properties for a benefit of type `feature_flag`."},"BenefitFeatureFlagSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"feature_flag","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitFeatureFlagSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitFeatureFlagSubscriber"},"BenefitFeatureFlagSubscriberProperties":{"properties":{},"type":"object","title":"BenefitFeatureFlagSubscriberProperties","description":"Properties available to subscribers for a benefit of type `feature_flag`."},"BenefitFeatureFlagUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"type":{"type":"string","const":"feature_flag","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitFeatureFlagProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitFeatureFlagUpdate"},"BenefitGitHubRepository":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"github_repository","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitGitHubRepositoryProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitGitHubRepository","description":"A benefit of type `github_repository`.\n\nUse it to automatically invite your backers to a private GitHub repository."},"BenefitGitHubRepositoryCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"github_repository","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitGitHubRepositoryCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitGitHubRepositoryCreate"},"BenefitGitHubRepositoryCreateProperties":{"properties":{"repository_owner":{"type":"string","title":"Repository Owner","description":"The owner of the repository.","examples":["polarsource"]},"repository_name":{"type":"string","title":"Repository Name","description":"The name of the repository.","examples":["private_repo"]},"permission":{"type":"string","enum":["pull","triage","push","maintain","admin"],"title":"Permission","description":"The permission level to grant. Read more about roles and their permissions on [GitHub documentation](https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization#permissions-for-each-role)."}},"type":"object","required":["repository_owner","repository_name","permission"],"title":"BenefitGitHubRepositoryCreateProperties","description":"Properties to create a benefit of type `github_repository`."},"BenefitGitHubRepositoryProperties":{"properties":{"repository_owner":{"type":"string","title":"Repository Owner","description":"The owner of the repository.","examples":["polarsource"]},"repository_name":{"type":"string","title":"Repository Name","description":"The name of the repository.","examples":["private_repo"]},"permission":{"type":"string","enum":["pull","triage","push","maintain","admin"],"title":"Permission","description":"The permission level to grant. Read more about roles and their permissions on [GitHub documentation](https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization#permissions-for-each-role)."}},"type":"object","required":["repository_owner","repository_name","permission"],"title":"BenefitGitHubRepositoryProperties","description":"Properties for a benefit of type `github_repository`."},"BenefitGitHubRepositorySubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"github_repository","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitGitHubRepositorySubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitGitHubRepositorySubscriber"},"BenefitGitHubRepositorySubscriberProperties":{"properties":{"repository_owner":{"type":"string","title":"Repository Owner","description":"The owner of the repository.","examples":["polarsource"]},"repository_name":{"type":"string","title":"Repository Name","description":"The name of the repository.","examples":["private_repo"]}},"type":"object","required":["repository_owner","repository_name"],"title":"BenefitGitHubRepositorySubscriberProperties","description":"Properties available to subscribers for a benefit of type `github_repository`."},"BenefitGitHubRepositoryUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"type":{"type":"string","const":"github_repository","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGitHubRepositoryCreateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitGitHubRepositoryUpdate"},"BenefitGrant":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/Benefit","title":"Benefit"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantDiscordProperties"},{"$ref":"#/components/schemas/BenefitGrantGitHubRepositoryProperties"},{"$ref":"#/components/schemas/BenefitGrantDownloadablesProperties"},{"$ref":"#/components/schemas/BenefitGrantLicenseKeysProperties"},{"$ref":"#/components/schemas/BenefitGrantCustomProperties"},{"$ref":"#/components/schemas/BenefitGrantFeatureFlagProperties"},{"$ref":"#/components/schemas/BenefitGrantSlackSharedChannelProperties"}],"title":"Properties"}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrant"},"BenefitGrantCustomProperties":{"properties":{},"type":"object","title":"BenefitGrantCustomProperties"},"BenefitGrantCustomWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitCustom"},"properties":{"$ref":"#/components/schemas/BenefitGrantCustomProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantCustomProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantCustomWebhook"},"BenefitGrantDiscordProperties":{"properties":{"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"},"guild_id":{"type":"string","title":"Guild Id"},"role_id":{"type":"string","title":"Role Id"},"granted_account_id":{"type":"string","title":"Granted Account Id"}},"type":"object","title":"BenefitGrantDiscordProperties"},"BenefitGrantDiscordWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitDiscord"},"properties":{"$ref":"#/components/schemas/BenefitGrantDiscordProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantDiscordProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantDiscordWebhook"},"BenefitGrantDownloadablesProperties":{"properties":{"files":{"items":{"type":"string"},"type":"array","title":"Files"}},"type":"object","title":"BenefitGrantDownloadablesProperties"},"BenefitGrantDownloadablesWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitDownloadables"},"properties":{"$ref":"#/components/schemas/BenefitGrantDownloadablesProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantDownloadablesProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantDownloadablesWebhook"},"BenefitGrantError":{"properties":{"message":{"type":"string","title":"Message"},"type":{"type":"string","title":"Type"},"timestamp":{"type":"string","title":"Timestamp"}},"type":"object","required":["message","type","timestamp"],"title":"BenefitGrantError"},"BenefitGrantFeatureFlagProperties":{"properties":{},"type":"object","title":"BenefitGrantFeatureFlagProperties"},"BenefitGrantFeatureFlagWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitFeatureFlag"},"properties":{"$ref":"#/components/schemas/BenefitGrantFeatureFlagProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantFeatureFlagProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantFeatureFlagWebhook"},"BenefitGrantGitHubRepositoryProperties":{"properties":{"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"},"repository_owner":{"type":"string","title":"Repository Owner"},"repository_name":{"type":"string","title":"Repository Name"},"permission":{"type":"string","enum":["pull","triage","push","maintain","admin"],"title":"Permission"},"granted_account_id":{"type":"string","title":"Granted Account Id"}},"type":"object","title":"BenefitGrantGitHubRepositoryProperties"},"BenefitGrantGitHubRepositoryWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitGitHubRepository"},"properties":{"$ref":"#/components/schemas/BenefitGrantGitHubRepositoryProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantGitHubRepositoryProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantGitHubRepositoryWebhook"},"BenefitGrantLicenseKeysProperties":{"properties":{"user_provided_key":{"type":"string","title":"User Provided Key"},"license_key_id":{"type":"string","title":"License Key Id"},"display_key":{"type":"string","title":"Display Key"}},"type":"object","title":"BenefitGrantLicenseKeysProperties"},"BenefitGrantLicenseKeysWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitLicenseKeys"},"properties":{"$ref":"#/components/schemas/BenefitGrantLicenseKeysProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantLicenseKeysProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantLicenseKeysWebhook"},"BenefitGrantMetadata":{"properties":{"benefit_id":{"type":"string","title":"Benefit Id"},"benefit_grant_id":{"type":"string","title":"Benefit Grant Id"},"benefit_type":{"$ref":"#/components/schemas/BenefitType"},"member_id":{"type":"string","title":"Member Id"}},"type":"object","required":["benefit_id","benefit_grant_id","benefit_type"],"title":"BenefitGrantMetadata"},"BenefitGrantMeterCreditProperties":{"properties":{"last_credited_meter_id":{"type":"string","title":"Last Credited Meter Id"},"last_credited_units":{"type":"integer","title":"Last Credited Units"},"last_credited_at":{"type":"string","title":"Last Credited At"}},"type":"object","title":"BenefitGrantMeterCreditProperties"},"BenefitGrantMeterCreditWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitMeterCredit"},"properties":{"$ref":"#/components/schemas/BenefitGrantMeterCreditProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantMeterCreditProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantMeterCreditWebhook"},"BenefitGrantSlackSharedChannelProperties":{"properties":{"invited_email":{"type":"string","title":"Invited Email"},"channel_id":{"type":"string","title":"Channel Id"},"channel_name":{"type":"string","title":"Channel Name"},"invite_id":{"type":"string","title":"Invite Id"},"invite_url":{"type":"string","title":"Invite Url"},"connected_team_id":{"type":"string","title":"Connected Team Id"}},"type":"object","title":"BenefitGrantSlackSharedChannelProperties"},"BenefitGrantSlackSharedChannelWebhook":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At","description":"The timestamp when the benefit was granted. If `None`, the benefit is not granted."},"is_granted":{"type":"boolean","title":"Is Granted","description":"Whether the benefit is granted."},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"The timestamp when the benefit was revoked. If `None`, the benefit is not revoked."},"is_revoked":{"type":"boolean","title":"Is Revoked","description":"Whether the benefit is revoked."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"The ID of the subscription that granted this benefit."},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order that granted this benefit."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer concerned by this grant."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"The ID of the member concerned by this grant."},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant."},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}],"description":"The error information if the benefit grant failed with an unrecoverable error."},"customer":{"$ref":"#/components/schemas/Customer"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}]},"benefit":{"$ref":"#/components/schemas/BenefitSlackSharedChannel"},"properties":{"$ref":"#/components/schemas/BenefitGrantSlackSharedChannelProperties"},"previous_properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantSlackSharedChannelProperties"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","is_granted","is_revoked","subscription_id","order_id","customer_id","benefit_id","customer","benefit","properties"],"title":"BenefitGrantSlackSharedChannelWebhook"},"BenefitGrantSortProperty":{"type":"string","enum":["created_at","-created_at","granted_at","-granted_at","revoked_at","-revoked_at"],"title":"BenefitGrantSortProperty"},"BenefitGrantWebhook":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantDiscordWebhook"},{"$ref":"#/components/schemas/BenefitGrantCustomWebhook"},{"$ref":"#/components/schemas/BenefitGrantGitHubRepositoryWebhook"},{"$ref":"#/components/schemas/BenefitGrantDownloadablesWebhook"},{"$ref":"#/components/schemas/BenefitGrantLicenseKeysWebhook"},{"$ref":"#/components/schemas/BenefitGrantMeterCreditWebhook"},{"$ref":"#/components/schemas/BenefitGrantFeatureFlagWebhook"},{"$ref":"#/components/schemas/BenefitGrantSlackSharedChannelWebhook"}]},"BenefitGrantedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"benefit.granted","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BenefitGrantMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BenefitGrantedEvent","description":"An event created by Polar when a benefit is granted to a customer."},"BenefitLicenseKeyActivationCreateProperties":{"properties":{"limit":{"type":"integer","maximum":50.0,"exclusiveMinimum":0.0,"title":"Limit"},"enable_customer_admin":{"type":"boolean","title":"Enable Customer Admin"}},"type":"object","required":["limit","enable_customer_admin"],"title":"BenefitLicenseKeyActivationCreateProperties"},"BenefitLicenseKeyActivationProperties":{"properties":{"limit":{"type":"integer","title":"Limit"},"enable_customer_admin":{"type":"boolean","title":"Enable Customer Admin"}},"type":"object","required":["limit","enable_customer_admin"],"title":"BenefitLicenseKeyActivationProperties"},"BenefitLicenseKeyExpirationProperties":{"properties":{"ttl":{"type":"integer","exclusiveMinimum":0.0,"title":"Ttl"},"timeframe":{"type":"string","enum":["year","month","day"],"title":"Timeframe"}},"type":"object","required":["ttl","timeframe"],"title":"BenefitLicenseKeyExpirationProperties"},"BenefitLicenseKeys":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"license_keys","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitLicenseKeysProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitLicenseKeys"},"BenefitLicenseKeysCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"license_keys","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitLicenseKeysCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitLicenseKeysCreate"},"BenefitLicenseKeysCreateProperties":{"properties":{"prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prefix"},"expires":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeyExpirationProperties"},{"type":"null"}]},"activations":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeyActivationCreateProperties"},{"type":"null"}]},"limit_usage":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Limit Usage"}},"type":"object","title":"BenefitLicenseKeysCreateProperties"},"BenefitLicenseKeysProperties":{"properties":{"prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prefix"},"expires":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeyExpirationProperties"},{"type":"null"}]},"activations":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeyActivationProperties"},{"type":"null"}]},"limit_usage":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Usage"}},"type":"object","required":["prefix","expires","activations","limit_usage"],"title":"BenefitLicenseKeysProperties"},"BenefitLicenseKeysSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"license_keys","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitLicenseKeysSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitLicenseKeysSubscriber"},"BenefitLicenseKeysSubscriberProperties":{"properties":{"prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prefix"},"expires":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeyExpirationProperties"},{"type":"null"}]},"activations":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeyActivationProperties"},{"type":"null"}]},"limit_usage":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Usage"}},"type":"object","required":["prefix","expires","activations","limit_usage"],"title":"BenefitLicenseKeysSubscriberProperties"},"BenefitLicenseKeysUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"type":{"type":"string","const":"license_keys","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitLicenseKeysCreateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitLicenseKeysUpdate"},"BenefitMeterCredit":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"meter_credit","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitMeterCreditProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitMeterCredit","description":"A benefit of type `meter_unit`.\n\nUse it to grant a number of units on a specific meter."},"BenefitMeterCreditCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"meter_credit","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitMeterCreditCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitMeterCreditCreate","description":"Schema to create a benefit of type `meter_unit`."},"BenefitMeterCreditCreateProperties":{"properties":{"units":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"exclusiveMinimum":0.0,"title":"Units"},"rollover":{"type":"boolean","title":"Rollover"},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id"}},"type":"object","required":["units","rollover","meter_id"],"title":"BenefitMeterCreditCreateProperties","description":"Properties for creating a benefit of type `meter_unit`."},"BenefitMeterCreditProperties":{"properties":{"units":{"type":"integer","title":"Units"},"rollover":{"type":"boolean","title":"Rollover"},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id"}},"type":"object","required":["units","rollover","meter_id"],"title":"BenefitMeterCreditProperties","description":"Properties for a benefit of type `meter_unit`."},"BenefitMeterCreditSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"meter_credit","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitMeterCreditSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitMeterCreditSubscriber"},"BenefitMeterCreditSubscriberProperties":{"properties":{"units":{"type":"integer","title":"Units"},"rollover":{"type":"boolean","title":"Rollover"},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id"}},"type":"object","required":["units","rollover","meter_id"],"title":"BenefitMeterCreditSubscriberProperties","description":"Properties available to subscribers for a benefit of type `meter_unit`."},"BenefitMeterCreditUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"type":{"type":"string","const":"meter_credit","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitMeterCreditCreateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitMeterCreditUpdate"},"BenefitPublic":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"$ref":"#/components/schemas/BenefitType","description":"The type of the benefit."},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id"],"title":"BenefitPublic"},"BenefitRevokedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"benefit.revoked","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BenefitGrantMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BenefitRevokedEvent","description":"An event created by Polar when a benefit is revoked from a customer."},"BenefitSlackSharedChannel":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"slack_shared_channel","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"visibility":{"$ref":"#/components/schemas/BenefitVisibility","description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitSlackSharedChannelProperties"},"visibility_configurable":{"type":"boolean","title":"Visibility Configurable","readOnly":true}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","metadata","visibility","properties","visibility_configurable"],"title":"BenefitSlackSharedChannel"},"BenefitSlackSharedChannelCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"slack_shared_channel","title":"Type"},"description":{"type":"string","maxLength":42,"minLength":3,"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the benefit. **Required unless you use an organization token.**"},"visibility":{"anyOf":[{"$ref":"#/components/schemas/BenefitVisibility"},{"type":"null"}],"description":"The visibility of the benefit in the customer portal."},"properties":{"$ref":"#/components/schemas/BenefitSlackSharedChannelCreateProperties"}},"type":"object","required":["type","description","properties"],"title":"BenefitSlackSharedChannelCreate"},"BenefitSlackSharedChannelCreateProperties":{"properties":{"slack_integration_id":{"type":"string","format":"uuid4","title":"Slack Integration Id","description":"Polar Slack integration to use for this benefit."},"channel_name_template":{"type":"string","maxLength":80,"minLength":1,"title":"Channel Name Template"},"private":{"type":"boolean","title":"Private","default":true},"welcome_message":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Welcome Message"},"archive_on_revoke":{"type":"boolean","title":"Archive On Revoke","default":true},"team_invitees":{"items":{"type":"string"},"type":"array","title":"Team Invitees"}},"type":"object","required":["slack_integration_id","channel_name_template"],"title":"BenefitSlackSharedChannelCreateProperties"},"BenefitSlackSharedChannelProperties":{"properties":{"slack_integration_id":{"type":"string","format":"uuid4","title":"Slack Integration Id","description":"Polar Slack integration linked to this benefit."},"channel_name_template":{"type":"string","maxLength":80,"minLength":1,"title":"Channel Name Template","description":"Template for the channel name. Supports placeholders: {customer_name}, {customer_email_local}, and {metadata.} for any value stored in customer user metadata."},"private":{"type":"boolean","title":"Private","description":"Create the channel as private (recommended).","default":true},"welcome_message":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Welcome Message","description":"Optional message posted to the channel right after creation."},"archive_on_revoke":{"type":"boolean","title":"Archive On Revoke","description":"Archive the channel when the benefit is revoked.","default":true},"team_invitees":{"items":{"type":"string"},"type":"array","title":"Team Invitees","description":"Slack user IDs from the merchant workspace to invite to every channel created for this benefit."}},"type":"object","required":["slack_integration_id","channel_name_template"],"title":"BenefitSlackSharedChannelProperties"},"BenefitSlackSharedChannelSubscriber":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the benefit."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"type":{"type":"string","const":"slack_shared_channel","title":"Type"},"description":{"type":"string","title":"Description","description":"The description of the benefit."},"selectable":{"type":"boolean","title":"Selectable","description":"Whether the benefit is selectable when creating a product."},"deletable":{"type":"boolean","title":"Deletable","description":"Whether the benefit is deletable."},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Whether the benefit is deleted."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the benefit."},"organization":{"$ref":"#/components/schemas/BenefitSubscriberOrganization"},"properties":{"$ref":"#/components/schemas/BenefitSlackSharedChannelSubscriberProperties"}},"type":"object","required":["id","created_at","modified_at","type","description","selectable","deletable","is_deleted","organization_id","organization","properties"],"title":"BenefitSlackSharedChannelSubscriber"},"BenefitSlackSharedChannelSubscriberProperties":{"properties":{},"type":"object","title":"BenefitSlackSharedChannelSubscriberProperties"},"BenefitSlackSharedChannelUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"description":{"anyOf":[{"type":"string","maxLength":42,"minLength":3},{"type":"null"}],"title":"Description","description":"The description of the benefit. Will be displayed on products having this benefit."},"type":{"type":"string","const":"slack_shared_channel","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitSlackSharedChannelCreateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"BenefitSlackSharedChannelUpdate"},"BenefitSortProperty":{"type":"string","enum":["created_at","-created_at","description","-description","type","-type","user_order","-user_order"],"title":"BenefitSortProperty"},"BenefitSubscriberOrganization":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"Organization name shown in checkout, customer portal, emails etc."},"slug":{"type":"string","title":"Slug","description":"Unique organization slug in checkout, customer portal and credit card statements."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","description":"Avatar URL shown in checkout, customer portal, emails etc."},"proration_behavior":{"$ref":"#/components/schemas/SubscriptionProrationBehavior","description":"Proration behavior applied when customer updates their subscription from the portal."},"allow_customer_updates":{"type":"boolean","title":"Allow Customer Updates","description":"Whether customers can update their subscriptions from the customer portal."}},"type":"object","required":["created_at","modified_at","id","name","slug","avatar_url","proration_behavior","allow_customer_updates"],"title":"BenefitSubscriberOrganization"},"BenefitType":{"type":"string","enum":["custom","discord","github_repository","downloadables","license_keys","meter_credit","feature_flag","slack_shared_channel"],"title":"BenefitType"},"BenefitUpdatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"benefit.updated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/BenefitGrantMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"BenefitUpdatedEvent","description":"An event created by Polar when a benefit is updated."},"BenefitVisibility":{"type":"string","enum":["draft","private","public"],"title":"Visibility"},"BillingAddressFieldMode":{"type":"string","enum":["required","optional","disabled"],"title":"BillingAddressFieldMode"},"CannotCreateOrganizationError":{"properties":{"error":{"type":"string","const":"CannotCreateOrganizationError","title":"Error","examples":["CannotCreateOrganizationError"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"CannotCreateOrganizationError"},"CardPayment":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"The payment processor.","examples":["stripe"]},"status":{"$ref":"#/components/schemas/PaymentStatus","description":"The payment status.","examples":["succeeded"]},"amount":{"type":"integer","title":"Amount","description":"The payment amount in cents.","examples":[1000]},"currency":{"type":"string","title":"Currency","description":"The payment currency. Currently, only `usd` is supported.","examples":["usd"]},"method":{"type":"string","const":"card","title":"Method","description":"The payment method used.","examples":["card"]},"trigger":{"anyOf":[{"$ref":"#/components/schemas/PaymentTrigger"},{"type":"null"}],"description":"What initiated this payment attempt, e.g. initial purchase, subscription renewal, or an automated dunning retry.","examples":["subscription_cycle"]},"decline_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decline Reason","description":"Error code, if the payment was declined.","examples":["insufficient_funds"]},"decline_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decline Message","description":"Human-readable error message, if the payment was declined.","examples":["Your card has insufficient funds."]},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization that owns the payment.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id","description":"The ID of the checkout session associated with this payment.","examples":["e4b478fa-cd25-4253-9f1f-8a41e6370ede"]},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order associated with this payment.","examples":["e4b478fa-cd25-4253-9f1f-8a41e6370ede"]},"processor_metadata":{"additionalProperties":true,"type":"object","title":"Processor Metadata","description":"Additional metadata from the payment processor for internal use."},"method_metadata":{"$ref":"#/components/schemas/CardPaymentMetadata","description":"Additional metadata for the card payment method."}},"type":"object","required":["created_at","modified_at","id","processor","status","amount","currency","method","trigger","decline_reason","decline_message","organization_id","checkout_id","order_id","method_metadata"],"title":"CardPayment","description":"Schema of a payment with a card payment method."},"CardPaymentMetadata":{"properties":{"brand":{"type":"string","title":"Brand","description":"The brand of the card used for the payment.","examples":["visa","amex"]},"last4":{"type":"string","title":"Last4","description":"The last 4 digits of the card number.","examples":["4242"]}},"type":"object","required":["brand","last4"],"title":"CardPaymentMetadata","description":"Additional metadata for a card payment method."},"Checkout":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"payment_processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"Payment processor used."},"status":{"$ref":"#/components/schemas/CheckoutStatus","description":"\n Status of the checkout session.\n\n - Open: the checkout session was opened.\n - Expired: the checkout session was expired and is no more accessible.\n - Confirmed: the user on the checkout session clicked Pay. This is not indicative of the payment's success status.\n - Failed: the checkout definitely failed for technical reasons and cannot be retried. In most cases, this state is never reached.\n - Succeeded: the payment on the checkout was performed successfully.\n "},"client_secret":{"type":"string","title":"Client Secret","description":"Client secret used to update and complete the checkout session from the client."},"url":{"type":"string","title":"Url","description":"URL where the customer can access the checkout session."},"expires_at":{"type":"string","format":"date-time","title":"Expires At","description":"Expiration date and time of the checkout session."},"success_url":{"type":"string","title":"Success Url","description":"URL where the customer will be redirected after a successful payment."},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents, before discounts and taxes."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Predefined number of seats (works with seat-based pricing only)"},"min_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Seats","description":"Minimum number of seats (works with seat-based pricing only)"},"max_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (works with seat-based pricing only)"},"discount_amount":{"type":"integer","title":"Discount Amount","description":"Discount amount in cents."},"net_amount":{"type":"integer","title":"Net Amount","description":"Amount in cents, after discounts but before taxes."},"tax_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tax Amount","description":"Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehavior"},{"type":"null"}],"description":"Tax behavior of the checkout. `inclusive` means the price includes tax, `exclusive` means tax is added on top. If `null`, tax is not yet calculated."},"total_amount":{"type":"integer","title":"Total Amount","description":"Amount in cents, after discounts and taxes."},"currency":{"type":"string","title":"Currency","description":"Currency code of the checkout session."},"allow_trial":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured."},"active_trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product."},"active_trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Active Trial Interval Count","description":"Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"End date and time of the trial period, if any."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"ID of the organization owning the checkout session."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the product to checkout."},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"ID of the product price to checkout.","deprecated":true},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount applied to the checkout."},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it."},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`."},"is_discount_applicable":{"type":"boolean","title":"Is Discount Applicable","description":"Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable."},"is_free_product_price":{"type":"boolean","title":"Is Free Product Price","description":"Whether the product price is free, regardless of discounts."},"is_payment_required":{"type":"boolean","title":"Is Payment Required","description":"Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount."},"is_payment_setup_required":{"type":"boolean","title":"Is Payment Setup Required","description":"Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles."},"is_payment_form_required":{"type":"boolean","title":"Is Payment Form Required","description":"Whether the checkout requires a payment form, whether because of a payment or payment method setup."},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id"},"is_business_customer":{"type":"boolean","title":"Is Business Customer","description":"Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name."},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name","description":"Name of the customer."},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email","description":"Email address of the customer."},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"payment_processor_metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Payment Processor Metadata"},"billing_address_fields":{"$ref":"#/components/schemas/CheckoutBillingAddressFields","description":"Determine which billing address fields should be disabled, optional or required in the checkout form."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set."},"products":{"items":{"$ref":"#/components/schemas/CheckoutProduct"},"type":"array","title":"Products","description":"List of products available to select."},"product":{"anyOf":[{"$ref":"#/components/schemas/CheckoutProduct"},{"type":"null"}],"description":"Product selected to checkout."},"product_price":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},{"type":"null"}],"title":"Product Price","description":"Price of the selected product.","deprecated":true},"prices":{"anyOf":[{"additionalProperties":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","description":"List of prices for this product."},"propertyNames":{"format":"uuid4"},"type":"object"},{"type":"null"}],"title":"Prices","description":"Mapping of product IDs to their list of prices."},"discount":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/CheckoutDiscountFixedOnceForeverDuration"},{"$ref":"#/components/schemas/CheckoutDiscountFixedRepeatDuration"},{"$ref":"#/components/schemas/CheckoutDiscountPercentageOnceForeverDuration"},{"$ref":"#/components/schemas/CheckoutDiscountPercentageRepeatDuration"}]},{"type":"null"}],"title":"Discount"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"attached_custom_fields":{"anyOf":[{"items":{"$ref":"#/components/schemas/AttachedCustomField"},"type":"array"},{"type":"null"}],"title":"Attached Custom Fields"},"customer_metadata":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"}]},"type":"object","title":"Customer Metadata"}},"type":"object","required":["id","created_at","modified_at","payment_processor","status","client_secret","url","expires_at","success_url","return_url","embed_origin","amount","discount_amount","net_amount","tax_amount","tax_behavior","total_amount","currency","allow_trial","active_trial_interval","active_trial_interval_count","trial_end","organization_id","product_id","product_price_id","discount_id","allow_discount_codes","require_billing_address","is_discount_applicable","is_free_product_price","is_payment_required","is_payment_setup_required","is_payment_form_required","customer_id","is_business_customer","customer_name","customer_email","customer_ip_address","customer_billing_name","customer_billing_address","customer_tax_id","payment_processor_metadata","billing_address_fields","trial_interval","trial_interval_count","metadata","external_customer_id","products","product","product_price","prices","discount","subscription_id","attached_custom_fields","customer_metadata"],"title":"Checkout","description":"Checkout session data retrieved using an access token."},"CheckoutBillingAddressFields":{"properties":{"country":{"$ref":"#/components/schemas/BillingAddressFieldMode"},"state":{"$ref":"#/components/schemas/BillingAddressFieldMode"},"city":{"$ref":"#/components/schemas/BillingAddressFieldMode"},"postal_code":{"$ref":"#/components/schemas/BillingAddressFieldMode"},"line1":{"$ref":"#/components/schemas/BillingAddressFieldMode"},"line2":{"$ref":"#/components/schemas/BillingAddressFieldMode"}},"type":"object","required":["country","state","city","postal_code","line1","line2"],"title":"CheckoutBillingAddressFields"},"CheckoutConfirmStripe":{"properties":{"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the product to checkout. Must be present in the checkout's product list."},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"ID of the product price to checkout. Must correspond to a price present in the checkout's product list.","deprecated":true},"amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. "},{"type":"null"}],"title":"Amount"},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Number of seats for seat-based pricing."},"is_business_customer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Business Customer"},"customer_name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","format":"email","description":"Email address of the customer."},{"type":"null"}],"title":"Customer Email"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"discount_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discount Code","description":"Discount code to apply to the checkout."},"allow_trial":{"anyOf":[{"type":"boolean","const":false},{"type":"null"}],"title":"Allow Trial","description":"Disable the trial period for the checkout session. It's mainly useful when the trial is blocked because the customer already redeemed one."},"confirmation_token_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirmation Token Id","description":"ID of the Stripe confirmation token. Required for fixed prices and custom prices."}},"type":"object","title":"CheckoutConfirmStripe","description":"Confirm a checkout session using a Stripe confirmation token."},"CheckoutCreate":{"$ref":"#/components/schemas/CheckoutProductsCreate"},"CheckoutCreatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"checkout.created","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/CheckoutCreatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"CheckoutCreatedEvent","description":"An event created by Polar when a checkout is created."},"CheckoutCreatedMetadata":{"properties":{"checkout_id":{"type":"string","title":"Checkout Id"},"checkout_status":{"type":"string","title":"Checkout Status"},"product_id":{"type":"string","title":"Product Id"}},"type":"object","required":["checkout_id","checkout_status"],"title":"CheckoutCreatedMetadata"},"CheckoutCustomerBillingAddressFields":{"properties":{"country":{"type":"boolean","title":"Country"},"state":{"type":"boolean","title":"State"},"city":{"type":"boolean","title":"City"},"postal_code":{"type":"boolean","title":"Postal Code"},"line1":{"type":"boolean","title":"Line1"},"line2":{"type":"boolean","title":"Line2"}},"type":"object","required":["country","state","city","postal_code","line1","line2"],"title":"CheckoutCustomerBillingAddressFields","description":"Deprecated: Use CheckoutBillingAddressFields instead."},"CheckoutDiscountFixedOnceForeverDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"type":{"$ref":"#/components/schemas/DiscountType"},"amount":{"type":"integer","title":"Amount","deprecated":true,"examples":[1000]},"currency":{"type":"string","title":"Currency","deprecated":true,"examples":["usd"]},"amounts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Amounts","description":"Map of currency to fixed amount to discount from the total.","examples":[{"eur":900,"usd":1000}]},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"type":"object","required":["duration","type","amount","currency","amounts","id","name","code"],"title":"CheckoutDiscountFixedOnceForeverDuration","description":"Schema for a fixed amount discount that is applied once or forever."},"CheckoutDiscountFixedRepeatDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"duration_in_months":{"type":"integer","title":"Duration In Months"},"type":{"$ref":"#/components/schemas/DiscountType"},"amount":{"type":"integer","title":"Amount","deprecated":true,"examples":[1000]},"currency":{"type":"string","title":"Currency","deprecated":true,"examples":["usd"]},"amounts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Amounts","description":"Map of currency to fixed amount to discount from the total.","examples":[{"eur":900,"usd":1000}]},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"type":"object","required":["duration","duration_in_months","type","amount","currency","amounts","id","name","code"],"title":"CheckoutDiscountFixedRepeatDuration","description":"Schema for a fixed amount discount that is applied on every invoice\nfor a certain number of months."},"CheckoutDiscountPercentageOnceForeverDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"type":{"$ref":"#/components/schemas/DiscountType"},"basis_points":{"type":"integer","title":"Basis Points","description":"Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.","examples":[1000]},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"type":"object","required":["duration","type","basis_points","id","name","code"],"title":"CheckoutDiscountPercentageOnceForeverDuration","description":"Schema for a percentage discount that is applied once or forever."},"CheckoutDiscountPercentageRepeatDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"duration_in_months":{"type":"integer","title":"Duration In Months"},"type":{"$ref":"#/components/schemas/DiscountType"},"basis_points":{"type":"integer","title":"Basis Points","description":"Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.","examples":[1000]},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"type":"object","required":["duration","duration_in_months","type","basis_points","id","name","code"],"title":"CheckoutDiscountPercentageRepeatDuration","description":"Schema for a percentage discount that is applied on every invoice\nfor a certain number of months."},"CheckoutForbiddenError":{"anyOf":[{"$ref":"#/components/schemas/AlreadyActiveSubscriptionError"},{"$ref":"#/components/schemas/NotOpenCheckout"},{"$ref":"#/components/schemas/PaymentNotReady"},{"$ref":"#/components/schemas/TrialAlreadyRedeemed"}]},"CheckoutLink":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"payment_processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"Payment processor used."},"client_secret":{"type":"string","title":"Client Secret","description":"Client secret used to access the checkout link."},"success_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment."},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label","description":"Optional label to distinguish links internally"},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it."},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"products":{"items":{"$ref":"#/components/schemas/CheckoutLinkProduct"},"type":"array","title":"Products"},"discount":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/DiscountFixedOnceForeverDurationBase"},{"$ref":"#/components/schemas/DiscountFixedRepeatDurationBase"},{"$ref":"#/components/schemas/DiscountPercentageOnceForeverDurationBase"},{"$ref":"#/components/schemas/DiscountPercentageRepeatDurationBase"}],"title":"CheckoutLinkDiscount"},{"type":"null"}],"title":"Discount"},"url":{"type":"string","title":"Url","readOnly":true}},"type":"object","required":["id","created_at","modified_at","trial_interval","trial_interval_count","metadata","payment_processor","client_secret","success_url","return_url","label","allow_discount_codes","require_billing_address","discount_id","seats","organization_id","products","discount","url"],"title":"CheckoutLink","description":"Checkout link data."},"CheckoutLinkCreate":{"anyOf":[{"$ref":"#/components/schemas/CheckoutLinkCreateProductPrice"},{"$ref":"#/components/schemas/CheckoutLinkCreateProduct"},{"$ref":"#/components/schemas/CheckoutLinkCreateProducts"}]},"CheckoutLinkCreateProduct":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"payment_processor":{"type":"string","const":"stripe","title":"Payment Processor","description":"Payment processor to use. Currently only Stripe is supported."},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label","description":"Optional label to distinguish links internally"},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.","default":true},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting.","default":false},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored."},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"product_id":{"type":"string","format":"uuid4","title":"Product Id"}},"type":"object","required":["payment_processor","product_id"],"title":"CheckoutLinkCreateProduct","description":"Schema to create a new checkout link from a a single product.\n\n**Deprecated**: Use `CheckoutLinkCreateProducts` instead."},"CheckoutLinkCreateProductPrice":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"payment_processor":{"type":"string","const":"stripe","title":"Payment Processor","description":"Payment processor to use. Currently only Stripe is supported."},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label","description":"Optional label to distinguish links internally"},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.","default":true},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting.","default":false},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored."},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"product_price_id":{"type":"string","format":"uuid4","title":"Product Price Id"}},"type":"object","required":["payment_processor","product_price_id"],"title":"CheckoutLinkCreateProductPrice","description":"Schema to create a new checkout link from a a single product price.\n\n**Deprecated**: Use `CheckoutLinkCreateProducts` instead."},"CheckoutLinkCreateProducts":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"payment_processor":{"type":"string","const":"stripe","title":"Payment Processor","description":"Payment processor to use. Currently only Stripe is supported."},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label","description":"Optional label to distinguish links internally"},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.","default":true},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting.","default":false},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored."},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"products":{"items":{"type":"string","format":"uuid4"},"type":"array","minItems":1,"title":"Products","description":"List of products that will be available to select at checkout."}},"type":"object","required":["payment_processor","products"],"title":"CheckoutLinkCreateProducts","description":"Schema to create a new checkout link."},"CheckoutLinkProduct":{"properties":{"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of prices for this product."},"benefits":{"items":{"$ref":"#/components/schemas/BenefitPublic"},"type":"array","title":"BenefitPublic","description":"List of benefits granted by the product."},"medias":{"items":{"$ref":"#/components/schemas/ProductMediaFileRead"},"type":"array","title":"Medias","description":"List of medias associated to the product."}},"type":"object","required":["metadata","id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id","prices","benefits","medias"],"title":"CheckoutLinkProduct","description":"Product data for a checkout link."},"CheckoutLinkSortProperty":{"type":"string","enum":["created_at","-created_at","label","-label","success_url","-success_url","allow_discount_codes","-allow_discount_codes"],"title":"CheckoutLinkSortProperty"},"CheckoutLinkUpdate":{"properties":{"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"products":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array","minItems":1},{"type":"null"}],"title":"Products","description":"List of products that will be available to select at checkout."},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"allow_discount_codes":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it."},"require_billing_address":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout. If the discount is not applicable anymore when opening the checkout link, it'll be ignored."},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Preconfigured number of seats for seat-based pricing. When set, checkout sessions created from this link are locked to this number of seats and the customer won't be able to change it. All products on the link must use seat-based pricing and allow this number of seats. If the products no longer accommodate this value when the link is opened, it'll be ignored."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."}},"type":"object","title":"CheckoutLinkUpdate","description":"Schema to update an existing checkout link."},"CheckoutOrganization":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"Organization name shown in checkout, customer portal, emails etc."},"slug":{"type":"string","title":"Slug","description":"Unique organization slug in checkout, customer portal and credit card statements."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","description":"Avatar URL shown in checkout, customer portal, emails etc."},"proration_behavior":{"$ref":"#/components/schemas/SubscriptionProrationBehavior","description":"Proration behavior applied when customer updates their subscription from the portal."},"allow_customer_updates":{"type":"boolean","title":"Allow Customer Updates","description":"Whether customers can update their subscriptions from the customer portal."}},"type":"object","required":["created_at","modified_at","id","name","slug","avatar_url","proration_behavior","allow_customer_updates"],"title":"CheckoutOrganization"},"CheckoutPriceCreate":{"properties":{"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout."},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.","default":true},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`.","default":false},"amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. "},{"type":"null"}],"title":"Amount"},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Predefined number of seats (works with seat-based pricing only)"},"min_seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Min Seats","description":"Minimum number of seats (works with seat-based pricing only)"},"max_seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (works with seat-based pricing only)"},"allow_trial":{"type":"boolean","title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured.","default":true},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer."},"is_business_customer":{"type":"boolean","title":"Is Business Customer","description":"Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name.","default":false},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set."},"customer_name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","format":"email","description":"Email address of the customer."},{"type":"null"}],"title":"Customer Email"},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"customer_metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Customer Metadata","description":"Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page."},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"product_price_id":{"type":"string","format":"uuid4","title":"Product Price Id","description":"ID of the product price to checkout."}},"type":"object","required":["product_price_id"],"title":"CheckoutPriceCreate","description":"Create a new checkout session from a product price.\n\n**Deprecated**: Use `CheckoutProductsCreate` instead.\n\nMetadata set on the checkout will be copied\nto the resulting order and/or subscription."},"CheckoutProduct":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of prices for this product."},"benefits":{"items":{"$ref":"#/components/schemas/BenefitPublic"},"type":"array","title":"BenefitPublic","description":"List of benefits granted by the product."},"medias":{"items":{"$ref":"#/components/schemas/ProductMediaFileRead"},"type":"array","title":"Medias","description":"List of medias associated to the product."}},"type":"object","required":["id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id","prices","benefits","medias"],"title":"CheckoutProduct","description":"Product data for a checkout session."},"CheckoutProductCreate":{"properties":{"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout."},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.","default":true},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`.","default":false},"amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. "},{"type":"null"}],"title":"Amount"},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Predefined number of seats (works with seat-based pricing only)"},"min_seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Min Seats","description":"Minimum number of seats (works with seat-based pricing only)"},"max_seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (works with seat-based pricing only)"},"allow_trial":{"type":"boolean","title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured.","default":true},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer."},"is_business_customer":{"type":"boolean","title":"Is Business Customer","description":"Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name.","default":false},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set."},"customer_name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","format":"email","description":"Email address of the customer."},{"type":"null"}],"title":"Customer Email"},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"customer_metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Customer Metadata","description":"Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page."},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"currency":{"anyOf":[{"$ref":"#/components/schemas/PresentmentCurrency","maxLength":3,"minLength":3},{"type":"null"}]},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"ID of the product to checkout. First available price will be selected."}},"type":"object","required":["product_id"],"title":"CheckoutProductCreate","description":"Create a new checkout session from a product.\n\n**Deprecated**: Use `CheckoutProductsCreate` instead.\n\nMetadata set on the checkout will be copied\nto the resulting order and/or subscription."},"CheckoutProductsCreate":{"properties":{"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout."},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it.","default":true},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`.","default":false},"amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. "},{"type":"null"}],"title":"Amount"},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Predefined number of seats (works with seat-based pricing only)"},"min_seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Min Seats","description":"Minimum number of seats (works with seat-based pricing only)"},"max_seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (works with seat-based pricing only)"},"allow_trial":{"type":"boolean","title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured.","default":true},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of an existing customer in the organization. The customer data will be pre-filled in the checkout form. The resulting order will be linked to this customer."},"is_business_customer":{"type":"boolean","title":"Is Business Customer","description":"Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name.","default":false},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system. If a matching customer exists on Polar, the resulting order will be linked to this customer. Otherwise, a new customer will be created with this external ID set."},"customer_name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","format":"email","description":"Email address of the customer."},{"type":"null"}],"title":"Customer Email"},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"customer_metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Customer Metadata","description":"Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id","description":"ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page."},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"currency":{"anyOf":[{"$ref":"#/components/schemas/PresentmentCurrency","maxLength":3,"minLength":3},{"type":"null"}]},"products":{"items":{"type":"string","format":"uuid4"},"type":"array","minItems":1,"title":"Products","description":"List of product IDs available to select at that checkout. The first one will be selected by default."},"prices":{"anyOf":[{"additionalProperties":{"items":{"oneOf":[{"$ref":"#/components/schemas/ProductPriceFixedCreate"},{"$ref":"#/components/schemas/ProductPriceCustomCreate"},{"$ref":"#/components/schemas/ProductPriceSeatBasedCreate"},{"$ref":"#/components/schemas/ProductPriceMeteredUnitCreate"}],"discriminator":{"propertyName":"amount_type","mapping":{"custom":"#/components/schemas/ProductPriceCustomCreate","fixed":"#/components/schemas/ProductPriceFixedCreate","metered_unit":"#/components/schemas/ProductPriceMeteredUnitCreate","seat_based":"#/components/schemas/ProductPriceSeatBasedCreate"}}},"type":"array","minItems":1,"description":"List of prices for the product. At most one fixed price and one seat-based price may be combined (billed as `fixed + seat_charge`), or a single custom price may stand alone, plus any number of metered prices. A custom price cannot be combined with a fixed or seat-based price."},"propertyNames":{"format":"uuid4"},"type":"object"},{"type":"null"}],"title":"Prices","description":"Optional mapping of product IDs to a list of ad-hoc prices to create for that product. If not set, catalog prices of the product will be used."}},"type":"object","required":["products"],"title":"CheckoutProductsCreate","description":"Create a new checkout session from a list of products.\nCustomers will be able to switch between those products.\n\nMetadata set on the checkout will be copied\nto the resulting order and/or subscription."},"CheckoutPublic":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"payment_processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"Payment processor used."},"status":{"$ref":"#/components/schemas/CheckoutStatus","description":"\n Status of the checkout session.\n\n - Open: the checkout session was opened.\n - Expired: the checkout session was expired and is no more accessible.\n - Confirmed: the user on the checkout session clicked Pay. This is not indicative of the payment's success status.\n - Failed: the checkout definitely failed for technical reasons and cannot be retried. In most cases, this state is never reached.\n - Succeeded: the payment on the checkout was performed successfully.\n "},"client_secret":{"type":"string","title":"Client Secret","description":"Client secret used to update and complete the checkout session from the client."},"url":{"type":"string","title":"Url","description":"URL where the customer can access the checkout session."},"expires_at":{"type":"string","format":"date-time","title":"Expires At","description":"Expiration date and time of the checkout session."},"success_url":{"type":"string","title":"Success Url","description":"URL where the customer will be redirected after a successful payment."},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents, before discounts and taxes."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Predefined number of seats (works with seat-based pricing only)"},"min_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Seats","description":"Minimum number of seats (works with seat-based pricing only)"},"max_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (works with seat-based pricing only)"},"discount_amount":{"type":"integer","title":"Discount Amount","description":"Discount amount in cents."},"net_amount":{"type":"integer","title":"Net Amount","description":"Amount in cents, after discounts but before taxes."},"tax_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tax Amount","description":"Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehavior"},{"type":"null"}],"description":"Tax behavior of the checkout. `inclusive` means the price includes tax, `exclusive` means tax is added on top. If `null`, tax is not yet calculated."},"total_amount":{"type":"integer","title":"Total Amount","description":"Amount in cents, after discounts and taxes."},"currency":{"type":"string","title":"Currency","description":"Currency code of the checkout session."},"allow_trial":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured."},"active_trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product."},"active_trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Active Trial Interval Count","description":"Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"End date and time of the trial period, if any."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"ID of the organization owning the checkout session."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the product to checkout."},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"ID of the product price to checkout.","deprecated":true},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount applied to the checkout."},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it."},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`."},"is_discount_applicable":{"type":"boolean","title":"Is Discount Applicable","description":"Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable."},"is_free_product_price":{"type":"boolean","title":"Is Free Product Price","description":"Whether the product price is free, regardless of discounts."},"is_payment_required":{"type":"boolean","title":"Is Payment Required","description":"Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount."},"is_payment_setup_required":{"type":"boolean","title":"Is Payment Setup Required","description":"Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles."},"is_payment_form_required":{"type":"boolean","title":"Is Payment Form Required","description":"Whether the checkout requires a payment form, whether because of a payment or payment method setup."},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id"},"is_business_customer":{"type":"boolean","title":"Is Business Customer","description":"Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name."},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name","description":"Name of the customer."},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email","description":"Email address of the customer."},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"payment_processor_metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Payment Processor Metadata"},"billing_address_fields":{"$ref":"#/components/schemas/CheckoutBillingAddressFields","description":"Determine which billing address fields should be disabled, optional or required in the checkout form."},"products":{"items":{"$ref":"#/components/schemas/CheckoutProduct"},"type":"array","title":"Products","description":"List of products available to select."},"product":{"anyOf":[{"$ref":"#/components/schemas/CheckoutProduct"},{"type":"null"}],"description":"Product selected to checkout."},"product_price":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},{"type":"null"}],"title":"Product Price","description":"Price of the selected product.","deprecated":true},"prices":{"anyOf":[{"additionalProperties":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","description":"List of prices for this product."},"propertyNames":{"format":"uuid4"},"type":"object"},{"type":"null"}],"title":"Prices","description":"Mapping of product IDs to their list of prices."},"discount":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/CheckoutDiscountFixedOnceForeverDuration"},{"$ref":"#/components/schemas/CheckoutDiscountFixedRepeatDuration"},{"$ref":"#/components/schemas/CheckoutDiscountPercentageOnceForeverDuration"},{"$ref":"#/components/schemas/CheckoutDiscountPercentageRepeatDuration"}]},{"type":"null"}],"title":"Discount"},"organization":{"$ref":"#/components/schemas/CheckoutOrganization"},"attached_custom_fields":{"anyOf":[{"items":{"$ref":"#/components/schemas/AttachedCustomField"},"type":"array"},{"type":"null"}],"title":"Attached Custom Fields"}},"type":"object","required":["id","created_at","modified_at","payment_processor","status","client_secret","url","expires_at","success_url","return_url","embed_origin","amount","discount_amount","net_amount","tax_amount","tax_behavior","total_amount","currency","allow_trial","active_trial_interval","active_trial_interval_count","trial_end","organization_id","product_id","product_price_id","discount_id","allow_discount_codes","require_billing_address","is_discount_applicable","is_free_product_price","is_payment_required","is_payment_setup_required","is_payment_form_required","customer_id","is_business_customer","customer_name","customer_email","customer_ip_address","customer_billing_name","customer_billing_address","customer_tax_id","payment_processor_metadata","billing_address_fields","products","product","product_price","prices","discount","organization","attached_custom_fields"],"title":"CheckoutPublic","description":"Checkout session data retrieved using the client secret."},"CheckoutPublicConfirmed":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"payment_processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"Payment processor used."},"status":{"type":"string","const":"confirmed","title":"Status"},"client_secret":{"type":"string","title":"Client Secret","description":"Client secret used to update and complete the checkout session from the client."},"url":{"type":"string","title":"Url","description":"URL where the customer can access the checkout session."},"expires_at":{"type":"string","format":"date-time","title":"Expires At","description":"Expiration date and time of the checkout session."},"success_url":{"type":"string","title":"Success Url","description":"URL where the customer will be redirected after a successful payment."},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"When checkout is embedded, represents the Origin of the page embedding the checkout. Used as a security measure to send messages only to the embedding page."},"amount":{"type":"integer","title":"Amount","description":"Amount in cents, before discounts and taxes."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Predefined number of seats (works with seat-based pricing only)"},"min_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Seats","description":"Minimum number of seats (works with seat-based pricing only)"},"max_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (works with seat-based pricing only)"},"discount_amount":{"type":"integer","title":"Discount Amount","description":"Discount amount in cents."},"net_amount":{"type":"integer","title":"Net Amount","description":"Amount in cents, after discounts but before taxes."},"tax_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tax Amount","description":"Sales tax amount in cents. If `null`, it means there is no enough information yet to calculate it."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehavior"},{"type":"null"}],"description":"Tax behavior of the checkout. `inclusive` means the price includes tax, `exclusive` means tax is added on top. If `null`, tax is not yet calculated."},"total_amount":{"type":"integer","title":"Total Amount","description":"Amount in cents, after discounts and taxes."},"currency":{"type":"string","title":"Currency","description":"Currency code of the checkout session."},"allow_trial":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured."},"active_trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"Interval unit of the trial period, if any. This value is either set from the checkout, if `trial_interval` is set, or from the selected product."},"active_trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Active Trial Interval Count","description":"Number of interval units of the trial period, if any. This value is either set from the checkout, if `trial_interval_count` is set, or from the selected product."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"End date and time of the trial period, if any."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"ID of the organization owning the checkout session."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the product to checkout."},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"ID of the product price to checkout.","deprecated":true},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount applied to the checkout."},"allow_discount_codes":{"type":"boolean","title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it."},"require_billing_address":{"type":"boolean","title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`."},"is_discount_applicable":{"type":"boolean","title":"Is Discount Applicable","description":"Whether the discount is applicable to the checkout. Typically, free and custom prices are not discountable."},"is_free_product_price":{"type":"boolean","title":"Is Free Product Price","description":"Whether the product price is free, regardless of discounts."},"is_payment_required":{"type":"boolean","title":"Is Payment Required","description":"Whether the checkout requires payment, e.g. in case of free products or discounts that cover the total amount."},"is_payment_setup_required":{"type":"boolean","title":"Is Payment Setup Required","description":"Whether the checkout requires setting up a payment method, regardless of the amount, e.g. subscriptions that have first free cycles."},"is_payment_form_required":{"type":"boolean","title":"Is Payment Form Required","description":"Whether the checkout requires a payment form, whether because of a payment or payment method setup."},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id"},"is_business_customer":{"type":"boolean","title":"Is Business Customer","description":"Whether the customer is a business or an individual. If `true`, the customer will be required to fill their full billing address and billing name."},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name","description":"Name of the customer."},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email","description":"Email address of the customer."},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"payment_processor_metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Payment Processor Metadata"},"billing_address_fields":{"$ref":"#/components/schemas/CheckoutBillingAddressFields","description":"Determine which billing address fields should be disabled, optional or required in the checkout form."},"products":{"items":{"$ref":"#/components/schemas/CheckoutProduct"},"type":"array","title":"Products","description":"List of products available to select."},"product":{"anyOf":[{"$ref":"#/components/schemas/CheckoutProduct"},{"type":"null"}],"description":"Product selected to checkout."},"product_price":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},{"type":"null"}],"title":"Product Price","description":"Price of the selected product.","deprecated":true},"prices":{"anyOf":[{"additionalProperties":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","description":"List of prices for this product."},"propertyNames":{"format":"uuid4"},"type":"object"},{"type":"null"}],"title":"Prices","description":"Mapping of product IDs to their list of prices."},"discount":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/CheckoutDiscountFixedOnceForeverDuration"},{"$ref":"#/components/schemas/CheckoutDiscountFixedRepeatDuration"},{"$ref":"#/components/schemas/CheckoutDiscountPercentageOnceForeverDuration"},{"$ref":"#/components/schemas/CheckoutDiscountPercentageRepeatDuration"}]},{"type":"null"}],"title":"Discount"},"organization":{"$ref":"#/components/schemas/CheckoutOrganization"},"attached_custom_fields":{"anyOf":[{"items":{"$ref":"#/components/schemas/AttachedCustomField"},"type":"array"},{"type":"null"}],"title":"Attached Custom Fields"},"customer_session_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Session Token"}},"type":"object","required":["id","created_at","modified_at","payment_processor","status","client_secret","url","expires_at","success_url","return_url","embed_origin","amount","discount_amount","net_amount","tax_amount","tax_behavior","total_amount","currency","allow_trial","active_trial_interval","active_trial_interval_count","trial_end","organization_id","product_id","product_price_id","discount_id","allow_discount_codes","require_billing_address","is_discount_applicable","is_free_product_price","is_payment_required","is_payment_setup_required","is_payment_form_required","customer_id","is_business_customer","customer_name","customer_email","customer_ip_address","customer_billing_name","customer_billing_address","customer_tax_id","payment_processor_metadata","billing_address_fields","products","product","product_price","prices","discount","organization","attached_custom_fields","customer_session_token"],"title":"CheckoutPublicConfirmed","description":"Checkout session data retrieved using the client secret after confirmation.\n\nIt contains a customer session token to retrieve order information\nright after the checkout."},"CheckoutSortProperty":{"type":"string","enum":["created_at","-created_at","expires_at","-expires_at","status","-status"],"title":"CheckoutSortProperty"},"CheckoutStatus":{"type":"string","enum":["open","expired","confirmed","succeeded","failed"],"title":"CheckoutStatus"},"CheckoutUpdate":{"properties":{"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the product to checkout. Must be present in the checkout's product list."},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"ID of the product price to checkout. Must correspond to a price present in the checkout's product list.","deprecated":true},"amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. "},{"type":"null"}],"title":"Amount"},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Number of seats for seat-based pricing."},"is_business_customer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Business Customer"},"customer_name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","format":"email","description":"Email address of the customer."},{"type":"null"}],"title":"Customer Email"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"currency":{"anyOf":[{"$ref":"#/components/schemas/PresentmentCurrency","maxLength":3,"minLength":3},{"type":"null"}]},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"ID of the discount to apply to the checkout."},"allow_discount_codes":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Discount Codes","description":"Whether to allow the customer to apply discount codes. If you apply a discount through `discount_id`, it'll still be applied, but the customer won't be able to change it."},"require_billing_address":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Require Billing Address","description":"Whether to require the customer to fill their full billing address, instead of just the country. Customers in the US will always be required to fill their full address, regardless of this setting. If you preset the billing address, this setting will be automatically set to `true`."},"allow_trial":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Trial","description":"Whether to enable the trial period for the checkout session. If `false`, the trial period will be disabled, even if the selected product has a trial configured."},"customer_ip_address":{"anyOf":[{"type":"string","format":"ipvanyaddress"},{"type":"null"}],"title":"Customer Ip Address"},"customer_metadata":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},{"type":"null"}],"title":"Customer Metadata","description":"Key-value object allowing you to store additional information that'll be copied to the created customer.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"success_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Success Url","description":"URL where the customer will be redirected after a successful payment.You can add the `checkout_id={CHECKOUT_ID}` query parameter to retrieve the checkout session id."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the checkout to return to this URL."},"embed_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Origin","description":"If you plan to embed the checkout session, set this to the Origin of the embedding page. It'll allow the Polar iframe to communicate with the parent page."}},"type":"object","title":"CheckoutUpdate","description":"Update an existing checkout session using an access token."},"CheckoutUpdatePublic":{"properties":{"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the product to checkout. Must be present in the checkout's product list."},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"ID of the product price to checkout. Must correspond to a price present in the checkout's product list.","deprecated":true},"amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"Amount in cents, before discounts and taxes. Only useful for custom prices, it'll be ignored for fixed and free prices. "},{"type":"null"}],"title":"Amount"},"seats":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0},{"type":"null"}],"title":"Seats","description":"Number of seats for seat-based pricing."},"is_business_customer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Business Customer"},"customer_name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","format":"email","description":"Email address of the customer."},{"type":"null"}],"title":"Customer Email"},"customer_billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Billing Name"},"customer_billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput","description":"Billing address of the customer."},{"type":"null"}]},"customer_tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"discount_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discount Code","description":"Discount code to apply to the checkout."},"allow_trial":{"anyOf":[{"type":"boolean","const":false},{"type":"null"}],"title":"Allow Trial","description":"Disable the trial period for the checkout session. It's mainly useful when the trial is blocked because the customer already redeemed one."}},"type":"object","title":"CheckoutUpdatePublic","description":"Update an existing checkout session using the client secret."},"CostMetadata-Input":{"properties":{"amount":{"anyOf":[{"type":"number"},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,5}|(?=[\\d.]{1,18}0*$)\\d{0,5}\\.\\d{0,12}0*$)"}],"title":"Amount","description":"The amount in cents."},"currency":{"type":"string","pattern":"usd","title":"Currency","description":"The currency. Currently, only `usd` is supported."}},"type":"object","required":["amount","currency"],"title":"CostMetadata"},"CostMetadata-Output":{"properties":{"amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,5}|(?=[\\d.]{1,18}0*$)\\d{0,5}\\.\\d{0,12}0*$)","title":"Amount","description":"The amount in cents."},"currency":{"type":"string","pattern":"usd","title":"Currency","description":"The currency. Currently, only `usd` is supported."}},"type":"object","required":["amount","currency"],"title":"CostMetadata"},"CountAggregation":{"properties":{"func":{"type":"string","const":"count","title":"Func","default":"count"}},"type":"object","title":"CountAggregation"},"CountryAlpha2":{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2"},"CountryAlpha2Input":{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2Input"},"CursorPagination":{"properties":{"has_next_page":{"type":"boolean","title":"Has Next Page"}},"type":"object","required":["has_next_page"],"title":"CursorPagination"},"CustomField":{"oneOf":[{"$ref":"#/components/schemas/CustomFieldText"},{"$ref":"#/components/schemas/CustomFieldNumber"},{"$ref":"#/components/schemas/CustomFieldDate"},{"$ref":"#/components/schemas/CustomFieldCheckbox"},{"$ref":"#/components/schemas/CustomFieldSelect"}],"discriminator":{"propertyName":"type","mapping":{"checkbox":"#/components/schemas/CustomFieldCheckbox","date":"#/components/schemas/CustomFieldDate","number":"#/components/schemas/CustomFieldNumber","select":"#/components/schemas/CustomFieldSelect","text":"#/components/schemas/CustomFieldText"}}},"CustomFieldCheckbox":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"type":{"type":"string","const":"checkbox","title":"Type"},"slug":{"type":"string","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value."},"name":{"type":"string","title":"Name","description":"Name of the custom field."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the custom field.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"properties":{"$ref":"#/components/schemas/CustomFieldCheckboxProperties"}},"type":"object","required":["created_at","modified_at","id","metadata","type","slug","name","organization_id","properties"],"title":"CustomFieldCheckbox","description":"Schema for a custom field of type checkbox."},"CustomFieldCheckboxProperties":{"properties":{"form_label":{"type":"string","minLength":1,"title":"Form Label"},"form_help_text":{"type":"string","minLength":1,"title":"Form Help Text"},"form_placeholder":{"type":"string","minLength":1,"title":"Form Placeholder"}},"type":"object","title":"CustomFieldCheckboxProperties"},"CustomFieldCreate":{"oneOf":[{"$ref":"#/components/schemas/CustomFieldCreateText"},{"$ref":"#/components/schemas/CustomFieldCreateNumber"},{"$ref":"#/components/schemas/CustomFieldCreateDate"},{"$ref":"#/components/schemas/CustomFieldCreateCheckbox"},{"$ref":"#/components/schemas/CustomFieldCreateSelect"}],"discriminator":{"propertyName":"type","mapping":{"checkbox":"#/components/schemas/CustomFieldCreateCheckbox","date":"#/components/schemas/CustomFieldCreateDate","number":"#/components/schemas/CustomFieldCreateNumber","select":"#/components/schemas/CustomFieldCreateSelect","text":"#/components/schemas/CustomFieldCreateText"}}},"CustomFieldCreateCheckbox":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"checkbox","title":"Type"},"slug":{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the custom field."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the custom field. **Required unless you use an organization token.**"},"properties":{"$ref":"#/components/schemas/CustomFieldCheckboxProperties"}},"type":"object","required":["type","slug","name","properties"],"title":"CustomFieldCreateCheckbox","description":"Schema to create a custom field of type checkbox."},"CustomFieldCreateDate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"date","title":"Type"},"slug":{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the custom field."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the custom field. **Required unless you use an organization token.**"},"properties":{"$ref":"#/components/schemas/CustomFieldDateProperties"}},"type":"object","required":["type","slug","name","properties"],"title":"CustomFieldCreateDate","description":"Schema to create a custom field of type date."},"CustomFieldCreateNumber":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"number","title":"Type"},"slug":{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the custom field."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the custom field. **Required unless you use an organization token.**"},"properties":{"$ref":"#/components/schemas/CustomFieldNumberProperties"}},"type":"object","required":["type","slug","name","properties"],"title":"CustomFieldCreateNumber","description":"Schema to create a custom field of type number."},"CustomFieldCreateSelect":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"select","title":"Type"},"slug":{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the custom field."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the custom field. **Required unless you use an organization token.**"},"properties":{"$ref":"#/components/schemas/CustomFieldSelectProperties"}},"type":"object","required":["type","slug","name","properties"],"title":"CustomFieldCreateSelect","description":"Schema to create a custom field of type select."},"CustomFieldCreateText":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"type":{"type":"string","const":"text","title":"Type"},"slug":{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the custom field."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the custom field. **Required unless you use an organization token.**"},"properties":{"$ref":"#/components/schemas/CustomFieldTextProperties"}},"type":"object","required":["type","slug","name","properties"],"title":"CustomFieldCreateText","description":"Schema to create a custom field of type text."},"CustomFieldDate":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"type":{"type":"string","const":"date","title":"Type"},"slug":{"type":"string","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value."},"name":{"type":"string","title":"Name","description":"Name of the custom field."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the custom field.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"properties":{"$ref":"#/components/schemas/CustomFieldDateProperties"}},"type":"object","required":["created_at","modified_at","id","metadata","type","slug","name","organization_id","properties"],"title":"CustomFieldDate","description":"Schema for a custom field of type date."},"CustomFieldDateProperties":{"properties":{"form_label":{"type":"string","minLength":1,"title":"Form Label"},"form_help_text":{"type":"string","minLength":1,"title":"Form Help Text"},"form_placeholder":{"type":"string","minLength":1,"title":"Form Placeholder"},"ge":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Ge"},"le":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Le"}},"type":"object","title":"CustomFieldDateProperties"},"CustomFieldNumber":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"type":{"type":"string","const":"number","title":"Type"},"slug":{"type":"string","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value."},"name":{"type":"string","title":"Name","description":"Name of the custom field."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the custom field.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"properties":{"$ref":"#/components/schemas/CustomFieldNumberProperties"}},"type":"object","required":["created_at","modified_at","id","metadata","type","slug","name","organization_id","properties"],"title":"CustomFieldNumber","description":"Schema for a custom field of type number."},"CustomFieldNumberProperties":{"properties":{"form_label":{"type":"string","minLength":1,"title":"Form Label"},"form_help_text":{"type":"string","minLength":1,"title":"Form Help Text"},"form_placeholder":{"type":"string","minLength":1,"title":"Form Placeholder"},"ge":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Ge"},"le":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Le"}},"type":"object","title":"CustomFieldNumberProperties"},"CustomFieldSelect":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"type":{"type":"string","const":"select","title":"Type"},"slug":{"type":"string","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value."},"name":{"type":"string","title":"Name","description":"Name of the custom field."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the custom field.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"properties":{"$ref":"#/components/schemas/CustomFieldSelectProperties"}},"type":"object","required":["created_at","modified_at","id","metadata","type","slug","name","organization_id","properties"],"title":"CustomFieldSelect","description":"Schema for a custom field of type select."},"CustomFieldSelectOption":{"properties":{"value":{"type":"string","minLength":1,"title":"Value"},"label":{"type":"string","minLength":1,"title":"Label"}},"type":"object","required":["value","label"],"title":"CustomFieldSelectOption"},"CustomFieldSelectProperties":{"properties":{"form_label":{"type":"string","minLength":1,"title":"Form Label"},"form_help_text":{"type":"string","minLength":1,"title":"Form Help Text"},"form_placeholder":{"type":"string","minLength":1,"title":"Form Placeholder"},"options":{"items":{"$ref":"#/components/schemas/CustomFieldSelectOption"},"type":"array","minItems":1,"title":"Options"}},"type":"object","required":["options"],"title":"CustomFieldSelectProperties"},"CustomFieldSortProperty":{"type":"string","enum":["created_at","-created_at","slug","-slug","name","-name","type","-type"],"title":"CustomFieldSortProperty"},"CustomFieldText":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"type":{"type":"string","const":"text","title":"Type"},"slug":{"type":"string","title":"Slug","description":"Identifier of the custom field. It'll be used as key when storing the value."},"name":{"type":"string","title":"Name","description":"Name of the custom field."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the custom field.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"properties":{"$ref":"#/components/schemas/CustomFieldTextProperties"}},"type":"object","required":["created_at","modified_at","id","metadata","type","slug","name","organization_id","properties"],"title":"CustomFieldText","description":"Schema for a custom field of type text."},"CustomFieldTextProperties":{"properties":{"form_label":{"type":"string","minLength":1,"title":"Form Label"},"form_help_text":{"type":"string","minLength":1,"title":"Form Help Text"},"form_placeholder":{"type":"string","minLength":1,"title":"Form Placeholder"},"textarea":{"type":"boolean","title":"Textarea"},"min_length":{"type":"integer","maximum":2147483647.0,"minimum":0.0,"title":"Min Length"},"max_length":{"type":"integer","maximum":2147483647.0,"minimum":0.0,"title":"Max Length"}},"type":"object","title":"CustomFieldTextProperties"},"CustomFieldType":{"type":"string","enum":["text","number","date","checkbox","select"],"title":"CustomFieldType"},"CustomFieldUpdate":{"oneOf":[{"$ref":"#/components/schemas/CustomFieldUpdateText"},{"$ref":"#/components/schemas/CustomFieldUpdateNumber"},{"$ref":"#/components/schemas/CustomFieldUpdateDate"},{"$ref":"#/components/schemas/CustomFieldUpdateCheckbox"},{"$ref":"#/components/schemas/CustomFieldUpdateSelect"}],"discriminator":{"propertyName":"type","mapping":{"checkbox":"#/components/schemas/CustomFieldUpdateCheckbox","date":"#/components/schemas/CustomFieldUpdateDate","number":"#/components/schemas/CustomFieldUpdateNumber","select":"#/components/schemas/CustomFieldUpdateSelect","text":"#/components/schemas/CustomFieldUpdateText"}}},"CustomFieldUpdateCheckbox":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":1,"description":"Name of the custom field."},{"type":"null"}],"title":"Name"},"slug":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},{"type":"null"}],"title":"Slug"},"type":{"type":"string","const":"checkbox","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/CustomFieldCheckboxProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"CustomFieldUpdateCheckbox","description":"Schema to update a custom field of type checkbox."},"CustomFieldUpdateDate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":1,"description":"Name of the custom field."},{"type":"null"}],"title":"Name"},"slug":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},{"type":"null"}],"title":"Slug"},"type":{"type":"string","const":"date","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/CustomFieldDateProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"CustomFieldUpdateDate","description":"Schema to update a custom field of type date."},"CustomFieldUpdateNumber":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":1,"description":"Name of the custom field."},{"type":"null"}],"title":"Name"},"slug":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},{"type":"null"}],"title":"Slug"},"type":{"type":"string","const":"number","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/CustomFieldNumberProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"CustomFieldUpdateNumber","description":"Schema to update a custom field of type number."},"CustomFieldUpdateSelect":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":1,"description":"Name of the custom field."},{"type":"null"}],"title":"Name"},"slug":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},{"type":"null"}],"title":"Slug"},"type":{"type":"string","const":"select","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/CustomFieldSelectProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"CustomFieldUpdateSelect","description":"Schema to update a custom field of type select."},"CustomFieldUpdateText":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":1,"description":"Name of the custom field."},{"type":"null"}],"title":"Name"},"slug":{"anyOf":[{"type":"string","minLength":1,"pattern":"^[a-z0-9-_]+$","description":"Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens."},{"type":"null"}],"title":"Slug"},"type":{"type":"string","const":"text","title":"Type"},"properties":{"anyOf":[{"$ref":"#/components/schemas/CustomFieldTextProperties"},{"type":"null"}]}},"type":"object","required":["type"],"title":"CustomFieldUpdateText","description":"Schema to update a custom field of type text."},"Customer":{"oneOf":[{"$ref":"#/components/schemas/CustomerIndividual"},{"$ref":"#/components/schemas/CustomerTeam"}],"discriminator":{"propertyName":"type","mapping":{"individual":"#/components/schemas/CustomerIndividual","team":"#/components/schemas/CustomerTeam"}}},"CustomerBenefitGrant":{"anyOf":[{"$ref":"#/components/schemas/CustomerBenefitGrantDiscord"},{"$ref":"#/components/schemas/CustomerBenefitGrantGitHubRepository"},{"$ref":"#/components/schemas/CustomerBenefitGrantDownloadables"},{"$ref":"#/components/schemas/CustomerBenefitGrantLicenseKeys"},{"$ref":"#/components/schemas/CustomerBenefitGrantCustom"},{"$ref":"#/components/schemas/CustomerBenefitGrantMeterCredit"},{"$ref":"#/components/schemas/CustomerBenefitGrantFeatureFlag"},{"$ref":"#/components/schemas/CustomerBenefitGrantSlackSharedChannel"}]},"CustomerBenefitGrantCustom":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitCustomSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantCustomProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantCustom"},"CustomerBenefitGrantCustomUpdate":{"properties":{"benefit_type":{"type":"string","const":"custom","title":"Benefit Type"}},"type":"object","required":["benefit_type"],"title":"CustomerBenefitGrantCustomUpdate"},"CustomerBenefitGrantDiscord":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitDiscordSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantDiscordProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantDiscord"},"CustomerBenefitGrantDiscordPropertiesUpdate":{"properties":{"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"}},"type":"object","required":["account_id"],"title":"CustomerBenefitGrantDiscordPropertiesUpdate"},"CustomerBenefitGrantDiscordUpdate":{"properties":{"benefit_type":{"type":"string","const":"discord","title":"Benefit Type"},"properties":{"$ref":"#/components/schemas/CustomerBenefitGrantDiscordPropertiesUpdate"}},"type":"object","required":["benefit_type","properties"],"title":"CustomerBenefitGrantDiscordUpdate"},"CustomerBenefitGrantDownloadables":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitDownloadablesSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantDownloadablesProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantDownloadables"},"CustomerBenefitGrantDownloadablesUpdate":{"properties":{"benefit_type":{"type":"string","const":"downloadables","title":"Benefit Type"}},"type":"object","required":["benefit_type"],"title":"CustomerBenefitGrantDownloadablesUpdate"},"CustomerBenefitGrantFeatureFlag":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitFeatureFlagSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantFeatureFlagProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantFeatureFlag"},"CustomerBenefitGrantFeatureFlagUpdate":{"properties":{"benefit_type":{"type":"string","const":"feature_flag","title":"Benefit Type"}},"type":"object","required":["benefit_type"],"title":"CustomerBenefitGrantFeatureFlagUpdate"},"CustomerBenefitGrantGitHubRepository":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitGitHubRepositorySubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantGitHubRepositoryProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantGitHubRepository"},"CustomerBenefitGrantGitHubRepositoryPropertiesUpdate":{"properties":{"account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Id"}},"type":"object","required":["account_id"],"title":"CustomerBenefitGrantGitHubRepositoryPropertiesUpdate"},"CustomerBenefitGrantGitHubRepositoryUpdate":{"properties":{"benefit_type":{"type":"string","const":"github_repository","title":"Benefit Type"},"properties":{"$ref":"#/components/schemas/CustomerBenefitGrantGitHubRepositoryPropertiesUpdate"}},"type":"object","required":["benefit_type","properties"],"title":"CustomerBenefitGrantGitHubRepositoryUpdate"},"CustomerBenefitGrantLicenseKeys":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitLicenseKeysSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantLicenseKeysProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantLicenseKeys"},"CustomerBenefitGrantLicenseKeysUpdate":{"properties":{"benefit_type":{"type":"string","const":"license_keys","title":"Benefit Type"}},"type":"object","required":["benefit_type"],"title":"CustomerBenefitGrantLicenseKeysUpdate"},"CustomerBenefitGrantMeterCredit":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitMeterCreditSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantMeterCreditProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantMeterCredit"},"CustomerBenefitGrantMeterCreditUpdate":{"properties":{"benefit_type":{"type":"string","const":"meter_credit","title":"Benefit Type"}},"type":"object","required":["benefit_type"],"title":"CustomerBenefitGrantMeterCreditUpdate"},"CustomerBenefitGrantSlackSharedChannel":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"granted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id"},"is_granted":{"type":"boolean","title":"Is Granted"},"is_revoked":{"type":"boolean","title":"Is Revoked"},"error":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantError"},{"type":"null"}]},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomer"},"benefit":{"$ref":"#/components/schemas/BenefitSlackSharedChannelSubscriber"},"properties":{"$ref":"#/components/schemas/BenefitGrantSlackSharedChannelProperties"}},"type":"object","required":["created_at","modified_at","id","granted_at","revoked_at","customer_id","benefit_id","subscription_id","order_id","is_granted","is_revoked","customer","benefit","properties"],"title":"CustomerBenefitGrantSlackSharedChannel"},"CustomerBenefitGrantSlackSharedChannelPropertiesUpdate":{"properties":{"invited_email":{"type":"string","format":"email","title":"Invited Email"}},"type":"object","required":["invited_email"],"title":"CustomerBenefitGrantSlackSharedChannelPropertiesUpdate"},"CustomerBenefitGrantSlackSharedChannelUpdate":{"properties":{"benefit_type":{"type":"string","const":"slack_shared_channel","title":"Benefit Type"},"properties":{"$ref":"#/components/schemas/CustomerBenefitGrantSlackSharedChannelPropertiesUpdate"}},"type":"object","required":["benefit_type","properties"],"title":"CustomerBenefitGrantSlackSharedChannelUpdate"},"CustomerBenefitGrantSortProperty":{"type":"string","enum":["granted_at","-granted_at","type","-type","organization","-organization","product_benefit","-product_benefit"],"title":"CustomerBenefitGrantSortProperty"},"CustomerBenefitGrantUpdate":{"oneOf":[{"$ref":"#/components/schemas/CustomerBenefitGrantDiscordUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantGitHubRepositoryUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantDownloadablesUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantLicenseKeysUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantCustomUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantMeterCreditUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantFeatureFlagUpdate"},{"$ref":"#/components/schemas/CustomerBenefitGrantSlackSharedChannelUpdate"}],"discriminator":{"propertyName":"benefit_type","mapping":{"custom":"#/components/schemas/CustomerBenefitGrantCustomUpdate","discord":"#/components/schemas/CustomerBenefitGrantDiscordUpdate","downloadables":"#/components/schemas/CustomerBenefitGrantDownloadablesUpdate","feature_flag":"#/components/schemas/CustomerBenefitGrantFeatureFlagUpdate","github_repository":"#/components/schemas/CustomerBenefitGrantGitHubRepositoryUpdate","license_keys":"#/components/schemas/CustomerBenefitGrantLicenseKeysUpdate","meter_credit":"#/components/schemas/CustomerBenefitGrantMeterCreditUpdate","slack_shared_channel":"#/components/schemas/CustomerBenefitGrantSlackSharedChannelUpdate"}}},"CustomerCancellationReason":{"type":"string","enum":["customer_service","low_quality","missing_features","switched_service","too_complex","too_expensive","unused","other"],"title":"CustomerCancellationReason"},"CustomerCreate":{"oneOf":[{"$ref":"#/components/schemas/CustomerIndividualCreate"},{"$ref":"#/components/schemas/CustomerTeamCreate"}]},"CustomerCreatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"customer.created","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/CustomerCreatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"CustomerCreatedEvent","description":"An event created by Polar when a customer is created."},"CustomerCreatedMetadata":{"properties":{"customer_id":{"type":"string","title":"Customer Id"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer External Id"}},"type":"object","required":["customer_id","customer_email","customer_name","customer_external_id"],"title":"CustomerCreatedMetadata"},"CustomerCustomerMeter":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter.","examples":["d498a884-e2cd-4d3e-8002-f536468a8b22"]},"consumed_units":{"type":"number","title":"Consumed Units","description":"The number of consumed units.","examples":[25.0]},"credited_units":{"type":"integer","title":"Credited Units","description":"The number of credited units.","examples":[100]},"balance":{"type":"number","title":"Balance","description":"The balance of the meter, i.e. the difference between credited and consumed units.","examples":[75.0]},"meter":{"$ref":"#/components/schemas/CustomerCustomerMeterMeter"}},"type":"object","required":["id","created_at","modified_at","customer_id","meter_id","consumed_units","credited_units","balance","meter"],"title":"CustomerCustomerMeter"},"CustomerCustomerMeterMeter":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"The name of the meter. Will be shown on customer's invoices and usage."}},"type":"object","required":["created_at","modified_at","id","name"],"title":"CustomerCustomerMeterMeter"},"CustomerCustomerMeterSortProperty":{"type":"string","enum":["created_at","-created_at","modified_at","-modified_at","meter_id","-meter_id","meter_name","-meter_name","consumed_units","-consumed_units","credited_units","-credited_units","balance","-balance"],"title":"CustomerCustomerMeterSortProperty"},"CustomerCustomerSession":{"properties":{"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url"}},"type":"object","required":["expires_at","return_url"],"title":"CustomerCustomerSession"},"CustomerDeletedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"customer.deleted","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/CustomerDeletedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"CustomerDeletedEvent","description":"An event created by Polar when a customer is deleted."},"CustomerDeletedMetadata":{"properties":{"customer_id":{"type":"string","title":"Customer Id"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer External Id"}},"type":"object","required":["customer_id","customer_email","customer_name","customer_external_id"],"title":"CustomerDeletedMetadata"},"CustomerEmailUpdateRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"CustomerEmailUpdateRequest"},"CustomerEmailUpdateVerifyRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"CustomerEmailUpdateVerifyRequest"},"CustomerEmailUpdateVerifyResponse":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"CustomerEmailUpdateVerifyResponse"},"CustomerIndividual":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"type":"string","title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"type":"string","const":"individual","title":"Type","description":"The type of customer.","examples":["individual"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]}},"type":"object","required":["id","created_at","modified_at","metadata","email","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url"],"title":"CustomerIndividual","description":"A customer in an organization."},"CustomerIndividualCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Name"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}]},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the customer. **Required unless you use an organization token.**"},"owner":{"anyOf":[{"$ref":"#/components/schemas/MemberOwnerCreate"},{"type":"null"}],"description":"Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name."},"type":{"type":"string","const":"individual","title":"Type","default":"individual"},"email":{"type":"string","format":"email","title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]}},"type":"object","required":["email"],"title":"CustomerIndividualCreate"},"CustomerMeter":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter.","examples":["d498a884-e2cd-4d3e-8002-f536468a8b22"]},"consumed_units":{"type":"number","title":"Consumed Units","description":"The number of consumed units.","examples":[25.0]},"credited_units":{"type":"integer","title":"Credited Units","description":"The number of credited units.","examples":[100]},"balance":{"type":"number","title":"Balance","description":"The balance of the meter, i.e. the difference between credited and consumed units.","examples":[75.0]},"customer":{"$ref":"#/components/schemas/Customer","description":"The customer associated with this meter."},"meter":{"$ref":"#/components/schemas/Meter","description":"The meter associated with this customer."}},"type":"object","required":["id","created_at","modified_at","customer_id","meter_id","consumed_units","credited_units","balance","customer","meter"],"title":"CustomerMeter","description":"An active customer meter, with current consumed and credited units."},"CustomerMeterSortProperty":{"type":"string","enum":["created_at","-created_at","modified_at","-modified_at","customer_id","-customer_id","customer_name","-customer_name","meter_id","-meter_id","meter_name","-meter_name","consumed_units","-consumed_units","credited_units","-credited_units","balance","-balance"],"title":"CustomerMeterSortProperty"},"CustomerNotReady":{"properties":{"error":{"type":"string","const":"CustomerNotReady","title":"Error","examples":["CustomerNotReady"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"CustomerNotReady"},"CustomerOrder":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"status":{"$ref":"#/components/schemas/OrderStatus","examples":["paid"]},"paid":{"type":"boolean","title":"Paid","description":"Whether the order has been paid for.","examples":[true]},"subtotal_amount":{"type":"integer","title":"Subtotal Amount","description":"Amount in cents, before discounts and taxes.","examples":[10000]},"discount_amount":{"type":"integer","title":"Discount Amount","description":"Discount amount in cents.","examples":[1000]},"net_amount":{"type":"integer","title":"Net Amount","description":"Amount in cents, after discounts but before taxes.","examples":[9000]},"tax_amount":{"type":"integer","title":"Tax Amount","description":"Sales tax amount in cents.","examples":[720]},"total_amount":{"type":"integer","title":"Total Amount","description":"Amount in cents, after discounts and taxes.","examples":[9720]},"applied_balance_amount":{"type":"integer","title":"Applied Balance Amount","description":"Customer's balance amount applied to this invoice. Can increase the total amount paid, if the customer has a negative balance, or decrease it, if the customer has a positive balance.Amount in cents.","examples":[0]},"due_amount":{"type":"integer","title":"Due Amount","description":"Amount in cents that is due for this order.","examples":[0]},"refunded_amount":{"type":"integer","title":"Refunded Amount","description":"Amount refunded in cents.","examples":[0]},"refunded_tax_amount":{"type":"integer","title":"Refunded Tax Amount","description":"Sales tax refunded in cents.","examples":[0]},"currency":{"type":"string","title":"Currency","examples":["usd"]},"billing_reason":{"$ref":"#/components/schemas/OrderBillingReason"},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name of the customer that should appear on the invoice. "},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number","description":"The invoice number associated with this order. `null` while the order is in `draft` status; assigned at finalize."},"is_invoice_generated":{"type":"boolean","title":"Is Invoice Generated","description":"Whether an invoice has been generated for this order."},"receipt_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Receipt Number","description":"The receipt number for this order. Set once the order is paid for organizations with receipts enabled. When set, a downloadable receipt PDF can be obtained via the receipt endpoint."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Number of seats purchased (for seat-based one-time orders)."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id"},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id"},"next_payment_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Payment Attempt At","description":"When the next automatic payment retry is scheduled. `null` if the order is not in dunning or all retries have been exhausted."},"product":{"anyOf":[{"$ref":"#/components/schemas/CustomerOrderProduct"},{"type":"null"}]},"subscription":{"anyOf":[{"$ref":"#/components/schemas/CustomerOrderSubscription"},{"type":"null"}]},"items":{"items":{"$ref":"#/components/schemas/OrderItemSchema"},"type":"array","title":"Items","description":"Line items composing the order."},"description":{"type":"string","title":"Description","description":"A summary description of the order.","examples":["Pro Plan"]},"refundable_amount":{"type":"integer","title":"Refundable Amount","description":"Amount in cents that can still be refunded (net, before taxes). Accounts for any applied customer balance and previous refunds.","readOnly":true,"examples":[9000]},"refundable_tax_amount":{"type":"integer","title":"Refundable Tax Amount","description":"Sales tax in cents that would be refunded if the full refundable amount is refunded.","readOnly":true,"examples":[720]}},"type":"object","required":["id","created_at","modified_at","status","paid","subtotal_amount","discount_amount","net_amount","tax_amount","total_amount","applied_balance_amount","due_amount","refunded_amount","refunded_tax_amount","currency","billing_reason","billing_name","billing_address","invoice_number","is_invoice_generated","receipt_number","customer_id","product_id","discount_id","subscription_id","checkout_id","product","subscription","items","description","refundable_amount","refundable_tax_amount"],"title":"CustomerOrder"},"CustomerOrderConfirmPayment":{"properties":{"confirmation_token_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confirmation Token Id","description":"ID of the Stripe confirmation token for new payment methods."},"payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Payment Method Id","description":"ID of an existing saved payment method."},"payment_processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"Payment processor used.","default":"stripe"}},"type":"object","title":"CustomerOrderConfirmPayment","description":"Schema to confirm a retry payment using either a saved payment method or a new confirmation token."},"CustomerOrderInvoice":{"properties":{"url":{"type":"string","title":"Url","description":"The URL to the invoice."}},"type":"object","required":["url"],"title":"CustomerOrderInvoice","description":"Order's invoice data."},"CustomerOrderPaymentConfirmation":{"properties":{"status":{"type":"string","title":"Status","description":"Payment status after confirmation."},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret","description":"Client secret for handling additional actions."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if confirmation failed."}},"type":"object","required":["status"],"title":"CustomerOrderPaymentConfirmation","description":"Response after confirming a retry payment."},"CustomerOrderPaymentStatus":{"properties":{"status":{"type":"string","title":"Status","description":"Current payment status."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"Error message if payment failed."}},"type":"object","required":["status"],"title":"CustomerOrderPaymentStatus","description":"Payment status for an order."},"CustomerOrderProduct":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of prices for this product."},"benefits":{"items":{"$ref":"#/components/schemas/BenefitPublic"},"type":"array","title":"BenefitPublic","description":"List of benefits granted by the product."},"medias":{"items":{"$ref":"#/components/schemas/ProductMediaFileRead"},"type":"array","title":"Medias","description":"List of medias associated to the product."},"organization":{"$ref":"#/components/schemas/CustomerOrganization"}},"type":"object","required":["id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id","prices","benefits","medias","organization"],"title":"CustomerOrderProduct"},"CustomerOrderReceipt":{"properties":{"url":{"type":"string","title":"Url","description":"The URL to the receipt PDF."}},"type":"object","required":["url"],"title":"CustomerOrderReceipt","description":"Order's receipt data."},"CustomerOrderSortProperty":{"type":"string","enum":["created_at","-created_at","amount","-amount","net_amount","-net_amount","product","-product","subscription","-subscription"],"title":"CustomerOrderSortProperty"},"CustomerOrderSubscription":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"amount":{"type":"integer","title":"Amount","description":"The amount of the subscription.","examples":[10000]},"currency":{"type":"string","title":"Currency","description":"The currency of the subscription.","examples":["usd"]},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The interval at which the subscription recurs.","examples":["month"]},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on."},"status":{"$ref":"#/components/schemas/SubscriptionStatus","description":"The status of the subscription.","examples":["active"]},"current_period_start":{"type":"string","format":"date-time","title":"Current Period Start","description":"The start timestamp of the current billing period."},"current_period_end":{"type":"string","format":"date-time","title":"Current Period End","description":"The end timestamp of the current billing period."},"current_meter_period_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period Start","description":"The start timestamp of the current meter period, if the product has a meter cycle set. Metered credits are granted and overage is settled on this cadence."},"current_meter_period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period End","description":"The end timestamp of the current meter period, if the product has a meter cycle set. This is when credits next renew."},"trial_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Start","description":"The start timestamp of the trial period, if any."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"The end timestamp of the trial period, if any."},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","description":"Whether the subscription will be canceled at the end of the current period."},"canceled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Canceled At","description":"The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`."},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"The timestamp when the subscription started."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"The timestamp when the subscription will end."},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At","description":"The timestamp when the subscription ended."},"past_due_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Past Due At","description":"The timestamp when the subscription entered `past_due` status."},"pause_at_period_end":{"type":"boolean","title":"Pause At Period End","description":"Whether the subscription will be paused at the end of the current period."},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At","description":"The timestamp when the subscription was paused."},"resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resumes At","description":"The timestamp when a paused subscription is scheduled to automatically resume, if set."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the subscribed customer."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the subscribed product."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"The ID of the applied discount, if any."},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id"},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"The number of seats for seat-based subscriptions. None for non-seat subscriptions."},"customer_cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}]},"customer_cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Cancellation Comment"}},"type":"object","required":["created_at","modified_at","id","amount","currency","recurring_interval","recurring_interval_count","status","current_period_start","current_period_end","current_meter_period_start","current_meter_period_end","trial_start","trial_end","cancel_at_period_end","canceled_at","started_at","ends_at","ended_at","pause_at_period_end","paused_at","resumes_at","customer_id","product_id","discount_id","checkout_id","customer_cancellation_reason","customer_cancellation_comment"],"title":"CustomerOrderSubscription"},"CustomerOrderUpdate":{"properties":{"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name of the customer that should appear on the invoice."},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}],"description":"The address of the customer that should appear on the invoice. Country and state fields cannot be updated."}},"type":"object","title":"CustomerOrderUpdate","description":"Schema to update an order."},"CustomerOrganization":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"Organization name shown in checkout, customer portal, emails etc."},"slug":{"type":"string","title":"Slug","description":"Unique organization slug in checkout, customer portal and credit card statements."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","description":"Avatar URL shown in checkout, customer portal, emails etc."},"proration_behavior":{"$ref":"#/components/schemas/SubscriptionProrationBehavior","description":"Proration behavior applied when customer updates their subscription from the portal."},"allow_customer_updates":{"type":"boolean","title":"Allow Customer Updates","description":"Whether customers can update their subscriptions from the customer portal."},"customer_portal_settings":{"$ref":"#/components/schemas/OrganizationCustomerPortalSettings","description":"Settings related to the customer portal"},"organization_features":{"$ref":"#/components/schemas/CustomerOrganizationFeatureSettings","description":"Feature flags for the customer portal."}},"type":"object","required":["created_at","modified_at","id","name","slug","avatar_url","proration_behavior","allow_customer_updates","customer_portal_settings"],"title":"CustomerOrganization"},"CustomerOrganizationData":{"properties":{"organization":{"$ref":"#/components/schemas/CustomerOrganization"},"products":{"items":{"$ref":"#/components/schemas/CustomerProduct"},"type":"array","title":"Products"}},"type":"object","required":["organization","products"],"title":"CustomerOrganizationData","description":"Schema of an organization and related data for customer portal."},"CustomerOrganizationFeatureSettings":{"properties":{"member_model_enabled":{"type":"boolean","title":"Member Model Enabled","description":"Whether the member model is enabled for this organization.","default":false},"checkout_localization_enabled":{"type":"boolean","title":"Checkout Localization Enabled","description":"Whether localization is enabled for this organization.","default":false}},"type":"object","title":"CustomerOrganizationFeatureSettings","description":"Feature flags exposed to the customer portal."},"CustomerPaymentMethod":{"anyOf":[{"$ref":"#/components/schemas/PaymentMethodCard"},{"$ref":"#/components/schemas/PaymentMethodGeneric"}]},"CustomerPaymentMethodCard":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"processor":{"$ref":"#/components/schemas/PaymentProcessor"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"type":{"type":"string","const":"card","title":"Type"},"method_metadata":{"$ref":"#/components/schemas/PaymentMethodCardMetadata"},"is_default":{"type":"boolean","title":"Is Default","description":"Whether this payment method is the customer's default payment method.","examples":[true]}},"type":"object","required":["id","created_at","modified_at","processor","customer_id","type","method_metadata","is_default"],"title":"CustomerPaymentMethodCard"},"CustomerPaymentMethodConfirm":{"properties":{"setup_intent_id":{"type":"string","title":"Setup Intent Id"},"set_default":{"type":"boolean","title":"Set Default"}},"type":"object","required":["setup_intent_id","set_default"],"title":"CustomerPaymentMethodConfirm"},"CustomerPaymentMethodCreate":{"properties":{"confirmation_token_id":{"type":"string","title":"Confirmation Token Id"},"set_default":{"type":"boolean","title":"Set Default"},"return_url":{"type":"string","title":"Return Url"}},"type":"object","required":["confirmation_token_id","set_default","return_url"],"title":"CustomerPaymentMethodCreate"},"CustomerPaymentMethodCreateRequiresActionResponse":{"properties":{"status":{"type":"string","const":"requires_action","title":"Status"},"client_secret":{"type":"string","title":"Client Secret"}},"type":"object","required":["status","client_secret"],"title":"CustomerPaymentMethodCreateRequiresActionResponse"},"CustomerPaymentMethodCreateResponse":{"oneOf":[{"$ref":"#/components/schemas/CustomerPaymentMethodCreateSucceededResponse"},{"$ref":"#/components/schemas/CustomerPaymentMethodCreateRequiresActionResponse"}],"discriminator":{"propertyName":"status","mapping":{"requires_action":"#/components/schemas/CustomerPaymentMethodCreateRequiresActionResponse","succeeded":"#/components/schemas/CustomerPaymentMethodCreateSucceededResponse"}}},"CustomerPaymentMethodCreateSucceededResponse":{"properties":{"status":{"type":"string","const":"succeeded","title":"Status"},"payment_method":{"$ref":"#/components/schemas/CustomerPaymentMethod","title":"CustomerPaymentMethod"}},"type":"object","required":["status","payment_method"],"title":"CustomerPaymentMethodCreateSucceededResponse"},"CustomerPaymentMethodGeneric":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"processor":{"$ref":"#/components/schemas/PaymentProcessor"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"type":{"type":"string","title":"Type"},"is_default":{"type":"boolean","title":"Is Default","description":"Whether this payment method is the customer's default payment method.","examples":[false]}},"type":"object","required":["id","created_at","modified_at","processor","customer_id","type","is_default"],"title":"CustomerPaymentMethodGeneric"},"CustomerPortalCustomer":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"email_verified":{"type":"boolean","title":"Email Verified"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"oauth_accounts":{"additionalProperties":{"$ref":"#/components/schemas/CustomerPortalOAuthAccount"},"type":"object","title":"Oauth Accounts"},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id"},"type":{"anyOf":[{"$ref":"#/components/schemas/CustomerType"},{"type":"null"}]},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"}},"type":"object","required":["created_at","modified_at","id","email","email_verified","name","billing_name","billing_address","tax_id","oauth_accounts"],"title":"CustomerPortalCustomer"},"CustomerPortalCustomerSettings":{"properties":{"allow_email_change":{"type":"boolean","title":"Allow Email Change"}},"type":"object","title":"CustomerPortalCustomerSettings"},"CustomerPortalCustomerUpdate":{"properties":{"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}]},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id"}},"type":"object","title":"CustomerPortalCustomerUpdate"},"CustomerPortalMember":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"email":{"type":"string","title":"Email","description":"The email address of the member."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the member."},"role":{"$ref":"#/components/schemas/MemberRole","description":"The role of the member within the team."}},"type":"object","required":["created_at","modified_at","id","email","name","role"],"title":"CustomerPortalMember","description":"A member of the customer's team as seen in the customer portal."},"CustomerPortalMemberCreate":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"The email address of the new member."},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the new member (optional)."},"role":{"$ref":"#/components/schemas/MemberRole","description":"The role for the new member. Defaults to 'member'.","default":"member","examples":["billing_manager","member"]}},"type":"object","required":["email"],"title":"CustomerPortalMemberCreate","description":"Schema for adding a new member to the customer's team."},"CustomerPortalMemberUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the member.","examples":["Jane Doe"]},{"type":"null"}],"title":"Name","description":"The new name for the member."},"role":{"anyOf":[{"$ref":"#/components/schemas/MemberRole"},{"type":"null"}],"description":"The new role for the member.","examples":["billing_manager","member"]}},"type":"object","title":"CustomerPortalMemberUpdate","description":"Schema for updating a member in the customer portal."},"CustomerPortalOAuthAccount":{"properties":{"account_id":{"type":"string","title":"Account Id"},"account_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Username"}},"type":"object","required":["account_id","account_username"],"title":"CustomerPortalOAuthAccount"},"CustomerPortalSubscriptionSettings":{"properties":{"update_seats":{"type":"boolean","title":"Update Seats"},"update_plan":{"type":"boolean","title":"Update Plan"},"pause":{"type":"boolean","title":"Pause"}},"type":"object","required":["update_seats","update_plan"],"title":"CustomerPortalSubscriptionSettings"},"CustomerPortalUsageSettings":{"properties":{"show":{"type":"boolean","title":"Show"}},"type":"object","required":["show"],"title":"CustomerPortalUsageSettings"},"CustomerProduct":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of available prices for this product."},"benefits":{"items":{"$ref":"#/components/schemas/BenefitPublic"},"type":"array","title":"BenefitPublic","description":"List of benefits granted by the product."},"medias":{"items":{"$ref":"#/components/schemas/ProductMediaFileRead"},"type":"array","title":"Medias","description":"The medias associated to the product."}},"type":"object","required":["id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id","prices","benefits","medias"],"title":"CustomerProduct","description":"Schema of a product for customer portal."},"CustomerSeat":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid","title":"Id","description":"The seat ID"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Subscription Id","description":"The subscription ID (for recurring seats)"},"order_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Order Id","description":"The order ID (for one-time purchase seats)"},"status":{"$ref":"#/components/schemas/SeatStatus","description":"Status of the seat"},"customer_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Customer Id","description":"The customer ID. When member_model_enabled is true, this is the billing customer (purchaser). When false, this is the seat member customer."},"member_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Member Id","description":"The member ID of the seat occupant"},"member":{"anyOf":[{"$ref":"#/components/schemas/Member"},{"type":"null"}],"description":"The member associated with this seat"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"Email of the seat member (set when member_model_enabled is true)"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email","description":"The assigned customer email"},"invitation_token_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Invitation Token Expires At","description":"When the invitation token expires"},"claimed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Claimed At","description":"When the seat was claimed"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At","description":"When the seat was revoked"},"seat_metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Seat Metadata","description":"Additional metadata for the seat"}},"type":"object","required":["created_at","modified_at","id","subscription_id","order_id","status","customer_id","member_id","member","email","customer_email","invitation_token_expires_at","claimed_at","revoked_at","seat_metadata"],"title":"CustomerSeat"},"CustomerSeatAssign":{"properties":{"subscription_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Subscription Id","description":"Subscription ID. Required if neither order_id nor checkout_id is provided."},"order_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Order Id","description":"Order ID for one-time purchases. Required if subscription_id is not provided."},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"Email of the customer to assign the seat to"},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"External customer ID for the seat assignment"},"customer_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Customer Id","description":"Customer ID for the seat assignment"},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"External member ID for the seat assignment. Can be used alone (lookup existing member) or with email (create/validate member)."},"member_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Member Id","description":"Member ID for the seat assignment."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata for the seat (max 10 keys, 1KB total)"},"immediate_claim":{"type":"boolean","title":"Immediate Claim","description":"If true, the seat will be immediately claimed without sending an invitation email. API-only feature.","default":false},"checkout_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Checkout Id","description":"Checkout ID. Resolves to the subscription or order produced by the checkout."}},"type":"object","title":"CustomerSeatAssign"},"CustomerSeatClaimResponse":{"properties":{"seat":{"$ref":"#/components/schemas/CustomerSeat","description":"The claimed seat"},"customer_session_token":{"type":"string","title":"Customer Session Token","description":"Session token for immediate customer portal access"}},"type":"object","required":["seat","customer_session_token"],"title":"CustomerSeatClaimResponse","description":"Response after successfully claiming a seat."},"CustomerSession":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"token":{"type":"string","title":"Token"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"return_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Url"},"customer_portal_url":{"type":"string","title":"Customer Portal Url"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"customer":{"$ref":"#/components/schemas/Customer"}},"type":"object","required":["created_at","modified_at","id","token","expires_at","return_url","customer_portal_url","customer_id","customer"],"title":"CustomerSession","description":"A customer session that can be used to authenticate as a customer."},"CustomerSessionCustomerExternalIDCreate":{"properties":{"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member to create a session for. When not provided and the organization has `member_model_enabled`, the owner member of the customer will be used for individual customers."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"External ID of the member to create a session for. Alternative to `member_id`."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the customer portal to return to this URL.","examples":["https://example.com/account"]},"external_customer_id":{"type":"string","title":"External Customer Id","description":"External ID of the customer to create a session for."}},"type":"object","required":["external_customer_id"],"title":"CustomerSessionCustomerExternalIDCreate","description":"Schema for creating a customer session using an external customer ID."},"CustomerSessionCustomerIDCreate":{"properties":{"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member to create a session for. When not provided and the organization has `member_model_enabled`, the owner member of the customer will be used for individual customers."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"External ID of the member to create a session for. Alternative to `member_id`."},"return_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Return Url","description":"When set, a back button will be shown in the customer portal to return to this URL.","examples":["https://example.com/account"]},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"ID of the customer to create a session for."}},"type":"object","required":["customer_id"],"title":"CustomerSessionCustomerIDCreate","description":"Schema for creating a customer session using a customer ID."},"CustomerSortProperty":{"type":"string","enum":["created_at","-created_at","email","-email","name","-name"],"title":"CustomerSortProperty"},"CustomerState":{"oneOf":[{"$ref":"#/components/schemas/CustomerStateIndividual"},{"$ref":"#/components/schemas/CustomerStateTeam"}],"discriminator":{"propertyName":"type","mapping":{"individual":"#/components/schemas/CustomerStateIndividual","team":"#/components/schemas/CustomerStateTeam"}}},"CustomerStateBenefitGrant":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the grant.","examples":["d322132c-a9d0-4e0d-b8d3-d81ad021a3a9"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"granted_at":{"type":"string","format":"date-time","title":"Granted At","description":"The timestamp when the benefit was granted.","examples":["2025-01-03T13:37:00Z"]},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The ID of the benefit concerned by this grant.","examples":["397a17aa-15cf-4cb4-9333-18040203cf98"]},"benefit_type":{"$ref":"#/components/schemas/BenefitType","description":"The type of the benefit concerned by this grant.","examples":["custom"]},"benefit_metadata":{"$ref":"#/components/schemas/MetadataOutputType","description":"The metadata of the benefit concerned by this grant.","examples":[{"key":"value"}]},"properties":{"anyOf":[{"$ref":"#/components/schemas/BenefitGrantDiscordProperties"},{"$ref":"#/components/schemas/BenefitGrantGitHubRepositoryProperties"},{"$ref":"#/components/schemas/BenefitGrantDownloadablesProperties"},{"$ref":"#/components/schemas/BenefitGrantLicenseKeysProperties"},{"$ref":"#/components/schemas/BenefitGrantCustomProperties"},{"$ref":"#/components/schemas/BenefitGrantFeatureFlagProperties"},{"$ref":"#/components/schemas/BenefitGrantSlackSharedChannelProperties"}],"title":"Properties"}},"type":"object","required":["id","created_at","modified_at","granted_at","benefit_id","benefit_type","benefit_metadata","properties"],"title":"CustomerStateBenefitGrant","description":"An active benefit grant for a customer."},"CustomerStateIndividual":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"type":"string","title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"type":"string","const":"individual","title":"Type","description":"The type of customer.","examples":["individual"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]},"active_subscriptions":{"items":{"$ref":"#/components/schemas/CustomerStateSubscription"},"type":"array","title":"Active Subscriptions","description":"The customer's active subscriptions."},"granted_benefits":{"items":{"$ref":"#/components/schemas/CustomerStateBenefitGrant"},"type":"array","title":"Granted Benefits","description":"The customer's active benefit grants."},"active_meters":{"items":{"$ref":"#/components/schemas/CustomerStateMeter"},"type":"array","title":"Active Meters","description":"The customer's active meters."}},"type":"object","required":["id","created_at","modified_at","metadata","email","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url","active_subscriptions","granted_benefits","active_meters"],"title":"CustomerStateIndividual","description":"A customer along with additional state information:\n\n* Active subscriptions\n* Granted benefits\n* Active meters"},"CustomerStateMeter":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter.","examples":["d498a884-e2cd-4d3e-8002-f536468a8b22"]},"consumed_units":{"type":"number","title":"Consumed Units","description":"The number of consumed units.","examples":[25.0]},"credited_units":{"type":"integer","title":"Credited Units","description":"The number of credited units.","examples":[100]},"balance":{"type":"number","title":"Balance","description":"The balance of the meter, i.e. the difference between credited and consumed units.","examples":[75.0]}},"type":"object","required":["id","created_at","modified_at","meter_id","consumed_units","credited_units","balance"],"title":"CustomerStateMeter","description":"An active meter for a customer, with latest consumed and credited units."},"CustomerStateSubscription":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the subscription.","examples":["e5149aae-e521-42b9-b24c-abb3d71eea2e"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"status":{"type":"string","enum":["active","trialing"],"title":"Status","examples":["active","trialing"]},"amount":{"type":"integer","title":"Amount","description":"The amount of the subscription.","examples":[1000]},"currency":{"type":"string","title":"Currency","description":"The currency of the subscription.","examples":["usd"]},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The interval at which the subscription recurs."},"current_period_start":{"type":"string","format":"date-time","title":"Current Period Start","description":"The start timestamp of the current billing period.","examples":["2025-02-03T13:37:00Z"]},"current_period_end":{"type":"string","format":"date-time","title":"Current Period End","description":"The end timestamp of the current billing period.","examples":["2025-03-03T13:37:00Z"]},"trial_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Start","description":"The start timestamp of the trial period, if any.","examples":["2025-02-03T13:37:00Z"]},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"The end timestamp of the trial period, if any.","examples":["2025-03-03T13:37:00Z"]},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","description":"Whether the subscription will be canceled at the end of the current period.","examples":[false]},"canceled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Canceled At","description":"The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`.","examples":[null]},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"The timestamp when the subscription started.","examples":["2025-01-03T13:37:00Z"]},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"The timestamp when the subscription will end.","examples":[null]},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the subscribed product.","examples":["d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23"]},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"The ID of the applied discount, if any.","examples":[null]},"meters":{"items":{"$ref":"#/components/schemas/CustomerStateSubscriptionMeter"},"type":"array","title":"Meters","description":"List of meters associated with the subscription."}},"type":"object","required":["id","created_at","modified_at","metadata","status","amount","currency","recurring_interval","current_period_start","current_period_end","trial_start","trial_end","cancel_at_period_end","canceled_at","started_at","ends_at","product_id","discount_id","meters"],"title":"CustomerStateSubscription","description":"An active customer subscription."},"CustomerStateSubscriptionMeter":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"consumed_units":{"type":"number","title":"Consumed Units","description":"The number of consumed units so far in this billing period.","examples":[25.0]},"credited_units":{"type":"integer","title":"Credited Units","description":"The number of credited units so far in this billing period.","examples":[100]},"amount":{"type":"integer","title":"Amount","description":"The amount due in cents so far in this billing period.","examples":[0]},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter.","examples":["d498a884-e2cd-4d3e-8002-f536468a8b22"]}},"type":"object","required":["created_at","modified_at","id","consumed_units","credited_units","amount","meter_id"],"title":"CustomerStateSubscriptionMeter","description":"Current consumption and spending for a subscription meter."},"CustomerStateTeam":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"type":"string","const":"team","title":"Type","description":"The type of customer. Team customers can have multiple members.","examples":["team"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]},"active_subscriptions":{"items":{"$ref":"#/components/schemas/CustomerStateSubscription"},"type":"array","title":"Active Subscriptions","description":"The customer's active subscriptions."},"granted_benefits":{"items":{"$ref":"#/components/schemas/CustomerStateBenefitGrant"},"type":"array","title":"Granted Benefits","description":"The customer's active benefit grants."},"active_meters":{"items":{"$ref":"#/components/schemas/CustomerStateMeter"},"type":"array","title":"Active Meters","description":"The customer's active meters."}},"type":"object","required":["id","created_at","modified_at","metadata","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url","active_subscriptions","granted_benefits","active_meters"],"title":"CustomerStateTeam","description":"A team customer along with additional state information:\n\n* Active subscriptions\n* Granted benefits\n* Active meters"},"CustomerSubscription":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"amount":{"type":"integer","title":"Amount","description":"The amount of the subscription.","examples":[10000]},"currency":{"type":"string","title":"Currency","description":"The currency of the subscription.","examples":["usd"]},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The interval at which the subscription recurs.","examples":["month"]},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on."},"status":{"$ref":"#/components/schemas/SubscriptionStatus","description":"The status of the subscription.","examples":["active"]},"current_period_start":{"type":"string","format":"date-time","title":"Current Period Start","description":"The start timestamp of the current billing period."},"current_period_end":{"type":"string","format":"date-time","title":"Current Period End","description":"The end timestamp of the current billing period."},"current_meter_period_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period Start","description":"The start timestamp of the current meter period, if the product has a meter cycle set. Metered credits are granted and overage is settled on this cadence."},"current_meter_period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period End","description":"The end timestamp of the current meter period, if the product has a meter cycle set. This is when credits next renew."},"trial_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Start","description":"The start timestamp of the trial period, if any."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"The end timestamp of the trial period, if any."},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","description":"Whether the subscription will be canceled at the end of the current period."},"canceled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Canceled At","description":"The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`."},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"The timestamp when the subscription started."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"The timestamp when the subscription will end."},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At","description":"The timestamp when the subscription ended."},"past_due_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Past Due At","description":"The timestamp when the subscription entered `past_due` status."},"pause_at_period_end":{"type":"boolean","title":"Pause At Period End","description":"Whether the subscription will be paused at the end of the current period."},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At","description":"The timestamp when the subscription was paused."},"resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resumes At","description":"The timestamp when a paused subscription is scheduled to automatically resume, if set."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the subscribed customer."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the subscribed product."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"The ID of the applied discount, if any."},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id"},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"The number of seats for seat-based subscriptions. None for non-seat subscriptions."},"customer_cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}]},"customer_cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Cancellation Comment"},"product":{"$ref":"#/components/schemas/CustomerSubscriptionProduct"},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of enabled prices for the subscription."},"meters":{"items":{"$ref":"#/components/schemas/CustomerSubscriptionMeter"},"type":"array","title":"Meters","description":"List of meters associated with the subscription."},"pending_update":{"anyOf":[{"$ref":"#/components/schemas/PendingSubscriptionUpdate"},{"type":"null"}],"description":"Pending subscription update that will be applied at the beginning of the next period. If `null`, there is no pending update."}},"type":"object","required":["created_at","modified_at","id","amount","currency","recurring_interval","recurring_interval_count","status","current_period_start","current_period_end","current_meter_period_start","current_meter_period_end","trial_start","trial_end","cancel_at_period_end","canceled_at","started_at","ends_at","ended_at","pause_at_period_end","paused_at","resumes_at","customer_id","product_id","discount_id","checkout_id","customer_cancellation_reason","customer_cancellation_comment","product","prices","meters","pending_update"],"title":"CustomerSubscription"},"CustomerSubscriptionCancel":{"properties":{"cancel_at_period_end":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cancel At Period End","description":"Cancel an active subscription once the current period ends.\n\nOr uncancel a subscription currently set to be revoked at period end."},"cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}],"description":"Customers reason for cancellation.\n\n* `too_expensive`: Too expensive for the customer.\n* `missing_features`: Customer is missing certain features.\n* `switched_service`: Customer switched to another service.\n* `unused`: Customer is not using it enough.\n* `customer_service`: Customer is not satisfied with the customer service.\n* `low_quality`: Customer is unhappy with the quality.\n* `too_complex`: Customer considers the service too complicated.\n* `other`: Other reason(s)."},"cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Comment","description":"Customer feedback and why they decided to cancel."}},"type":"object","title":"CustomerSubscriptionCancel"},"CustomerSubscriptionMeter":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"consumed_units":{"type":"number","title":"Consumed Units","description":"The number of consumed units so far in this billing period.","examples":[25.0]},"credited_units":{"type":"integer","title":"Credited Units","description":"The number of credited units so far in this billing period.","examples":[100]},"amount":{"type":"integer","title":"Amount","description":"The amount due in cents so far in this billing period.","examples":[0]},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter.","examples":["d498a884-e2cd-4d3e-8002-f536468a8b22"]},"meter":{"$ref":"#/components/schemas/CustomerSubscriptionMeterMeter"}},"type":"object","required":["created_at","modified_at","id","consumed_units","credited_units","amount","meter_id","meter"],"title":"CustomerSubscriptionMeter"},"CustomerSubscriptionMeterMeter":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"The name of the meter. Will be shown on customer's invoices and usage."}},"type":"object","required":["created_at","modified_at","id","name"],"title":"CustomerSubscriptionMeterMeter"},"CustomerSubscriptionPause":{"properties":{"pause_at_period_end":{"type":"boolean","title":"Pause At Period End","description":"Pause an active subscription at the end of the current period.\n\nOr cancel a scheduled pause on a subscription set to be paused at\nperiod end."},"resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resumes At","description":"Date at which the paused subscription should automatically resume. If not set, it stays paused until resumed. Must be after the current period end."}},"type":"object","required":["pause_at_period_end"],"title":"CustomerSubscriptionPause"},"CustomerSubscriptionProduct":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of prices for this product."},"benefits":{"items":{"$ref":"#/components/schemas/BenefitPublic"},"type":"array","title":"BenefitPublic","description":"List of benefits granted by the product."},"medias":{"items":{"$ref":"#/components/schemas/ProductMediaFileRead"},"type":"array","title":"Medias","description":"List of medias associated to the product."},"organization":{"$ref":"#/components/schemas/CustomerOrganization"}},"type":"object","required":["id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id","prices","benefits","medias","organization"],"title":"CustomerSubscriptionProduct"},"CustomerSubscriptionResume":{"properties":{"resume":{"type":"boolean","const":true,"title":"Resume","description":"Resume a paused subscription immediately, starting a new billing period and charging the customer."}},"type":"object","required":["resume"],"title":"CustomerSubscriptionResume"},"CustomerSubscriptionSortProperty":{"type":"string","enum":["started_at","-started_at","amount","-amount","status","-status","organization","-organization","product","-product"],"title":"CustomerSubscriptionSortProperty"},"CustomerSubscriptionUpdate":{"anyOf":[{"$ref":"#/components/schemas/CustomerSubscriptionUpdateProduct"},{"$ref":"#/components/schemas/CustomerSubscriptionUpdateSeats"},{"$ref":"#/components/schemas/CustomerSubscriptionCancel"},{"$ref":"#/components/schemas/CustomerSubscriptionPause"},{"$ref":"#/components/schemas/CustomerSubscriptionResume"},{"$ref":"#/components/schemas/CustomerSubscriptionUpdateClear"}]},"CustomerSubscriptionUpdateClear":{"properties":{"pending_update":{"type":"null","title":"Pending Update","description":"Clear the pending subscription update."}},"type":"object","required":["pending_update"],"title":"CustomerSubscriptionUpdateClear"},"CustomerSubscriptionUpdateProduct":{"properties":{"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"Update subscription to another product."}},"type":"object","required":["product_id"],"title":"CustomerSubscriptionUpdateProduct"},"CustomerSubscriptionUpdateSeats":{"properties":{"seats":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Seats","description":"Update the number of seats for this subscription."}},"type":"object","required":["seats"],"title":"CustomerSubscriptionUpdateSeats"},"CustomerTeam":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"type":"string","const":"team","title":"Type","description":"The type of customer. Team customers can have multiple members.","examples":["team"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]}},"type":"object","required":["id","created_at","modified_at","metadata","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url"],"title":"CustomerTeam","description":"A team customer in an organization."},"CustomerTeamCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Name"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}]},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the customer. **Required unless you use an organization token.**"},"owner":{"anyOf":[{"$ref":"#/components/schemas/MemberOwnerCreate"},{"type":"null"}],"description":"Optional owner member to create with the customer. If not provided, an owner member will be automatically created using the customer's email and name."},"type":{"type":"string","const":"team","title":"Type"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"The email address of the team customer. Optional for team customers — if omitted, an owner with an email must be provided.","examples":["customer@example.com"]}},"type":"object","required":["type"],"title":"CustomerTeamCreate"},"CustomerType":{"type":"string","enum":["individual","team"],"title":"CustomerType"},"CustomerUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Name"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}]},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"type":{"anyOf":[{"$ref":"#/components/schemas/CustomerType"},{"type":"null"}],"description":"The customer type. Can only be upgraded from 'individual' to 'team', never downgraded.","examples":["team"]}},"type":"object","title":"CustomerUpdate"},"CustomerUpdateExternalID":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the customer.","examples":["John Doe"]},{"type":"null"}],"title":"Name"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}]},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string","description":"Locale of the customer, given as an IETF BCP 47 language tag, e.g. `en`, `en-US` or `en-GB-oxendict`. If `null` or unsupported, the locale will default to `en`.","examples":["en","en-US","fr","fr-CA"]},{"type":"null"}],"title":"Locale"}},"type":"object","title":"CustomerUpdateExternalID"},"CustomerUpdatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"customer.updated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/CustomerUpdatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"CustomerUpdatedEvent","description":"An event created by Polar when a customer is updated."},"CustomerUpdatedFields":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressDict"},{"type":"null"}]},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"metadata":{"anyOf":[{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"}]},"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","title":"CustomerUpdatedFields"},"CustomerUpdatedMetadata":{"properties":{"customer_id":{"type":"string","title":"Customer Id"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer External Id"},"updated_fields":{"$ref":"#/components/schemas/CustomerUpdatedFields"}},"type":"object","required":["customer_id","customer_email","customer_name","customer_external_id","updated_fields"],"title":"CustomerUpdatedMetadata"},"CustomerWallet":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer that owns the wallet.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"balance":{"type":"integer","title":"Balance","description":"The current balance of the wallet, in cents.","examples":[5000]},"currency":{"type":"string","title":"Currency","description":"The currency of the wallet.","examples":["usd"]}},"type":"object","required":["id","created_at","modified_at","customer_id","balance","currency"],"title":"CustomerWallet","description":"A wallet represents your balance with an organization.\n\nYou can top-up your wallet and use the balance to pay for usage."},"CustomerWalletSortProperty":{"type":"string","enum":["created_at","-created_at","balance","-balance"],"title":"CustomerWalletSortProperty"},"Discount":{"oneOf":[{"$ref":"#/components/schemas/DiscountFixedOnceForeverDuration"},{"$ref":"#/components/schemas/DiscountFixedRepeatDuration"},{"$ref":"#/components/schemas/DiscountPercentageOnceForeverDuration"},{"$ref":"#/components/schemas/DiscountPercentageRepeatDuration"}]},"DiscountCreate":{"oneOf":[{"$ref":"#/components/schemas/DiscountFixedCreate"},{"$ref":"#/components/schemas/DiscountPercentageCreate"}],"discriminator":{"propertyName":"type","mapping":{"fixed":"#/components/schemas/DiscountFixedCreate","percentage":"#/components/schemas/DiscountPercentageCreate"}}},"DiscountDuration":{"type":"string","enum":["once","forever","repeating"],"title":"DiscountDuration"},"DiscountFixedCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Optional timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Optional timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer","maximum":2147483647.0,"minimum":1.0},{"type":"null"}],"title":"Max Redemptions","description":"Optional maximum number of times the discount can be redeemed."},"products":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array","description":"List of product IDs the discount can be applied to."},{"type":"null"}],"title":"Products"},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the discount. **Required unless you use an organization token.**"},"type":{"type":"string","const":"fixed","title":"Type","default":"fixed"},"duration":{"$ref":"#/components/schemas/DiscountDuration","description":"For subscriptions, determines if the discount should be applied once on the first invoice, forever, or for a certain number of months determined by `duration_in_months`."},"duration_in_months":{"anyOf":[{"type":"integer","maximum":999.0,"minimum":1.0},{"type":"null"}],"title":"Duration In Months","description":"Number of months the discount should be applied.\n\nRequired when `duration` is `repeating`. Must be omitted otherwise.\n\nFor this to work on yearly pricing, you should multiply this by 12.\nFor example, to apply the discount for 2 years, set this to 24."},"amount":{"anyOf":[{"type":"integer","maximum":999999999999.0,"minimum":0.0,"description":"Fixed amount to discount from the invoice total."},{"type":"null"}],"title":"Amount","deprecated":true},"currency":{"anyOf":[{"$ref":"#/components/schemas/PresentmentCurrency","description":"The currency of the fixed amount discount."},{"type":"null"}],"default":"usd","deprecated":true},"amounts":{"anyOf":[{"additionalProperties":{"type":"integer","maximum":999999999999.0,"minimum":0.0,"description":"Fixed amount to discount from the invoice total."},"propertyNames":{"$ref":"#/components/schemas/PresentmentCurrency"},"type":"object","minProperties":1,"description":"Map of currency to fixed amount to discount from the total. This allows specifying different discount amounts for different currencies."},{"type":"null"}],"title":"Amounts"}},"type":"object","required":["name","duration"],"title":"DiscountFixedCreate","description":"Schema to create a fixed amount discount."},"DiscountFixedOnceForeverDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"type":{"$ref":"#/components/schemas/DiscountType"},"amount":{"type":"integer","title":"Amount","deprecated":true,"examples":[1000]},"currency":{"type":"string","title":"Currency","deprecated":true,"examples":["usd"]},"amounts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Amounts","description":"Map of currency to fixed amount to discount from the total.","examples":[{"eur":900,"usd":1000}]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"products":{"items":{"$ref":"#/components/schemas/DiscountProduct"},"type":"array","title":"Products"}},"type":"object","required":["duration","type","amount","currency","amounts","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id","products"],"title":"DiscountFixedOnceForeverDuration","description":"Schema for a fixed amount discount that is applied once or forever."},"DiscountFixedOnceForeverDurationBase":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"type":{"$ref":"#/components/schemas/DiscountType"},"amount":{"type":"integer","title":"Amount","deprecated":true,"examples":[1000]},"currency":{"type":"string","title":"Currency","deprecated":true,"examples":["usd"]},"amounts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Amounts","description":"Map of currency to fixed amount to discount from the total.","examples":[{"eur":900,"usd":1000}]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]}},"type":"object","required":["duration","type","amount","currency","amounts","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id"],"title":"DiscountFixedOnceForeverDurationBase"},"DiscountFixedRepeatDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"duration_in_months":{"type":"integer","title":"Duration In Months"},"type":{"$ref":"#/components/schemas/DiscountType"},"amount":{"type":"integer","title":"Amount","deprecated":true,"examples":[1000]},"currency":{"type":"string","title":"Currency","deprecated":true,"examples":["usd"]},"amounts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Amounts","description":"Map of currency to fixed amount to discount from the total.","examples":[{"eur":900,"usd":1000}]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"products":{"items":{"$ref":"#/components/schemas/DiscountProduct"},"type":"array","title":"Products"}},"type":"object","required":["duration","duration_in_months","type","amount","currency","amounts","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id","products"],"title":"DiscountFixedRepeatDuration","description":"Schema for a fixed amount discount that is applied on every invoice\nfor a certain number of months."},"DiscountFixedRepeatDurationBase":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"duration_in_months":{"type":"integer","title":"Duration In Months"},"type":{"$ref":"#/components/schemas/DiscountType"},"amount":{"type":"integer","title":"Amount","deprecated":true,"examples":[1000]},"currency":{"type":"string","title":"Currency","deprecated":true,"examples":["usd"]},"amounts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Amounts","description":"Map of currency to fixed amount to discount from the total.","examples":[{"eur":900,"usd":1000}]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]}},"type":"object","required":["duration","duration_in_months","type","amount","currency","amounts","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id"],"title":"DiscountFixedRepeatDurationBase"},"DiscountPercentageCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Optional timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Optional timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer","maximum":2147483647.0,"minimum":1.0},{"type":"null"}],"title":"Max Redemptions","description":"Optional maximum number of times the discount can be redeemed."},"products":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array","description":"List of product IDs the discount can be applied to."},{"type":"null"}],"title":"Products"},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the discount. **Required unless you use an organization token.**"},"type":{"type":"string","const":"percentage","title":"Type","default":"percentage"},"duration":{"$ref":"#/components/schemas/DiscountDuration","description":"For subscriptions, determines if the discount should be applied once on the first invoice, forever, or for a certain number of months determined by `duration_in_months`."},"duration_in_months":{"anyOf":[{"type":"integer","maximum":999.0,"minimum":1.0},{"type":"null"}],"title":"Duration In Months","description":"Number of months the discount should be applied.\n\nRequired when `duration` is `repeating`. Must be omitted otherwise.\n\nFor this to work on yearly pricing, you should multiply this by 12.\nFor example, to apply the discount for 2 years, set this to 24."},"basis_points":{"type":"integer","maximum":10000.0,"minimum":1.0,"title":"Basis Points","description":"Discount percentage in basis points.\n\nA basis point is 1/100th of a percent.\nFor example, to create a 25.5% discount, set this to 2550."}},"type":"object","required":["name","duration","basis_points"],"title":"DiscountPercentageCreate","description":"Schema to create a percentage discount."},"DiscountPercentageOnceForeverDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"type":{"$ref":"#/components/schemas/DiscountType"},"basis_points":{"type":"integer","title":"Basis Points","description":"Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.","examples":[1000]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"products":{"items":{"$ref":"#/components/schemas/DiscountProduct"},"type":"array","title":"Products"}},"type":"object","required":["duration","type","basis_points","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id","products"],"title":"DiscountPercentageOnceForeverDuration","description":"Schema for a percentage discount that is applied once or forever."},"DiscountPercentageOnceForeverDurationBase":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"type":{"$ref":"#/components/schemas/DiscountType"},"basis_points":{"type":"integer","title":"Basis Points","description":"Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.","examples":[1000]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]}},"type":"object","required":["duration","type","basis_points","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id"],"title":"DiscountPercentageOnceForeverDurationBase"},"DiscountPercentageRepeatDuration":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"duration_in_months":{"type":"integer","title":"Duration In Months"},"type":{"$ref":"#/components/schemas/DiscountType"},"basis_points":{"type":"integer","title":"Basis Points","description":"Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.","examples":[1000]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"products":{"items":{"$ref":"#/components/schemas/DiscountProduct"},"type":"array","title":"Products"}},"type":"object","required":["duration","duration_in_months","type","basis_points","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id","products"],"title":"DiscountPercentageRepeatDuration","description":"Schema for a percentage discount that is applied on every invoice\nfor a certain number of months."},"DiscountPercentageRepeatDurationBase":{"properties":{"duration":{"$ref":"#/components/schemas/DiscountDuration"},"duration_in_months":{"type":"integer","title":"Duration In Months"},"type":{"$ref":"#/components/schemas/DiscountType"},"basis_points":{"type":"integer","title":"Basis Points","description":"Discount percentage in basis points. A basis point is 1/100th of a percent. For example, 1000 basis points equals a 10% discount.","examples":[1000]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"name":{"type":"string","title":"Name","description":"Name of the discount. Will be displayed to the customer when the discount is applied."},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Redemptions","description":"Maximum number of times the discount can be redeemed."},"redemptions_count":{"type":"integer","title":"Redemptions Count","description":"Number of times the discount has been redeemed."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]}},"type":"object","required":["duration","duration_in_months","type","basis_points","created_at","modified_at","id","metadata","name","code","starts_at","ends_at","max_redemptions","redemptions_count","organization_id"],"title":"DiscountPercentageRepeatDurationBase"},"DiscountProduct":{"properties":{"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."}},"type":"object","required":["metadata","id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id"],"title":"DiscountProduct","description":"A product that a discount can be applied to."},"DiscountSortProperty":{"type":"string","enum":["created_at","-created_at","name","-name","code","-code","redemptions_count","-redemptions_count","ends_at","-ends_at"],"title":"DiscountSortProperty"},"DiscountType":{"type":"string","enum":["fixed","percentage"],"title":"DiscountType"},"DiscountUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":1,"description":"Name of the discount. Will be displayed to the customer when the discount is applied."},{"type":"null"}],"title":"Name"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API."},"starts_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Starts At","description":"Optional timestamp after which the discount is redeemable."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"Optional timestamp after which the discount is no longer redeemable."},"max_redemptions":{"anyOf":[{"type":"integer","maximum":2147483647.0,"minimum":1.0},{"type":"null"}],"title":"Max Redemptions","description":"Optional maximum number of times the discount can be redeemed."},"duration":{"anyOf":[{"$ref":"#/components/schemas/DiscountDuration"},{"type":"null"}]},"duration_in_months":{"anyOf":[{"type":"integer","maximum":999.0,"minimum":1.0,"description":"Number of months the discount should be applied.\n\nFor this to work on yearly pricing, you should multiply this by 12.\nFor example, to apply the discount for 2 years, set this to 24."},{"type":"null"}],"title":"Duration In Months"},"type":{"anyOf":[{"$ref":"#/components/schemas/DiscountType"},{"type":"null"}]},"amount":{"anyOf":[{"type":"integer","maximum":999999999999.0,"minimum":0.0,"description":"Fixed amount to discount from the invoice total."},{"type":"null"}],"title":"Amount","deprecated":true},"currency":{"anyOf":[{"$ref":"#/components/schemas/PresentmentCurrency","description":"The currency of the fixed amount discount."},{"type":"null"}],"deprecated":true},"amounts":{"anyOf":[{"additionalProperties":{"type":"integer","maximum":999999999999.0,"minimum":0.0,"description":"Fixed amount to discount from the invoice total."},"propertyNames":{"$ref":"#/components/schemas/PresentmentCurrency"},"type":"object","minProperties":1,"description":"Map of currency to fixed amount to discount from the total. This allows specifying different discount amounts for different currencies."},{"type":"null"}],"title":"Amounts"},"basis_points":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":1.0,"description":"Discount percentage in basis points.\n\nA basis point is 1/100th of a percent.\nFor example, to create a 25.5% discount, set this to 2550."},{"type":"null"}],"title":"Basis Points"},"products":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array","description":"List of product IDs the discount can be applied to."},{"type":"null"}],"title":"Products"}},"type":"object","title":"DiscountUpdate","description":"Schema to update a discount."},"Dispute":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"status":{"$ref":"#/components/schemas/DisputeStatus","description":"Status of the dispute. `prevented` means we issued a refund before the dispute was escalated, avoiding any fees.","examples":["needs_response","prevented"]},"resolved":{"type":"boolean","title":"Resolved","description":"Whether the dispute has been resolved (won or lost).","examples":[false]},"closed":{"type":"boolean","title":"Closed","description":"Whether the dispute is closed (prevented, won, or lost).","examples":[false]},"amount":{"type":"integer","title":"Amount","description":"Amount in cents disputed.","examples":[1000]},"tax_amount":{"type":"integer","title":"Tax Amount","description":"Tax amount in cents disputed.","examples":[200]},"currency":{"type":"string","title":"Currency","description":"Currency code of the dispute.","examples":["usd"]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason","description":"The reason for the dispute as reported by the card network (e.g. `fraudulent`, `product_not_received`). `None` until the processor reports it.","examples":["fraudulent"]},"evidence_due_by":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Evidence Due By","description":"Deadline to submit evidence in response to the dispute. `None` when no response is required."},"past_due":{"type":"boolean","title":"Past Due","description":"Whether the evidence submission deadline has passed.","examples":[false]},"order_id":{"type":"string","format":"uuid4","title":"Order Id","description":"The ID of the order associated with the dispute.","examples":["57107b74-8400-4d80-a2fc-54c2b4239cb3"]},"payment_id":{"type":"string","format":"uuid4","title":"Payment Id","description":"The ID of the payment associated with the dispute.","examples":["42b94870-36b9-4573-96b6-b90b1c99a353"]},"customer":{"$ref":"#/components/schemas/DisputeCustomer","description":"The customer who was charged for the disputed payment."},"case_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Case Id","description":"The ID of the support case for this dispute, if one was opened."}},"type":"object","required":["created_at","modified_at","id","status","resolved","closed","amount","tax_amount","currency","reason","evidence_due_by","past_due","order_id","payment_id","customer","case_id"],"title":"Dispute","description":"Schema representing a dispute.\n\nA dispute is a challenge raised by a customer or their bank regarding a payment."},"DisputeCustomer":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"$ref":"#/components/schemas/CustomerType","description":"The type of customer: 'individual' for single users, 'team' for customers with multiple members.","examples":["individual"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]}},"type":"object","required":["id","created_at","modified_at","metadata","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url"],"title":"DisputeCustomer"},"DisputeNotOpenError":{"properties":{"error":{"type":"string","const":"DisputeNotOpenError","title":"Error","examples":["DisputeNotOpenError"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"DisputeNotOpenError"},"DisputeSortProperty":{"type":"string","enum":["created_at","-created_at","amount","-amount"],"title":"DisputeSortProperty"},"DisputeStatus":{"type":"string","enum":["prevented","early_warning","needs_response","under_review","lost","won"],"title":"DisputeStatus"},"DownloadableFileCreate":{"properties":{"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id"},"name":{"type":"string","title":"Name"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"upload":{"$ref":"#/components/schemas/S3FileCreateMultipart"},"service":{"type":"string","const":"downloadable","title":"Service"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"}},"type":"object","required":["name","mime_type","size","upload","service"],"title":"DownloadableFileCreate","description":"Schema to create a file to be associated with the downloadables benefit."},"DownloadableFileRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"name":{"type":"string","title":"Name"},"path":{"type":"string","title":"Path"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"storage_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Version"},"checksum_etag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"checksum_sha256_hex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Hex"},"last_modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Modified At"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"service":{"type":"string","const":"downloadable","title":"Service"},"is_uploaded":{"type":"boolean","title":"Is Uploaded"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"size_readable":{"type":"string","title":"Size Readable","readOnly":true}},"type":"object","required":["id","organization_id","name","path","mime_type","size","storage_version","checksum_etag","checksum_sha256_base64","checksum_sha256_hex","last_modified_at","version","service","is_uploaded","created_at","size_readable"],"title":"DownloadableFileRead","description":"File to be associated with the downloadables benefit."},"DownloadableRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id"},"file":{"$ref":"#/components/schemas/FileDownload"}},"type":"object","required":["id","benefit_id","file"],"title":"DownloadableRead"},"Event":{"oneOf":[{"$ref":"#/components/schemas/SystemEvent"},{"$ref":"#/components/schemas/UserEvent"}],"discriminator":{"propertyName":"source","mapping":{"system":"#/components/schemas/SystemEvent","user":"#/components/schemas/UserEvent"}}},"EventCreateCustomer":{"properties":{"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the event."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the event. **Required unless you use an organization token.**"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"Your unique identifier for this event. Useful for deduplication and parent-child relationships."},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event. Can be either a Polar event ID (UUID) or an external event ID."},"metadata":{"$ref":"#/components/schemas/EventMetadataInput","description":"Key-value object allowing you to store additional information about the event. Some keys like `_llm` are structured data that are handled specially by Polar.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action. Used for member-level attribution in B2B."}},"type":"object","required":["name","customer_id"],"title":"EventCreateCustomer"},"EventCreateExternalCustomer":{"properties":{"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"name":{"type":"string","maxLength":128,"title":"Name","description":"The name of the event."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the event. **Required unless you use an organization token.**"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"Your unique identifier for this event. Useful for deduplication and parent-child relationships."},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event. Can be either a Polar event ID (UUID) or an external event ID."},"metadata":{"$ref":"#/components/schemas/EventMetadataInput","description":"Key-value object allowing you to store additional information about the event. Some keys like `_llm` are structured data that are handled specially by Polar.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"external_customer_id":{"type":"string","title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action. Used for member-level attribution in B2B."}},"type":"object","required":["name","external_customer_id"],"title":"EventCreateExternalCustomer"},"EventMetadataInput":{"properties":{"_cost":{"$ref":"#/components/schemas/CostMetadata-Input"},"_llm":{"$ref":"#/components/schemas/LLMMetadata"}},"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"type":"object","title":"EventMetadataInput"},"EventMetadataOutput":{"properties":{"_cost":{"$ref":"#/components/schemas/CostMetadata-Output"},"_llm":{"$ref":"#/components/schemas/LLMMetadata"}},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"type":"object","title":"EventMetadataOutput"},"EventName":{"properties":{"name":{"type":"string","title":"Name","description":"The name of the event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event."},"source":{"$ref":"#/components/schemas/EventSource","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"occurrences":{"type":"integer","title":"Occurrences","description":"Number of times the event has occurred."},"first_seen":{"type":"string","format":"date-time","title":"First Seen","description":"The first time the event occurred."},"last_seen":{"type":"string","format":"date-time","title":"Last Seen","description":"The last time the event occurred."}},"type":"object","required":["name","label","source","occurrences","first_seen","last_seen"],"title":"EventName"},"EventNamesSortProperty":{"type":"string","enum":["name","-name","occurrences","-occurrences","first_seen","-first_seen","last_seen","-last_seen"],"title":"EventNamesSortProperty"},"EventSortProperty":{"type":"string","enum":["timestamp","-timestamp"],"title":"EventSortProperty"},"EventSource":{"type":"string","enum":["system","user"],"title":"EventSource"},"EventType":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"The name of the event type."},"label":{"type":"string","title":"Label","description":"The label for the event type."},"label_property_selector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label Property Selector","description":"Property path to extract dynamic label from event metadata."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event type."}},"type":"object","required":["created_at","modified_at","id","name","label","organization_id"],"title":"EventType"},"EventTypeUpdate":{"properties":{"label":{"type":"string","maxLength":128,"minLength":1,"title":"Label","description":"The label for the event type."},"label_property_selector":{"anyOf":[{"type":"string","maxLength":256,"minLength":1},{"type":"null"}],"title":"Label Property Selector","description":"Property path to extract dynamic label from event metadata (e.g., 'subject' or 'metadata.subject')."}},"type":"object","required":["label"],"title":"EventTypeUpdate"},"EventTypeWithStats":{"properties":{"id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Id","description":"The ID of the event type. Null for system event types."},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At","description":"Creation timestamp of the event type. Null for system event types."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the event type. Null for system event types."},"name":{"type":"string","title":"Name","description":"The name of the event type."},"label":{"type":"string","title":"Label","description":"The label for the event type."},"label_property_selector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label Property Selector","description":"Property path to extract dynamic label from event metadata."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event type."},"source":{"$ref":"#/components/schemas/EventSource","description":"The source of the events (system or user)."},"occurrences":{"type":"integer","title":"Occurrences","description":"Number of times the event has occurred."},"first_seen":{"type":"string","format":"date-time","title":"First Seen","description":"The first time the event occurred."},"last_seen":{"type":"string","format":"date-time","title":"Last Seen","description":"The last time the event occurred."}},"type":"object","required":["name","label","organization_id","source","occurrences","first_seen","last_seen"],"title":"EventTypeWithStats"},"EventTypesSortProperty":{"type":"string","enum":["name","-name","label","-label","occurrences","-occurrences","first_seen","-first_seen","last_seen","-last_seen"],"title":"EventTypesSortProperty"},"EventsIngest":{"properties":{"events":{"items":{"anyOf":[{"$ref":"#/components/schemas/EventCreateCustomer"},{"$ref":"#/components/schemas/EventCreateExternalCustomer"}]},"type":"array","title":"Events","description":"List of events to ingest."}},"type":"object","required":["events"],"title":"EventsIngest"},"EventsIngestResponse":{"properties":{"inserted":{"type":"integer","title":"Inserted","description":"Number of events inserted."},"duplicates":{"type":"integer","title":"Duplicates","description":"Number of duplicate events skipped.","default":0}},"type":"object","required":["inserted"],"title":"EventsIngestResponse"},"ExistingProductPrice":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"}},"type":"object","required":["id"],"title":"ExistingProductPrice","description":"A price that already exists for this product.\n\nUseful when updating a product if you want to keep an existing price."},"ExpiredCheckoutError":{"properties":{"error":{"type":"string","const":"ExpiredCheckoutError","title":"Error","examples":["ExpiredCheckoutError"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"ExpiredCheckoutError"},"FileCreate":{"oneOf":[{"$ref":"#/components/schemas/DownloadableFileCreate"},{"$ref":"#/components/schemas/ProductMediaFileCreate"},{"$ref":"#/components/schemas/OrganizationAvatarFileCreate"},{"$ref":"#/components/schemas/SupportCaseAttachmentFileCreate"}],"discriminator":{"propertyName":"service","mapping":{"downloadable":"#/components/schemas/DownloadableFileCreate","organization_avatar":"#/components/schemas/OrganizationAvatarFileCreate","product_media":"#/components/schemas/ProductMediaFileCreate","support_case_attachment":"#/components/schemas/SupportCaseAttachmentFileCreate"}}},"FileDownload":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"name":{"type":"string","title":"Name"},"path":{"type":"string","title":"Path"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"storage_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Version"},"checksum_etag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"checksum_sha256_hex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Hex"},"last_modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Modified At"},"download":{"$ref":"#/components/schemas/S3DownloadURL"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"is_uploaded":{"type":"boolean","title":"Is Uploaded"},"service":{"$ref":"#/components/schemas/FileServiceTypes"},"size_readable":{"type":"string","title":"Size Readable","readOnly":true}},"type":"object","required":["id","organization_id","name","path","mime_type","size","storage_version","checksum_etag","checksum_sha256_base64","checksum_sha256_hex","last_modified_at","download","version","is_uploaded","service","size_readable"],"title":"FileDownload"},"FilePatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"}},"type":"object","title":"FilePatch"},"FileRead":{"oneOf":[{"$ref":"#/components/schemas/DownloadableFileRead"},{"$ref":"#/components/schemas/ProductMediaFileRead"},{"$ref":"#/components/schemas/OrganizationAvatarFileRead"},{"$ref":"#/components/schemas/SupportCaseAttachmentFileRead"}],"discriminator":{"propertyName":"service","mapping":{"downloadable":"#/components/schemas/DownloadableFileRead","organization_avatar":"#/components/schemas/OrganizationAvatarFileRead","product_media":"#/components/schemas/ProductMediaFileRead","support_case_attachment":"#/components/schemas/SupportCaseAttachmentFileRead"}}},"FileServiceTypes":{"type":"string","enum":["downloadable","product_media","organization_avatar","support_case_attachment"],"title":"FileServiceTypes"},"FileUpload":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"name":{"type":"string","title":"Name"},"path":{"type":"string","title":"Path"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"storage_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Version"},"checksum_etag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"checksum_sha256_hex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Hex"},"last_modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Modified At"},"upload":{"$ref":"#/components/schemas/S3FileUploadMultipart"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"is_uploaded":{"type":"boolean","title":"Is Uploaded","default":false},"service":{"$ref":"#/components/schemas/FileServiceTypes"},"size_readable":{"type":"string","title":"Size Readable","readOnly":true}},"type":"object","required":["id","organization_id","name","path","mime_type","size","storage_version","checksum_etag","checksum_sha256_base64","checksum_sha256_hex","last_modified_at","upload","version","service","size_readable"],"title":"FileUpload"},"FileUploadCompleted":{"properties":{"id":{"type":"string","title":"Id"},"path":{"type":"string","title":"Path"},"parts":{"items":{"$ref":"#/components/schemas/S3FileUploadCompletedPart"},"type":"array","title":"Parts"}},"type":"object","required":["id","path","parts"],"title":"FileUploadCompleted"},"Filter":{"properties":{"conjunction":{"$ref":"#/components/schemas/FilterConjunction"},"clauses":{"items":{"anyOf":[{"$ref":"#/components/schemas/FilterClause"},{"$ref":"#/components/schemas/Filter"}]},"type":"array","title":"Clauses"}},"type":"object","required":["conjunction","clauses"],"title":"Filter"},"FilterClause":{"properties":{"property":{"type":"string","title":"Property"},"operator":{"$ref":"#/components/schemas/FilterOperator"},"value":{"anyOf":[{"type":"string","maxLength":1000},{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0},{"type":"boolean"}],"title":"Value"}},"type":"object","required":["property","operator","value"],"title":"FilterClause"},"FilterConjunction":{"type":"string","enum":["and","or"],"title":"FilterConjunction"},"FilterOperator":{"type":"string","enum":["eq","ne","gt","gte","lt","lte","like","not_like"],"title":"FilterOperator"},"GenericPayment":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"processor":{"$ref":"#/components/schemas/PaymentProcessor","description":"The payment processor.","examples":["stripe"]},"status":{"$ref":"#/components/schemas/PaymentStatus","description":"The payment status.","examples":["succeeded"]},"amount":{"type":"integer","title":"Amount","description":"The payment amount in cents.","examples":[1000]},"currency":{"type":"string","title":"Currency","description":"The payment currency. Currently, only `usd` is supported.","examples":["usd"]},"method":{"type":"string","title":"Method","description":"The payment method used.","examples":["card"]},"trigger":{"anyOf":[{"$ref":"#/components/schemas/PaymentTrigger"},{"type":"null"}],"description":"What initiated this payment attempt, e.g. initial purchase, subscription renewal, or an automated dunning retry.","examples":["subscription_cycle"]},"decline_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decline Reason","description":"Error code, if the payment was declined.","examples":["insufficient_funds"]},"decline_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Decline Message","description":"Human-readable error message, if the payment was declined.","examples":["Your card has insufficient funds."]},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization that owns the payment.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id","description":"The ID of the checkout session associated with this payment.","examples":["e4b478fa-cd25-4253-9f1f-8a41e6370ede"]},"order_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Order Id","description":"The ID of the order associated with this payment.","examples":["e4b478fa-cd25-4253-9f1f-8a41e6370ede"]},"processor_metadata":{"additionalProperties":true,"type":"object","title":"Processor Metadata","description":"Additional metadata from the payment processor for internal use."}},"type":"object","required":["created_at","modified_at","id","processor","status","amount","currency","method","trigger","decline_reason","decline_message","organization_id","checkout_id","order_id"],"title":"GenericPayment","description":"Schema of a payment with a generic payment method."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IntrospectTokenResponse":{"properties":{"active":{"type":"boolean","title":"Active"},"client_id":{"type":"string","title":"Client Id"},"token_type":{"type":"string","enum":["access_token","refresh_token"],"title":"Token Type"},"scope":{"type":"string","title":"Scope"},"sub_type":{"$ref":"#/components/schemas/SubType"},"sub":{"type":"string","title":"Sub"},"organizations":{"items":{"type":"string"},"type":"array","title":"Organizations"},"aud":{"type":"string","title":"Aud"},"iss":{"type":"string","title":"Iss"},"exp":{"type":"integer","title":"Exp"},"iat":{"type":"integer","title":"Iat"}},"type":"object","required":["active","client_id","token_type","scope","sub_type","sub","organizations","aud","iss","exp","iat"],"title":"IntrospectTokenResponse"},"LLMMetadata":{"properties":{"vendor":{"type":"string","title":"Vendor","description":"The vendor of the event."},"model":{"type":"string","title":"Model","description":"The model used for the event."},"prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prompt","description":"The LLM prompt used for the event."},"response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response","description":"The LLM response used for the event."},"input_tokens":{"type":"integer","title":"Input Tokens","description":"The number of LLM input tokens used for the event."},"cached_input_tokens":{"type":"integer","title":"Cached Input Tokens","description":"The number of LLM cached tokens that were used for the event."},"output_tokens":{"type":"integer","title":"Output Tokens","description":"The number of LLM output tokens used for the event."},"total_tokens":{"type":"integer","title":"Total Tokens","description":"The total number of LLM tokens used for the event."}},"type":"object","required":["vendor","model","input_tokens","output_tokens","total_tokens"],"title":"LLMMetadata"},"LegacyOrganizationStatus":{"type":"string","enum":["created","under_review","denied","active"],"title":"LegacyOrganizationStatus","description":"Legacy organization status values kept for backward compatibility in schemas\nusing OrganizationPublicBase."},"LegacyRecurringProductPrice":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPriceFixed"},{"$ref":"#/components/schemas/LegacyRecurringProductPriceCustom"}],"discriminator":{"propertyName":"amount_type","mapping":{"custom":"#/components/schemas/LegacyRecurringProductPriceCustom","fixed":"#/components/schemas/LegacyRecurringProductPriceFixed"}}},"LegacyRecurringProductPriceCustom":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the price."},"source":{"$ref":"#/components/schemas/ProductPriceSource","description":"The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session."},"amount_type":{"type":"string","const":"custom","title":"Amount Type"},"price_currency":{"type":"string","title":"Price Currency","description":"The currency in which the customer will be charged."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If null, it defaults to the organization's default tax behavior."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the price is archived and no longer available."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the product owning the price."},"type":{"type":"string","const":"recurring","title":"Type","description":"The type of the price."},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The recurring interval of the price."},"minimum_amount":{"type":"integer","title":"Minimum Amount","description":"The minimum amount the customer can pay. If 0, the price is 'free or pay what you want'."},"maximum_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Maximum Amount","description":"The maximum amount the customer can pay."},"preset_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Preset Amount","description":"The initial amount shown to the customer."},"legacy":{"type":"boolean","const":true,"title":"Legacy","readOnly":true}},"type":"object","required":["created_at","modified_at","id","source","amount_type","price_currency","tax_behavior","is_archived","product_id","type","recurring_interval","minimum_amount","maximum_amount","preset_amount","legacy"],"title":"LegacyRecurringProductPriceCustom","description":"A pay-what-you-want recurring price for a product, i.e. a subscription.\n\n**Deprecated**: The recurring interval should be set on the product itself."},"LegacyRecurringProductPriceFixed":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the price."},"source":{"$ref":"#/components/schemas/ProductPriceSource","description":"The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session."},"amount_type":{"type":"string","const":"fixed","title":"Amount Type"},"price_currency":{"type":"string","title":"Price Currency","description":"The currency in which the customer will be charged."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If null, it defaults to the organization's default tax behavior."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the price is archived and no longer available."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the product owning the price."},"type":{"type":"string","const":"recurring","title":"Type","description":"The type of the price."},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The recurring interval of the price."},"price_amount":{"type":"integer","title":"Price Amount","description":"The price in cents."},"legacy":{"type":"boolean","const":true,"title":"Legacy","readOnly":true}},"type":"object","required":["created_at","modified_at","id","source","amount_type","price_currency","tax_behavior","is_archived","product_id","type","recurring_interval","price_amount","legacy"],"title":"LegacyRecurringProductPriceFixed","description":"A recurring price for a product, i.e. a subscription.\n\n**Deprecated**: The recurring interval should be set on the product itself."},"LicenseKeyActivate":{"properties":{"key":{"type":"string","title":"Key"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"label":{"type":"string","title":"Label"},"conditions":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Conditions","description":"Key-value object allowing you to set conditions that must match when validating the license key.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"meta":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Meta","description":"Key-value object allowing you to store additional information about the activation\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."}},"type":"object","required":["key","organization_id","label"],"title":"LicenseKeyActivate"},"LicenseKeyActivationBase":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"license_key_id":{"type":"string","format":"uuid4","title":"License Key Id"},"label":{"type":"string","title":"Label"},"meta":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"type":"object","title":"Meta"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At"}},"type":"object","required":["id","license_key_id","label","meta","created_at","modified_at"],"title":"LicenseKeyActivationBase"},"LicenseKeyActivationRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"license_key_id":{"type":"string","format":"uuid4","title":"License Key Id"},"label":{"type":"string","title":"Label"},"meta":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"type":"object","title":"Meta"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At"},"license_key":{"$ref":"#/components/schemas/LicenseKeyRead"}},"type":"object","required":["id","license_key_id","label","meta","created_at","modified_at","license_key"],"title":"LicenseKeyActivationRead"},"LicenseKeyCustomer":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"$ref":"#/components/schemas/CustomerType","description":"The type of customer: 'individual' for single users, 'team' for customers with multiple members.","examples":["individual"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]}},"type":"object","required":["id","created_at","modified_at","metadata","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url"],"title":"LicenseKeyCustomer"},"LicenseKeyDeactivate":{"properties":{"key":{"type":"string","title":"Key"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"activation_id":{"type":"string","format":"uuid4","title":"Activation Id"}},"type":"object","required":["key","organization_id","activation_id"],"title":"LicenseKeyDeactivate"},"LicenseKeyRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"customer":{"$ref":"#/components/schemas/LicenseKeyCustomer"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The benefit ID."},"key":{"type":"string","title":"Key"},"display_key":{"type":"string","title":"Display Key"},"status":{"$ref":"#/components/schemas/LicenseKeyStatus"},"limit_activations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Activations"},"usage":{"type":"integer","title":"Usage"},"limit_usage":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Usage"},"validations":{"type":"integer","title":"Validations"},"last_validated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Validated At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["id","created_at","modified_at","organization_id","customer_id","customer","benefit_id","key","display_key","status","limit_activations","usage","limit_usage","validations","last_validated_at","expires_at"],"title":"LicenseKeyRead"},"LicenseKeyStatus":{"type":"string","enum":["granted","revoked","disabled"],"title":"LicenseKeyStatus"},"LicenseKeyUpdate":{"properties":{"status":{"anyOf":[{"$ref":"#/components/schemas/LicenseKeyStatus"},{"type":"null"}]},"usage":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Usage","default":0},"limit_activations":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":-2147483648.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Limit Activations"},"limit_usage":{"anyOf":[{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Limit Usage"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","title":"LicenseKeyUpdate"},"LicenseKeyUser":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"public_name":{"type":"string","title":"Public Name"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"}},"type":"object","required":["id","public_name"],"title":"LicenseKeyUser"},"LicenseKeyValidate":{"properties":{"key":{"type":"string","title":"Key"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"activation_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Activation Id"},"benefit_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The benefit ID."},{"type":"null"}],"title":"Benefit Id"},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id"},"increment_usage":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Increment Usage"},"conditions":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Conditions","description":"Key-value object allowing you to set conditions that must match when validating the license key.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."}},"type":"object","required":["key","organization_id"],"title":"LicenseKeyValidate"},"LicenseKeyWithActivations":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"customer":{"$ref":"#/components/schemas/LicenseKeyCustomer"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The benefit ID."},"key":{"type":"string","title":"Key"},"display_key":{"type":"string","title":"Display Key"},"status":{"$ref":"#/components/schemas/LicenseKeyStatus"},"limit_activations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Activations"},"usage":{"type":"integer","title":"Usage"},"limit_usage":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Usage"},"validations":{"type":"integer","title":"Validations"},"last_validated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Validated At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"activations":{"items":{"$ref":"#/components/schemas/LicenseKeyActivationBase"},"type":"array","title":"Activations"}},"type":"object","required":["id","created_at","modified_at","organization_id","customer_id","customer","benefit_id","key","display_key","status","limit_activations","usage","limit_usage","validations","last_validated_at","expires_at","activations"],"title":"LicenseKeyWithActivations"},"ListResourceWithCursorPagination_Event_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Event"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/CursorPagination"}},"type":"object","required":["items","pagination"],"title":"ListResourceWithCursorPagination[Event]"},"ListResource_BenefitGrant_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/BenefitGrant"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[BenefitGrant]"},"ListResource_Benefit_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Benefit","title":"Benefit"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Benefit]"},"ListResource_CheckoutLink_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CheckoutLink"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CheckoutLink]"},"ListResource_Checkout_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Checkout"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Checkout]"},"ListResource_CustomField_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomField","title":"CustomField"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomField]"},"ListResource_CustomerBenefitGrant_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerBenefitGrant","title":"CustomerBenefitGrant"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerBenefitGrant]"},"ListResource_CustomerCustomerMeter_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerCustomerMeter"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerCustomerMeter]"},"ListResource_CustomerMeter_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerMeter"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerMeter]"},"ListResource_CustomerOrder_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerOrder"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerOrder]"},"ListResource_CustomerPaymentMethod_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerPaymentMethod","title":"CustomerPaymentMethod"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerPaymentMethod]"},"ListResource_CustomerPortalMember_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerPortalMember"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerPortalMember]"},"ListResource_CustomerSubscription_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerSubscription"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerSubscription]"},"ListResource_CustomerWallet_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerWallet"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[CustomerWallet]"},"ListResource_Customer_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Customer"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Customer]"},"ListResource_Discount_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Discount","title":"Discount"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Discount]"},"ListResource_Dispute_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Dispute"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Dispute]"},"ListResource_DownloadableRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DownloadableRead"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[DownloadableRead]"},"ListResource_EventName_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/EventName"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[EventName]"},"ListResource_EventTypeWithStats_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/EventTypeWithStats"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[EventTypeWithStats]"},"ListResource_Event_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Event"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Event]"},"ListResource_FileRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FileRead"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[FileRead]"},"ListResource_LicenseKeyRead_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/LicenseKeyRead"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[LicenseKeyRead]"},"ListResource_Member_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Member"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Member]"},"ListResource_Meter_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Meter"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Meter]"},"ListResource_Order_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Order"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Order]"},"ListResource_Organization_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Organization"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Organization]"},"ListResource_PaymentMethod_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PaymentMethod","title":"PaymentMethod"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[PaymentMethod]"},"ListResource_Payment_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Payment"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Payment]"},"ListResource_Product_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Product"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Product]"},"ListResource_Refund_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Refund"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Refund]"},"ListResource_Subscription_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/Subscription"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[Subscription]"},"ListResource_WebhookDelivery_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WebhookDelivery"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[WebhookDelivery]"},"ListResource_WebhookEndpoint_":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WebhookEndpoint"},"type":"array","title":"Items"},"pagination":{"$ref":"#/components/schemas/Pagination"}},"type":"object","required":["items","pagination"],"title":"ListResource[WebhookEndpoint]"},"ManualRetryLimitExceeded":{"properties":{"error":{"type":"string","const":"ManualRetryLimitExceeded","title":"Error","examples":["ManualRetryLimitExceeded"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"ManualRetryLimitExceeded"},"Member":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the member."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer this member belongs to."},"email":{"type":"string","title":"Email","description":"The email address of the member.","examples":["member@example.com"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the member.","examples":["Jane Doe"]},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the member in your system. This must be unique within the customer. ","examples":["usr_1337"]},"role":{"$ref":"#/components/schemas/MemberRole","description":"The role of the member within the customer.","examples":["owner"]}},"type":"object","required":["id","created_at","modified_at","customer_id","email","name","external_id","role"],"title":"Member","description":"A member of a customer."},"MemberCreateFromCustomer":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"The email address of the member.","examples":["member@example.com"]},"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the member.","examples":["Jane Doe"]},{"type":"null"}],"title":"Name"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the member in your system. This must be unique within the customer. ","examples":["usr_1337"]},"role":{"type":"string","enum":["member","billing_manager"],"title":"Role","description":"The role of the member within the customer. To assign or transfer ownership, use the member update endpoint.","default":"member","examples":["member"]}},"type":"object","required":["email"],"title":"MemberCreateFromCustomer","description":"Schema for creating a new member nested under a customer.\n\nThe customer is taken from the URL path, so it's not part of the body."},"MemberOwnerCreate":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"The email address of the member.","examples":["member@example.com"]},"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the member.","examples":["Jane Doe"]},{"type":"null"}],"title":"Name"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the member in your system. This must be unique within the customer. ","examples":["usr_1337"]}},"type":"object","required":["email"],"title":"MemberOwnerCreate","description":"Schema for creating an owner member during customer creation."},"MemberRole":{"type":"string","enum":["owner","billing_manager","member"],"title":"MemberRole"},"MemberSortProperty":{"type":"string","enum":["created_at","-created_at"],"title":"MemberSortProperty"},"MemberUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":256,"description":"The name of the member.","examples":["Jane Doe"]},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email"},"role":{"anyOf":[{"$ref":"#/components/schemas/MemberRole"},{"type":"null"}],"description":"The role of the member within the customer.","examples":["member"]}},"type":"object","title":"MemberUpdate","description":"Schema for updating a member."},"MetadataOutputType":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"type":"object"},"Meter":{"properties":{"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"The name of the meter. Will be shown on customer's invoices and usage."},"unit":{"$ref":"#/components/schemas/MeterUnit","description":"The unit of the meter."},"custom_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Label","description":"The label for the custom unit."},"custom_multiplier":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Custom Multiplier","description":"The multiplier to convert from base unit to display scale."},"filter":{"$ref":"#/components/schemas/Filter","description":"The filter to apply on events that'll be used to calculate the meter."},"aggregation":{"oneOf":[{"$ref":"#/components/schemas/CountAggregation"},{"$ref":"#/components/schemas/PropertyAggregation"},{"$ref":"#/components/schemas/UniqueAggregation"}],"title":"Aggregation","description":"The aggregation to apply on the filtered events to calculate the meter.","discriminator":{"propertyName":"func","mapping":{"avg":"#/components/schemas/PropertyAggregation","count":"#/components/schemas/CountAggregation","max":"#/components/schemas/PropertyAggregation","min":"#/components/schemas/PropertyAggregation","sum":"#/components/schemas/PropertyAggregation","unique":"#/components/schemas/UniqueAggregation"}}},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the meter."},"archived_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Archived At","description":"Whether the meter is archived and the time it was archived."}},"type":"object","required":["metadata","created_at","modified_at","id","name","unit","filter","aggregation","organization_id"],"title":"Meter"},"MeterCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"type":"string","minLength":3,"title":"Name","description":"The name of the meter. Will be shown on customer's invoices and usage."},"unit":{"$ref":"#/components/schemas/MeterUnit","description":"The unit of the meter.","default":"scalar"},"custom_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Label","description":"The label for the custom unit, e.g. 'request'. Required when unit is 'custom'."},"custom_multiplier":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Custom Multiplier","description":"The multiplier to convert from the base unit to display scale, e.g. 1000 to display per 1000 units. Defaults to 1 when not provided."},"filter":{"$ref":"#/components/schemas/Filter","description":"The filter to apply on events that'll be used to calculate the meter."},"aggregation":{"oneOf":[{"$ref":"#/components/schemas/CountAggregation"},{"$ref":"#/components/schemas/PropertyAggregation"},{"$ref":"#/components/schemas/UniqueAggregation"}],"title":"Aggregation","description":"The aggregation to apply on the filtered events to calculate the meter.","discriminator":{"propertyName":"func","mapping":{"avg":"#/components/schemas/PropertyAggregation","count":"#/components/schemas/CountAggregation","max":"#/components/schemas/PropertyAggregation","min":"#/components/schemas/PropertyAggregation","sum":"#/components/schemas/PropertyAggregation","unique":"#/components/schemas/UniqueAggregation"}}},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the meter. **Required unless you use an organization token.**"}},"type":"object","required":["name","filter","aggregation"],"title":"MeterCreate"},"MeterCreditEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"meter.credited","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/MeterCreditedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"MeterCreditEvent","description":"An event created by Polar when credits are added to a customer meter."},"MeterCreditedMetadata":{"properties":{"meter_id":{"type":"string","title":"Meter Id"},"units":{"type":"integer","title":"Units"},"rollover":{"type":"boolean","title":"Rollover"}},"type":"object","required":["meter_id","units","rollover"],"title":"MeterCreditedMetadata"},"MeterQuantities":{"properties":{"quantities":{"items":{"$ref":"#/components/schemas/MeterQuantity"},"type":"array","title":"Quantities"},"total":{"type":"number","title":"Total","description":"The total quantity for the period.","examples":[100.0]}},"type":"object","required":["quantities","total"],"title":"MeterQuantities"},"MeterQuantity":{"properties":{"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp for the current period."},"quantity":{"type":"number","title":"Quantity","description":"The quantity for the current period.","examples":[10.0]}},"type":"object","required":["timestamp","quantity"],"title":"MeterQuantity"},"MeterResetEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"meter.reset","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/MeterResetMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"MeterResetEvent","description":"An event created by Polar when a customer meter is reset."},"MeterResetMetadata":{"properties":{"meter_id":{"type":"string","title":"Meter Id"}},"type":"object","required":["meter_id"],"title":"MeterResetMetadata"},"MeterSortProperty":{"type":"string","enum":["created_at","-created_at","name","-name"],"title":"MeterSortProperty"},"MeterUnit":{"type":"string","enum":["scalar","token","custom"],"title":"MeterUnit"},"MeterUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"anyOf":[{"type":"string","minLength":3},{"type":"null"}],"title":"Name","description":"The name of the meter. Will be shown on customer's invoices and usage."},"unit":{"anyOf":[{"$ref":"#/components/schemas/MeterUnit"},{"type":"null"}],"description":"The unit of the meter."},"custom_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Label","description":"The label for the custom unit. Required when unit is 'custom'."},"custom_multiplier":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Custom Multiplier","description":"The multiplier to convert from base unit to display scale. Required when unit is 'custom'."},"filter":{"anyOf":[{"$ref":"#/components/schemas/Filter","description":"The filter to apply on events that'll be used to calculate the meter."},{"type":"null"}],"description":"The filter to apply on events that'll be used to calculate the meter."},"aggregation":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/CountAggregation"},{"$ref":"#/components/schemas/PropertyAggregation"},{"$ref":"#/components/schemas/UniqueAggregation"}],"discriminator":{"propertyName":"func","mapping":{"avg":"#/components/schemas/PropertyAggregation","count":"#/components/schemas/CountAggregation","max":"#/components/schemas/PropertyAggregation","min":"#/components/schemas/PropertyAggregation","sum":"#/components/schemas/PropertyAggregation","unique":"#/components/schemas/UniqueAggregation"}}},{"type":"null"}],"title":"Aggregation","description":"The aggregation to apply on the filtered events to calculate the meter."},"is_archived":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Archived","description":"Whether the meter is archived. Archived meters are no longer used for billing."}},"type":"object","title":"MeterUpdate"},"Metric":{"properties":{"slug":{"type":"string","title":"Slug","description":"Unique identifier for the metric."},"display_name":{"type":"string","title":"Display Name","description":"Human-readable name for the metric."},"type":{"$ref":"#/components/schemas/MetricType","description":"Type of the metric, useful to know the unit or format of the value."}},"type":"object","required":["slug","display_name","type"],"title":"Metric","description":"Information about a metric."},"MetricDashboardCreate":{"properties":{"name":{"type":"string","minLength":1,"title":"Name","description":"Display name for the dashboard."},"metrics":{"items":{"type":"string"},"type":"array","maxItems":10,"title":"Metrics","description":"List of metric slugs to display in this dashboard."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning this dashboard. **Required unless you use an organization token.**"}},"type":"object","required":["name"],"title":"MetricDashboardCreate","description":"Schema for creating a metrics dashboard."},"MetricDashboardSchema":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"Display name for the dashboard."},"metrics":{"items":{"type":"string"},"type":"array","title":"Metrics","description":"List of metric slugs displayed in this dashboard."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning this dashboard."}},"type":"object","required":["created_at","modified_at","id","name","metrics","organization_id"],"title":"MetricDashboardSchema","description":"A user-defined metrics dashboard."},"MetricDashboardUpdate":{"properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Name","description":"Display name for the dashboard."},"metrics":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":10},{"type":"null"}],"title":"Metrics","description":"List of metric slugs to display in this dashboard."}},"type":"object","title":"MetricDashboardUpdate","description":"Schema for updating a metrics dashboard."},"MetricPeriod":{"properties":{"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"Timestamp of this period data."},"active_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Active Subscriptions"},"committed_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Committed Subscriptions"},"monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Monthly Recurring Revenue"},"trial_monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Trial Monthly Recurring Revenue"},"committed_monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Committed Monthly Recurring Revenue"},"trial_committed_monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Trial Committed Monthly Recurring Revenue"},"average_revenue_per_user":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Average Revenue Per User"},"checkouts":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Checkouts"},"succeeded_checkouts":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Succeeded Checkouts"},"churned_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Churned Subscriptions"},"churn_rate":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Churn Rate"},"seats_total":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seats Total"},"seats_claimed":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seats Claimed"},"seats_pending":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seats Pending"},"seat_customers":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seat Customers"},"new_seat_customers":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Seat Customers"},"churned_seat_customers":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Churned Seat Customers"},"orders":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Orders"},"revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Revenue"},"net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Net Revenue"},"cumulative_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cumulative Revenue"},"net_cumulative_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Net Cumulative Revenue"},"costs":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Costs"},"cumulative_costs":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cumulative Costs"},"average_order_value":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Average Order Value"},"net_average_order_value":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Net Average Order Value"},"cost_per_user":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cost Per User"},"active_user_by_event":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Active User By Event"},"one_time_products":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"One Time Products"},"one_time_products_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"One Time Products Revenue"},"one_time_products_net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"One Time Products Net Revenue"},"new_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Subscriptions"},"new_subscriptions_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Subscriptions Revenue"},"new_subscriptions_net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Subscriptions Net Revenue"},"renewed_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Renewed Subscriptions"},"renewed_subscriptions_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Renewed Subscriptions Revenue"},"renewed_subscriptions_net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Renewed Subscriptions Net Revenue"},"canceled_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions"},"canceled_subscriptions_customer_service":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Customer Service"},"canceled_subscriptions_low_quality":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Low Quality"},"canceled_subscriptions_missing_features":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Missing Features"},"canceled_subscriptions_switched_service":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Switched Service"},"canceled_subscriptions_too_complex":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Too Complex"},"canceled_subscriptions_too_expensive":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Too Expensive"},"canceled_subscriptions_unused":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Unused"},"canceled_subscriptions_other":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Other"},"annual_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Annual Recurring Revenue"},"committed_annual_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Committed Annual Recurring Revenue"},"checkouts_conversion":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Checkouts Conversion"},"ltv":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Ltv"},"gross_margin":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Gross Margin"},"gross_margin_percentage":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Gross Margin Percentage"},"cashflow":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cashflow"},"average_seats_per_customer":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Average Seats Per Customer"},"seat_utilization_rate":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seat Utilization Rate"}},"type":"object","required":["timestamp"],"title":"MetricPeriod"},"MetricType":{"type":"string","enum":["scalar","currency","currency_sub_cent","percentage"],"title":"MetricType"},"Metrics":{"properties":{"active_subscriptions":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"committed_subscriptions":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"monthly_recurring_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"trial_monthly_recurring_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"committed_monthly_recurring_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"trial_committed_monthly_recurring_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"average_revenue_per_user":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"checkouts":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"succeeded_checkouts":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"churned_subscriptions":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"churn_rate":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"seats_total":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"seats_claimed":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"seats_pending":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"seat_customers":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"new_seat_customers":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"churned_seat_customers":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"orders":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"net_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"cumulative_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"net_cumulative_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"costs":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"cumulative_costs":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"average_order_value":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"net_average_order_value":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"cost_per_user":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"active_user_by_event":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"one_time_products":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"one_time_products_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"one_time_products_net_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"new_subscriptions":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"new_subscriptions_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"new_subscriptions_net_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"renewed_subscriptions":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"renewed_subscriptions_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"renewed_subscriptions_net_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_customer_service":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_low_quality":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_missing_features":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_switched_service":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_too_complex":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_too_expensive":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_unused":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"canceled_subscriptions_other":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"annual_recurring_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"committed_annual_recurring_revenue":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"checkouts_conversion":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"ltv":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"gross_margin":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"gross_margin_percentage":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"cashflow":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"average_seats_per_customer":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]},"seat_utilization_rate":{"anyOf":[{"$ref":"#/components/schemas/Metric"},{"type":"null"}]}},"type":"object","title":"Metrics"},"MetricsIntervalLimit":{"properties":{"min_days":{"type":"integer","title":"Min Days","description":"Minimum number of days for this interval."},"max_days":{"type":"integer","title":"Max Days","description":"Maximum number of days for this interval."}},"type":"object","required":["min_days","max_days"],"title":"MetricsIntervalLimit","description":"Date interval limit to get metrics for a given interval."},"MetricsIntervalsLimits":{"properties":{"hour":{"$ref":"#/components/schemas/MetricsIntervalLimit","description":"Limits for the hour interval."},"day":{"$ref":"#/components/schemas/MetricsIntervalLimit","description":"Limits for the day interval."},"week":{"$ref":"#/components/schemas/MetricsIntervalLimit","description":"Limits for the week interval."},"month":{"$ref":"#/components/schemas/MetricsIntervalLimit","description":"Limits for the month interval."},"year":{"$ref":"#/components/schemas/MetricsIntervalLimit","description":"Limits for the year interval."}},"type":"object","required":["hour","day","week","month","year"],"title":"MetricsIntervalsLimits","description":"Date interval limits to get metrics for each interval."},"MetricsLimits":{"properties":{"min_date":{"type":"string","format":"date","title":"Min Date","description":"Minimum date to get metrics."},"intervals":{"$ref":"#/components/schemas/MetricsIntervalsLimits","description":"Limits for each interval."}},"type":"object","required":["min_date","intervals"],"title":"MetricsLimits","description":"Date limits to get metrics."},"MetricsResponse":{"properties":{"periods":{"items":{"$ref":"#/components/schemas/MetricPeriod"},"type":"array","title":"Periods","description":"List of data for each timestamp."},"totals":{"$ref":"#/components/schemas/MetricsTotals","description":"Totals for the whole selected period."},"metrics":{"$ref":"#/components/schemas/Metrics","description":"Information about the returned metrics."}},"type":"object","required":["periods","totals","metrics"],"title":"MetricsResponse","description":"Metrics response schema."},"MetricsTotals":{"properties":{"active_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Active Subscriptions"},"committed_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Committed Subscriptions"},"monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Monthly Recurring Revenue"},"trial_monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Trial Monthly Recurring Revenue"},"committed_monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Committed Monthly Recurring Revenue"},"trial_committed_monthly_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Trial Committed Monthly Recurring Revenue"},"average_revenue_per_user":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Average Revenue Per User"},"checkouts":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Checkouts"},"succeeded_checkouts":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Succeeded Checkouts"},"churned_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Churned Subscriptions"},"churn_rate":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Churn Rate"},"seats_total":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seats Total"},"seats_claimed":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seats Claimed"},"seats_pending":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seats Pending"},"seat_customers":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seat Customers"},"new_seat_customers":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Seat Customers"},"churned_seat_customers":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Churned Seat Customers"},"orders":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Orders"},"revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Revenue"},"net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Net Revenue"},"cumulative_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cumulative Revenue"},"net_cumulative_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Net Cumulative Revenue"},"costs":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Costs"},"cumulative_costs":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cumulative Costs"},"average_order_value":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Average Order Value"},"net_average_order_value":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Net Average Order Value"},"cost_per_user":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cost Per User"},"active_user_by_event":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Active User By Event"},"one_time_products":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"One Time Products"},"one_time_products_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"One Time Products Revenue"},"one_time_products_net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"One Time Products Net Revenue"},"new_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Subscriptions"},"new_subscriptions_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Subscriptions Revenue"},"new_subscriptions_net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"New Subscriptions Net Revenue"},"renewed_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Renewed Subscriptions"},"renewed_subscriptions_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Renewed Subscriptions Revenue"},"renewed_subscriptions_net_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Renewed Subscriptions Net Revenue"},"canceled_subscriptions":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions"},"canceled_subscriptions_customer_service":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Customer Service"},"canceled_subscriptions_low_quality":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Low Quality"},"canceled_subscriptions_missing_features":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Missing Features"},"canceled_subscriptions_switched_service":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Switched Service"},"canceled_subscriptions_too_complex":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Too Complex"},"canceled_subscriptions_too_expensive":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Too Expensive"},"canceled_subscriptions_unused":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Unused"},"canceled_subscriptions_other":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Canceled Subscriptions Other"},"annual_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Annual Recurring Revenue"},"committed_annual_recurring_revenue":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Committed Annual Recurring Revenue"},"checkouts_conversion":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Checkouts Conversion"},"ltv":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Ltv"},"gross_margin":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Gross Margin"},"gross_margin_percentage":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Gross Margin Percentage"},"cashflow":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Cashflow"},"average_seats_per_customer":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Average Seats Per Customer"},"seat_utilization_rate":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Seat Utilization Rate"}},"type":"object","title":"MetricsTotals"},"MissingInvoiceBillingDetails":{"properties":{"error":{"type":"string","const":"MissingInvoiceBillingDetails","title":"Error","examples":["MissingInvoiceBillingDetails"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"MissingInvoiceBillingDetails"},"NotOpenCheckout":{"properties":{"error":{"type":"string","const":"NotOpenCheckout","title":"Error","examples":["NotOpenCheckout"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"NotOpenCheckout"},"NotPermitted":{"properties":{"error":{"type":"string","const":"NotPermitted","title":"Error","examples":["NotPermitted"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"NotPermitted"},"OAuth2ClientConfiguration":{"properties":{"redirect_uris":{"items":{"type":"string","minLength":1,"format":"uri"},"type":"array","title":"Redirect Uris"},"token_endpoint_auth_method":{"type":"string","enum":["client_secret_basic","client_secret_post","none"],"title":"Token Endpoint Auth Method","default":"client_secret_post"},"grant_types":{"items":{"type":"string","enum":["authorization_code","refresh_token"]},"type":"array","title":"Grant Types","default":["authorization_code","refresh_token"]},"response_types":{"items":{"type":"string","const":"code"},"type":"array","title":"Response Types","default":["code"]},"scope":{"type":"string","title":"Scope","default":"openid profile email user:read user:write organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write members:read members:write wallets:read wallets:write disputes:read disputes:write customer_meters:read customer_sessions:write member_sessions:write customer_seats:read customer_seats:write orders:read orders:write refunds:read refunds:write payments:read metrics:read metrics:write webhooks:read webhooks:write license_keys:read license_keys:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write"},"client_name":{"type":"string","title":"Client Name"},"client_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Uri"},"logo_uri":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Logo Uri"},"tos_uri":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Tos Uri"},"policy_uri":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Policy Uri"},"default_sub_type":{"$ref":"#/components/schemas/SubType","default":"user"}},"type":"object","required":["redirect_uris","client_name"],"title":"OAuth2ClientConfiguration"},"OAuth2ClientConfigurationUpdate":{"properties":{"redirect_uris":{"items":{"type":"string","minLength":1,"format":"uri"},"type":"array","title":"Redirect Uris"},"token_endpoint_auth_method":{"type":"string","enum":["client_secret_basic","client_secret_post","none"],"title":"Token Endpoint Auth Method","default":"client_secret_post"},"grant_types":{"items":{"type":"string","enum":["authorization_code","refresh_token"]},"type":"array","title":"Grant Types","default":["authorization_code","refresh_token"]},"response_types":{"items":{"type":"string","const":"code"},"type":"array","title":"Response Types","default":["code"]},"scope":{"type":"string","title":"Scope","default":"openid profile email user:read user:write organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write transactions:read transactions:write payouts:read payouts:write products:read products:write benefits:read benefits:write events:read events:write meters:read meters:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write members:read members:write wallets:read wallets:write disputes:read disputes:write customer_meters:read customer_sessions:write member_sessions:write customer_seats:read customer_seats:write orders:read orders:write refunds:read refunds:write payments:read metrics:read metrics:write webhooks:read webhooks:write license_keys:read license_keys:write customer_portal:read customer_portal:write notifications:read notifications:write notification_recipients:read notification_recipients:write"},"client_name":{"type":"string","title":"Client Name"},"client_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Uri"},"logo_uri":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Logo Uri"},"tos_uri":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Tos Uri"},"policy_uri":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Policy Uri"},"default_sub_type":{"$ref":"#/components/schemas/SubType","default":"user"},"client_id":{"type":"string","title":"Client Id"}},"type":"object","required":["redirect_uris","client_name","client_id"],"title":"OAuth2ClientConfigurationUpdate"},"OAuth2ClientPublic":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"client_id":{"type":"string","title":"Client Id"},"client_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Name"},"client_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Uri"},"logo_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Uri"},"tos_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tos Uri"},"policy_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Policy Uri"}},"type":"object","required":["created_at","modified_at","client_id","client_name","client_uri","logo_uri","tos_uri","policy_uri"],"title":"OAuth2ClientPublic"},"OffSessionChargesNotEnabled":{"properties":{"error":{"type":"string","const":"OffSessionChargesNotEnabled","title":"Error","examples":["OffSessionChargesNotEnabled"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"OffSessionChargesNotEnabled"},"Order":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"status":{"$ref":"#/components/schemas/OrderStatus","examples":["paid"]},"paid":{"type":"boolean","title":"Paid","description":"Whether the order has been paid for.","examples":[true]},"subtotal_amount":{"type":"integer","title":"Subtotal Amount","description":"Amount in cents, before discounts and taxes.","examples":[10000]},"discount_amount":{"type":"integer","title":"Discount Amount","description":"Discount amount in cents.","examples":[1000]},"net_amount":{"type":"integer","title":"Net Amount","description":"Amount in cents, after discounts but before taxes.","examples":[9000]},"tax_amount":{"type":"integer","title":"Tax Amount","description":"Sales tax amount in cents.","examples":[720]},"total_amount":{"type":"integer","title":"Total Amount","description":"Amount in cents, after discounts and taxes.","examples":[9720]},"applied_balance_amount":{"type":"integer","title":"Applied Balance Amount","description":"Customer's balance amount applied to this invoice. Can increase the total amount paid, if the customer has a negative balance, or decrease it, if the customer has a positive balance.Amount in cents.","examples":[0]},"due_amount":{"type":"integer","title":"Due Amount","description":"Amount in cents that is due for this order.","examples":[0]},"refunded_amount":{"type":"integer","title":"Refunded Amount","description":"Amount refunded in cents.","examples":[0]},"refunded_tax_amount":{"type":"integer","title":"Refunded Tax Amount","description":"Sales tax refunded in cents.","examples":[0]},"currency":{"type":"string","title":"Currency","examples":["usd"]},"billing_reason":{"$ref":"#/components/schemas/OrderBillingReason"},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name of the customer that should appear on the invoice. "},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"invoice_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Number","description":"The invoice number associated with this order. `null` while the order is in `draft` status; assigned at finalize."},"is_invoice_generated":{"type":"boolean","title":"Is Invoice Generated","description":"Whether an invoice has been generated for this order."},"receipt_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Receipt Number","description":"The receipt number for this order. Set once the order is paid for organizations with receipts enabled. When set, a downloadable receipt PDF can be obtained via the receipt endpoint."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Number of seats purchased (for seat-based one-time orders)."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id"},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id"},"next_payment_attempt_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Payment Attempt At","description":"When the next automatic payment retry is scheduled. `null` if the order is not in dunning or all retries have been exhausted."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"platform_fee_amount":{"type":"integer","title":"Platform Fee Amount","description":"Platform fee amount in cents.","examples":[500]},"platform_fee_currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Platform Fee Currency","description":"Currency of the platform fee.","examples":["usd"]},"customer":{"$ref":"#/components/schemas/OrderCustomer"},"product":{"anyOf":[{"$ref":"#/components/schemas/OrderProduct"},{"type":"null"}]},"discount":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/DiscountFixedOnceForeverDurationBase"},{"$ref":"#/components/schemas/DiscountFixedRepeatDurationBase"},{"$ref":"#/components/schemas/DiscountPercentageOnceForeverDurationBase"},{"$ref":"#/components/schemas/DiscountPercentageRepeatDurationBase"}],"title":"OrderDiscount"},{"type":"null"}],"title":"Discount"},"subscription":{"anyOf":[{"$ref":"#/components/schemas/OrderSubscription"},{"type":"null"}]},"items":{"items":{"$ref":"#/components/schemas/OrderItemSchema"},"type":"array","title":"Items","description":"Line items composing the order."},"description":{"type":"string","title":"Description","description":"A summary description of the order.","examples":["Pro Plan"]},"refundable_amount":{"type":"integer","title":"Refundable Amount","description":"Amount in cents that can still be refunded (net, before taxes). Accounts for any applied customer balance and previous refunds.","readOnly":true,"examples":[9000]},"refundable_tax_amount":{"type":"integer","title":"Refundable Tax Amount","description":"Sales tax in cents that would be refunded if the full refundable amount is refunded.","readOnly":true,"examples":[720]}},"type":"object","required":["id","created_at","modified_at","status","paid","subtotal_amount","discount_amount","net_amount","tax_amount","total_amount","applied_balance_amount","due_amount","refunded_amount","refunded_tax_amount","currency","billing_reason","billing_name","billing_address","invoice_number","is_invoice_generated","receipt_number","customer_id","product_id","discount_id","subscription_id","checkout_id","metadata","platform_fee_amount","platform_fee_currency","customer","product","discount","subscription","items","description","refundable_amount","refundable_tax_amount"],"title":"Order"},"OrderBillingReason":{"type":"string","enum":["purchase","subscription_create","subscription_cycle","subscription_update"],"title":"OrderBillingReason"},"OrderBillingReasonInternal":{"type":"string","enum":["purchase","subscription_create","subscription_cycle","subscription_cycle_after_trial","subscription_cancel","subscription_update"],"title":"OrderBillingReasonInternal","description":"Internal billing reasons with additional granularity."},"OrderCreate":{"properties":{"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization the order belongs to. **Required unless you use an organization token.** The customer and product must belong to this organization."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer the order is for. Must belong to the order's organization."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the one-time product to charge for. Must belong to the order's organization. Only fixed-price and free products are supported."},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency","description":"The currency to charge in (ISO 4217, lowercase, e.g. `usd`). Defaults to the organization's default currency; specify it to force a different one, or when the product isn't priced in the organization's default currency."},"amount":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Amount","description":"A custom amount to charge, in the smallest currency unit. Overrides the product's price; defaults to the product's configured price (0 for free products). A positive amount must be at least the currency's minimum."},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description","description":"A custom description for the order's line item, shown on the invoice and receipt (e.g. `5,000 tokens`). Defaults to the product name."}},"type":"object","required":["customer_id","product_id"],"title":"OrderCreate","description":"Schema to create a draft order for an off-session charge."},"OrderCustomer":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"$ref":"#/components/schemas/CustomerType","description":"The type of customer: 'individual' for single users, 'team' for customers with multiple members.","examples":["individual"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]}},"type":"object","required":["id","created_at","modified_at","metadata","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url"],"title":"OrderCustomer"},"OrderFinalize":{"properties":{"payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Payment Method Id","description":"ID of the payment method to charge. Must belong to the order's customer. Falls back to the customer's default payment method when unset."}},"type":"object","title":"OrderFinalize","description":"Schema to finalize a draft order and trigger an off-session charge."},"OrderInvoice":{"properties":{"url":{"type":"string","title":"Url","description":"The URL to the invoice."}},"type":"object","required":["url"],"title":"OrderInvoice","description":"Order's invoice data."},"OrderItemSchema":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"label":{"type":"string","title":"Label","description":"Description of the line item charge.","examples":["Pro Plan"]},"amount":{"type":"integer","title":"Amount","description":"Amount in cents, before discounts and taxes.","examples":[10000]},"tax_amount":{"type":"integer","title":"Tax Amount","description":"Sales tax amount in cents.","examples":[720]},"proration":{"type":"boolean","title":"Proration","description":"Whether this charge is due to a proration.","examples":[false]},"product_price_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Price Id","description":"Associated price ID, if any."}},"type":"object","required":["created_at","modified_at","id","label","amount","tax_amount","proration","product_price_id"],"title":"OrderItemSchema","description":"An order line item."},"OrderNotDraft":{"properties":{"error":{"type":"string","const":"OrderNotDraft","title":"Error","examples":["OrderNotDraft"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"OrderNotDraft"},"OrderNotEligibleForInvoice":{"properties":{"error":{"type":"string","const":"OrderNotEligibleForInvoice","title":"Error","examples":["OrderNotEligibleForInvoice"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"OrderNotEligibleForInvoice"},"OrderNotEligibleForRetry":{"properties":{"error":{"type":"string","const":"OrderNotEligibleForRetry","title":"Error","examples":["OrderNotEligibleForRetry"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"OrderNotEligibleForRetry"},"OrderPaidEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"order.paid","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/OrderPaidMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"OrderPaidEvent","description":"An event created by Polar when an order is paid."},"OrderPaidMetadata":{"properties":{"order_id":{"type":"string","title":"Order Id"},"product_id":{"type":"string","title":"Product Id"},"billing_type":{"type":"string","title":"Billing Type"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"net_amount":{"type":"integer","title":"Net Amount"},"tax_amount":{"type":"integer","title":"Tax Amount"},"applied_balance_amount":{"type":"integer","title":"Applied Balance Amount"},"discount_amount":{"type":"integer","title":"Discount Amount"},"discount_id":{"type":"string","title":"Discount Id"},"platform_fee":{"type":"integer","title":"Platform Fee"},"subscription_id":{"type":"string","title":"Subscription Id"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["order_id","amount"],"title":"OrderPaidMetadata"},"OrderProduct":{"properties":{"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."}},"type":"object","required":["metadata","id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id"],"title":"OrderProduct"},"OrderReceipt":{"properties":{"url":{"type":"string","title":"Url","description":"The URL to the receipt PDF."}},"type":"object","required":["url"],"title":"OrderReceipt","description":"Order's receipt data."},"OrderRefundedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"order.refunded","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/OrderRefundedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"OrderRefundedEvent","description":"An event created by Polar when an order is refunded."},"OrderRefundedMetadata":{"properties":{"order_id":{"type":"string","title":"Order Id"},"refunded_amount":{"type":"integer","title":"Refunded Amount"},"currency":{"type":"string","title":"Currency"}},"type":"object","required":["order_id","refunded_amount","currency"],"title":"OrderRefundedMetadata"},"OrderSortProperty":{"type":"string","enum":["created_at","-created_at","status","-status","invoice_number","-invoice_number","amount","-amount","net_amount","-net_amount","customer","-customer","product","-product","discount","-discount","subscription","-subscription"],"title":"OrderSortProperty"},"OrderStatus":{"type":"string","enum":["draft","pending","paid","refunded","partially_refunded","void"],"title":"OrderStatus"},"OrderSubscription":{"properties":{"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"amount":{"type":"integer","title":"Amount","description":"The amount of the subscription.","examples":[10000]},"currency":{"type":"string","title":"Currency","description":"The currency of the subscription.","examples":["usd"]},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The interval at which the subscription recurs.","examples":["month"]},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on."},"status":{"$ref":"#/components/schemas/SubscriptionStatus","description":"The status of the subscription.","examples":["active"]},"current_period_start":{"type":"string","format":"date-time","title":"Current Period Start","description":"The start timestamp of the current billing period."},"current_period_end":{"type":"string","format":"date-time","title":"Current Period End","description":"The end timestamp of the current billing period."},"current_meter_period_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period Start","description":"The start timestamp of the current meter period, if the product has a meter cycle set. Metered credits are granted and overage is settled on this cadence."},"current_meter_period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period End","description":"The end timestamp of the current meter period, if the product has a meter cycle set. This is when credits next renew."},"trial_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Start","description":"The start timestamp of the trial period, if any."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"The end timestamp of the trial period, if any."},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","description":"Whether the subscription will be canceled at the end of the current period."},"canceled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Canceled At","description":"The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`."},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"The timestamp when the subscription started."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"The timestamp when the subscription will end."},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At","description":"The timestamp when the subscription ended."},"past_due_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Past Due At","description":"The timestamp when the subscription entered `past_due` status."},"pause_at_period_end":{"type":"boolean","title":"Pause At Period End","description":"Whether the subscription will be paused at the end of the current period."},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At","description":"The timestamp when the subscription was paused."},"resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resumes At","description":"The timestamp when a paused subscription is scheduled to automatically resume, if set."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the subscribed customer."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the subscribed product."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"The ID of the applied discount, if any."},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id"},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"The number of seats for seat-based subscriptions. None for non-seat subscriptions."},"customer_cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}]},"customer_cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Cancellation Comment"}},"type":"object","required":["metadata","created_at","modified_at","id","amount","currency","recurring_interval","recurring_interval_count","status","current_period_start","current_period_end","current_meter_period_start","current_meter_period_end","trial_start","trial_end","cancel_at_period_end","canceled_at","started_at","ends_at","ended_at","pause_at_period_end","paused_at","resumes_at","customer_id","product_id","discount_id","checkout_id","customer_cancellation_reason","customer_cancellation_comment"],"title":"OrderSubscription"},"OrderUpdate":{"properties":{"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name of the customer that should appear on the invoice."},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/AddressInput"},{"type":"null"}],"description":"The address of the customer that should appear on the invoice. Country and state fields cannot be updated."}},"type":"object","title":"OrderUpdate","description":"Schema to update an order."},"OrderUser":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"public_name":{"type":"string","title":"Public Name"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"},"github_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Github Username"}},"type":"object","required":["id","public_name"],"title":"OrderUser"},"OrderVoidedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"order.voided","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/OrderVoidedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"OrderVoidedEvent","description":"An event created by Polar when an order is voided."},"OrderVoidedMetadata":{"properties":{"order_id":{"type":"string","title":"Order Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"}},"type":"object","required":["order_id","amount","currency"],"title":"OrderVoidedMetadata"},"Organization":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"Organization name shown in checkout, customer portal, emails etc."},"slug":{"type":"string","title":"Slug","description":"Unique organization slug in checkout, customer portal and credit card statements."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","description":"Avatar URL shown in checkout, customer portal, emails etc."},"proration_behavior":{"$ref":"#/components/schemas/SubscriptionProrationBehavior","description":"Proration behavior applied when customer updates their subscription from the portal."},"allow_customer_updates":{"type":"boolean","title":"Allow Customer Updates","description":"Whether customers can update their subscriptions from the customer portal."},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"Public support email."},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website","description":"Official website of the organization."},"socials":{"items":{"$ref":"#/components/schemas/OrganizationSocialLink"},"type":"array","title":"Socials","description":"Links to social profiles."},"status":{"$ref":"#/components/schemas/OrganizationStatus","description":"Current organization status"},"details_submitted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Details Submitted At","description":"When the business details were submitted for review."},"sso_enforced":{"type":"boolean","title":"Sso Enforced","description":"Whether members must access this organization through its SSO connection."},"default_presentment_currency":{"type":"string","title":"Default Presentment Currency","description":"Default presentment currency. Used as fallback in checkout and customer portal, if the customer's local currency is not available."},"default_tax_behavior":{"$ref":"#/components/schemas/TaxBehaviorOption","description":"Default tax behavior applied on products."},"feature_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationFeatureSettings"},{"type":"null"}],"description":"Organization feature settings"},"subscription_settings":{"$ref":"#/components/schemas/OrganizationSubscriptionSettings","description":"Settings related to subscriptions management"},"customer_email_settings":{"$ref":"#/components/schemas/OrganizationCustomerEmailSettings","description":"Settings related to customer emails"},"customer_portal_settings":{"$ref":"#/components/schemas/OrganizationCustomerPortalSettings","description":"Settings related to the customer portal"},"country":{"anyOf":[{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2","x-speakeasy-enums":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]},{"type":"null"}],"description":"Two-letter country code (ISO 3166-1 alpha-2)."},"account_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Account Id","description":"ID of the transactions account."},"payout_account_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Payout Account Id","description":"ID of the payout account."},"capabilities":{"$ref":"#/components/schemas/OrganizationCapabilities","description":"Capabilities currently granted to the organization."}},"type":"object","required":["created_at","modified_at","id","name","slug","avatar_url","proration_behavior","allow_customer_updates","email","website","socials","status","details_submitted_at","sso_enforced","default_presentment_currency","default_tax_behavior","feature_settings","subscription_settings","customer_email_settings","customer_portal_settings","account_id","payout_account_id","capabilities"],"title":"Organization"},"OrganizationAvatarFileCreate":{"properties":{"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id"},"name":{"type":"string","title":"Name"},"mime_type":{"type":"string","pattern":"^image\\/(jpeg|png|gif|webp|svg\\+xml)$","title":"Mime Type","description":"MIME type of the file. Only images are supported for this type of file."},"size":{"type":"integer","maximum":1048576.0,"title":"Size","description":"Size of the file. A maximum of 1 MB is allowed for this type of file."},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"upload":{"$ref":"#/components/schemas/S3FileCreateMultipart"},"service":{"type":"string","const":"organization_avatar","title":"Service"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"}},"type":"object","required":["name","mime_type","size","upload","service"],"title":"OrganizationAvatarFileCreate","description":"Schema to create a file to be used as an organization avatar."},"OrganizationAvatarFileRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"name":{"type":"string","title":"Name"},"path":{"type":"string","title":"Path"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"storage_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Version"},"checksum_etag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"checksum_sha256_hex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Hex"},"last_modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Modified At"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"service":{"type":"string","const":"organization_avatar","title":"Service"},"is_uploaded":{"type":"boolean","title":"Is Uploaded"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"size_readable":{"type":"string","title":"Size Readable","readOnly":true},"public_url":{"type":"string","title":"Public Url","readOnly":true}},"type":"object","required":["id","organization_id","name","path","mime_type","size","storage_version","checksum_etag","checksum_sha256_base64","checksum_sha256_hex","last_modified_at","version","service","is_uploaded","created_at","size_readable","public_url"],"title":"OrganizationAvatarFileRead","description":"File to be used as an organization avatar."},"OrganizationCapabilities":{"properties":{"checkout_payments":{"type":"boolean","title":"Checkout Payments","description":"Whether the organization can accept new checkout payments."},"subscription_renewals":{"type":"boolean","title":"Subscription Renewals","description":"Whether the organization can process subscription renewals."},"payouts":{"type":"boolean","title":"Payouts","description":"Whether the organization can withdraw its balance."},"refunds":{"type":"boolean","title":"Refunds","description":"Whether the organization can issue refunds."},"api_access":{"type":"boolean","title":"Api Access","description":"Whether the organization can access the API."},"dashboard_access":{"type":"boolean","title":"Dashboard Access","description":"Whether the organization can access the dashboard."}},"type":"object","required":["checkout_payments","subscription_renewals","payouts","refunds","api_access","dashboard_access"],"title":"OrganizationCapabilities"},"OrganizationCompanyLegalEntitySchema":{"properties":{"type":{"type":"string","const":"company","title":"Type"},"registered_name":{"type":"string","title":"Registered Name"}},"type":"object","required":["type","registered_name"],"title":"OrganizationCompanyLegalEntitySchema"},"OrganizationCreate":{"properties":{"name":{"type":"string","minLength":3,"title":"Name"},"slug":{"type":"string","maxLength":64,"minLength":3,"title":"Slug"},"avatar_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Avatar Url"},"legal_entity":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/OrganizationIndividualLegalEntitySchema"},{"$ref":"#/components/schemas/OrganizationCompanyLegalEntitySchema"}],"discriminator":{"propertyName":"type","mapping":{"company":"#/components/schemas/OrganizationCompanyLegalEntitySchema","individual":"#/components/schemas/OrganizationIndividualLegalEntitySchema"}}},{"type":"null"}],"title":"Legal Entity"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"Public support email."},"website":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Website","description":"Official website of the organization."},"socials":{"anyOf":[{"items":{"$ref":"#/components/schemas/OrganizationSocialLink"},"type":"array"},{"type":"null"}],"title":"Socials","description":"Link to social profiles."},"details":{"anyOf":[{"$ref":"#/components/schemas/OrganizationDetails"},{"type":"null"}],"description":"Additional, private, business details Polar needs about active organizations for compliance (KYC)."},"country":{"anyOf":[{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2Input","x-speakeasy-enums":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]},{"type":"null"}],"description":"Two-letter country code (ISO 3166-1 alpha-2)."},"feature_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationFeatureSettingsUpdate"},{"type":"null"}]},"subscription_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationSubscriptionSettings"},{"type":"null"}]},"customer_email_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationCustomerEmailSettings"},{"type":"null"}]},"customer_portal_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationCustomerPortalSettings"},{"type":"null"}]},"default_presentment_currency":{"$ref":"#/components/schemas/PresentmentCurrency","description":"Default presentment currency for the organization","default":"usd"},"default_tax_behavior":{"$ref":"#/components/schemas/TaxBehaviorOption","description":"Default tax behavior applied on products.","default":"location"}},"type":"object","required":["name","slug"],"title":"OrganizationCreate"},"OrganizationCustomerEmailSettings":{"properties":{"order_confirmation":{"type":"boolean","title":"Order Confirmation"},"subscription_cancellation":{"type":"boolean","title":"Subscription Cancellation"},"subscription_confirmation":{"type":"boolean","title":"Subscription Confirmation"},"subscription_cycled":{"type":"boolean","title":"Subscription Cycled"},"subscription_cycled_after_trial":{"type":"boolean","title":"Subscription Cycled After Trial"},"subscription_past_due":{"type":"boolean","title":"Subscription Past Due"},"subscription_paused":{"type":"boolean","title":"Subscription Paused"},"subscription_resumed":{"type":"boolean","title":"Subscription Resumed"},"subscription_renewal_reminder":{"type":"boolean","title":"Subscription Renewal Reminder"},"subscription_revoked":{"type":"boolean","title":"Subscription Revoked"},"subscription_trial_conversion_reminder":{"type":"boolean","title":"Subscription Trial Conversion Reminder"},"subscription_uncanceled":{"type":"boolean","title":"Subscription Uncanceled"},"subscription_updated":{"type":"boolean","title":"Subscription Updated"}},"type":"object","required":["order_confirmation","subscription_cancellation","subscription_confirmation","subscription_cycled","subscription_cycled_after_trial","subscription_past_due","subscription_paused","subscription_resumed","subscription_renewal_reminder","subscription_revoked","subscription_trial_conversion_reminder","subscription_uncanceled","subscription_updated"],"title":"OrganizationCustomerEmailSettings"},"OrganizationCustomerPortalSettings":{"properties":{"usage":{"$ref":"#/components/schemas/CustomerPortalUsageSettings"},"subscription":{"$ref":"#/components/schemas/CustomerPortalSubscriptionSettings"},"customer":{"$ref":"#/components/schemas/CustomerPortalCustomerSettings"}},"type":"object","required":["usage","subscription"],"title":"OrganizationCustomerPortalSettings"},"OrganizationDetails":{"properties":{"about":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"About","description":"Brief information about you and your business.","deprecated":true},"product_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Product Description","description":"Description of digital products being sold."},"selling_categories":{"items":{"type":"string"},"type":"array","title":"Selling Categories","description":"Categories of products being sold."},"pricing_models":{"items":{"type":"string"},"type":"array","title":"Pricing Models","description":"Pricing models used by the organization."},"intended_use":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Intended Use","description":"How the organization will integrate and use Polar.","deprecated":true},"customer_acquisition":{"items":{"type":"string"},"type":"array","title":"Customer Acquisition","description":"Main customer acquisition channels.","deprecated":true},"future_annual_revenue":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Future Annual Revenue","description":"Estimated revenue in the next 12 months","deprecated":true},"switching":{"type":"boolean","title":"Switching","description":"Switching from another platform?","default":false},"switching_from":{"anyOf":[{"type":"string","enum":["paddle","lemon_squeezy","gumroad","stripe","other"]},{"type":"null"}],"title":"Switching From","description":"Which platform the organization is migrating from."},"previous_annual_revenue":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Previous Annual Revenue","description":"Revenue from last year if applicable.","deprecated":true}},"type":"object","title":"OrganizationDetails"},"OrganizationFeatureSettings":{"properties":{"issue_funding_enabled":{"type":"boolean","title":"Issue Funding Enabled","description":"If this organization has issue funding enabled","default":false},"seat_based_pricing_enabled":{"type":"boolean","title":"Seat Based Pricing Enabled","description":"If this organization has seat-based pricing enabled","default":false},"wallets_enabled":{"type":"boolean","title":"Wallets Enabled","description":"If this organization has Wallets enabled","default":false},"member_model_enabled":{"type":"boolean","title":"Member Model Enabled","description":"If this organization has the Member model enabled","default":false},"checkout_localization_enabled":{"type":"boolean","title":"Checkout Localization Enabled","description":"If this organization has checkout localization enabled","default":false},"overview_metrics":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Overview Metrics","description":"Ordered list of metric slugs shown on the dashboard overview."},"reset_proration_behavior_enabled":{"type":"boolean","title":"Reset Proration Behavior Enabled","description":"If this organization has access to reset proration behavior.","default":false},"off_session_charges_enabled":{"type":"boolean","title":"Off Session Charges Enabled","description":"If this organization can create and finalize draft orders via the API (off-session charges against a saved payment method).","default":false},"slack_benefit_enabled":{"type":"boolean","title":"Slack Benefit Enabled","description":"Enables the slack shared channel benefit","default":false},"preview_access_enabled":{"type":"boolean","title":"Preview Access Enabled","description":"If this organization has preview access to new features enabled","default":false},"disputes_enabled":{"type":"boolean","title":"Disputes Enabled","description":"If this organization has the disputes dashboard enabled","default":false},"sso_enabled":{"type":"boolean","title":"Sso Enabled","description":"If this organization has single sign-on configuration enabled","default":false},"compass_enabled":{"type":"boolean","title":"Compass Enabled","description":"If this organization has the split product navigation (Billing / Compass / Customers) enabled in the dashboard","default":false},"merchant_migration_enabled":{"type":"boolean","title":"Merchant Migration Enabled","description":"If this organization can migrate its billing from another provider (e.g. Stripe) to Polar.","default":false}},"type":"object","title":"OrganizationFeatureSettings"},"OrganizationFeatureSettingsUpdate":{"properties":{"seat_based_pricing_enabled":{"type":"boolean","title":"Seat Based Pricing Enabled","description":"If this organization has seat-based pricing enabled","default":false},"member_model_enabled":{"type":"boolean","title":"Member Model Enabled","description":"If this organization has the Member model enabled","default":false},"checkout_localization_enabled":{"type":"boolean","title":"Checkout Localization Enabled","description":"If this organization has checkout localization enabled","default":false},"overview_metrics":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Overview Metrics","description":"Ordered list of metric slugs shown on the dashboard overview."}},"type":"object","title":"OrganizationFeatureSettingsUpdate","description":"Feature settings that organizations can update themselves.\n\nOther feature settings are managed by Polar staff: they're ignored if\nprovided and keep their current value."},"OrganizationIndividualLegalEntitySchema":{"properties":{"type":{"type":"string","const":"individual","title":"Type"}},"type":"object","required":["type"],"title":"OrganizationIndividualLegalEntitySchema"},"OrganizationNotReadyForPayments":{"properties":{"error":{"type":"string","const":"OrganizationNotReadyForPayments","title":"Error","examples":["OrganizationNotReadyForPayments"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"OrganizationNotReadyForPayments"},"OrganizationNotificationSettings":{"properties":{"new_order":{"type":"boolean","title":"New Order"},"new_subscription":{"type":"boolean","title":"New Subscription"},"chargeback_prevention":{"type":"boolean","title":"Chargeback Prevention"}},"type":"object","required":["new_order","new_subscription","chargeback_prevention"],"title":"OrganizationNotificationSettings"},"OrganizationSocialLink":{"properties":{"platform":{"$ref":"#/components/schemas/OrganizationSocialPlatforms","description":"The social platform of the URL"},"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url","description":"The URL to the organization profile"}},"type":"object","required":["platform","url"],"title":"OrganizationSocialLink"},"OrganizationSocialPlatforms":{"type":"string","enum":["x","github","facebook","instagram","youtube","tiktok","linkedin","threads","discord","other"],"title":"OrganizationSocialPlatforms"},"OrganizationSortProperty":{"type":"string","enum":["created_at","-created_at","slug","-slug","name","-name","next_review_threshold","-next_review_threshold","days_in_status","-days_in_status"],"title":"OrganizationSortProperty"},"OrganizationStatus":{"type":"string","enum":["created","review","snoozed","denied","active","blocked","offboarding","offboarded"],"title":"OrganizationStatus"},"OrganizationSubscriptionSettings":{"properties":{"allow_multiple_subscriptions":{"type":"boolean","title":"Allow Multiple Subscriptions"},"proration_behavior":{"type":"string","enum":["invoice","prorate","next_period"],"title":"PublicSubscriptionProrationBehavior"},"benefit_revocation_grace_period":{"type":"integer","title":"Benefit Revocation Grace Period"},"prevent_trial_abuse":{"type":"boolean","title":"Prevent Trial Abuse"},"allow_customer_updates":{"type":"boolean","title":"Allow Customer Updates"}},"type":"object","required":["allow_multiple_subscriptions","proration_behavior","benefit_revocation_grace_period","prevent_trial_abuse","allow_customer_updates"],"title":"OrganizationSubscriptionSettings"},"OrganizationUpdate":{"properties":{"name":{"anyOf":[{"type":"string","minLength":3},{"type":"null"}],"title":"Name"},"avatar_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Avatar Url"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"Public support email."},"website":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Website","description":"Official website of the organization."},"socials":{"anyOf":[{"items":{"$ref":"#/components/schemas/OrganizationSocialLink"},"type":"array"},{"type":"null"}],"title":"Socials","description":"Links to social profiles."},"details":{"anyOf":[{"$ref":"#/components/schemas/OrganizationDetails"},{"type":"null"}],"description":"Additional, private, business details Polar needs about active organizations for compliance (KYC)."},"country":{"anyOf":[{"type":"string","enum":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"],"title":"CountryAlpha2Input","x-speakeasy-enums":["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]},{"type":"null"}],"description":"Two-letter country code (ISO 3166-1 alpha-2)."},"feature_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationFeatureSettingsUpdate"},{"type":"null"}]},"subscription_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationSubscriptionSettings"},{"type":"null"}]},"customer_email_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationCustomerEmailSettings"},{"type":"null"}]},"customer_portal_settings":{"anyOf":[{"$ref":"#/components/schemas/OrganizationCustomerPortalSettings"},{"type":"null"}]},"default_presentment_currency":{"anyOf":[{"$ref":"#/components/schemas/PresentmentCurrency"},{"type":"null"}],"description":"Default presentment currency for the organization"},"default_tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"Default tax behavior applied on products."},"sso_enforced":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sso Enforced","description":"Whether members must access this organization through its SSO connection. Turning this on requires an active SSO session for this organization and at least one enabled SSO connection."}},"type":"object","title":"OrganizationUpdate"},"Pagination":{"properties":{"total_count":{"type":"integer","title":"Total Count"},"max_page":{"type":"integer","title":"Max Page"}},"type":"object","required":["total_count","max_page"],"title":"Pagination"},"PauseResumeNotAllowed":{"properties":{"error":{"type":"string","const":"PauseResumeNotAllowed","title":"Error","examples":["PauseResumeNotAllowed"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PauseResumeNotAllowed"},"Payment":{"anyOf":[{"$ref":"#/components/schemas/CardPayment"},{"$ref":"#/components/schemas/GenericPayment"}]},"PaymentActionRequired":{"properties":{"error":{"type":"string","const":"PaymentActionRequired","title":"Error","examples":["PaymentActionRequired"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentActionRequired"},"PaymentAlreadyInProgress":{"properties":{"error":{"type":"string","const":"PaymentAlreadyInProgress","title":"Error","examples":["PaymentAlreadyInProgress"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentAlreadyInProgress"},"PaymentError":{"properties":{"error":{"type":"string","const":"PaymentError","title":"Error","examples":["PaymentError"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentError"},"PaymentFailed":{"properties":{"error":{"type":"string","const":"PaymentFailed","title":"Error","examples":["PaymentFailed"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentFailed"},"PaymentMethod":{"anyOf":[{"$ref":"#/components/schemas/CustomerPaymentMethodCard"},{"$ref":"#/components/schemas/CustomerPaymentMethodGeneric"}]},"PaymentMethodCard":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"processor":{"$ref":"#/components/schemas/PaymentProcessor"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"type":{"type":"string","const":"card","title":"Type"},"method_metadata":{"$ref":"#/components/schemas/PaymentMethodCardMetadata"}},"type":"object","required":["id","created_at","modified_at","processor","customer_id","type","method_metadata"],"title":"PaymentMethodCard"},"PaymentMethodCardMetadata":{"properties":{"brand":{"type":"string","title":"Brand"},"last4":{"type":"string","title":"Last4"},"exp_month":{"type":"integer","title":"Exp Month"},"exp_year":{"type":"integer","title":"Exp Year"},"wallet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wallet"}},"type":"object","required":["brand","last4","exp_month","exp_year"],"title":"PaymentMethodCardMetadata"},"PaymentMethodGeneric":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"processor":{"$ref":"#/components/schemas/PaymentProcessor"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"type":{"type":"string","title":"Type"}},"type":"object","required":["id","created_at","modified_at","processor","customer_id","type"],"title":"PaymentMethodGeneric"},"PaymentMethodInUseByActiveSubscription":{"properties":{"error":{"type":"string","const":"PaymentMethodInUseByActiveSubscription","title":"Error","examples":["PaymentMethodInUseByActiveSubscription"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentMethodInUseByActiveSubscription"},"PaymentMethodSetupFailed":{"properties":{"error":{"type":"string","const":"PaymentMethodSetupFailed","title":"Error","examples":["PaymentMethodSetupFailed"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentMethodSetupFailed"},"PaymentNotReady":{"properties":{"error":{"type":"string","const":"PaymentNotReady","title":"Error","examples":["PaymentNotReady"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"PaymentNotReady"},"PaymentProcessor":{"type":"string","enum":["stripe"],"title":"PaymentProcessor"},"PaymentSortProperty":{"type":"string","enum":["created_at","-created_at","status","-status","amount","-amount","method","-method"],"title":"PaymentSortProperty"},"PaymentStatus":{"type":"string","enum":["pending","succeeded","failed"],"title":"PaymentStatus"},"PaymentTrigger":{"type":"string","enum":["purchase","subscription_cycle","retry_dunning","retry_customer","retry_payment_method_update","retry_admin"],"title":"PaymentTrigger"},"PendingSubscriptionUpdate":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"applies_at":{"type":"string","format":"date-time","title":"Applies At","description":"The date and time when the subscription update will be applied."},"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"ID of the new product to apply to the subscription. If `null`, the product won't be changed."},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"Number of seats to apply to the subscription. If `null`, the number of seats won't be changed."}},"type":"object","required":["created_at","modified_at","id","applies_at","product_id","seats"],"title":"PendingSubscriptionUpdate","description":"Pending update to be applied to a subscription at the beginning of the next period."},"PortalAuthenticatedUser":{"properties":{"type":{"type":"string","title":"Type","description":"Type of authenticated user: 'customer' or 'member'"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"User's name, if available."},"email":{"type":"string","title":"Email","description":"User's email address."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"Associated customer ID."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"Member ID. Only set for members."},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role","description":"Member role (owner, billing_manager, member). Only set for members."}},"type":"object","required":["type","name","email","customer_id"],"title":"PortalAuthenticatedUser","description":"Information about the authenticated portal user."},"PresentmentCurrency":{"type":"string","enum":["aed","all","amd","aoa","ars","aud","awg","azn","bam","bbd","bdt","bif","bmd","bnd","bob","brl","bsd","bwp","bzd","cad","cdf","chf","clp","cny","cop","crc","cve","czk","djf","dkk","dop","dzd","egp","etb","eur","fjd","fkp","gbp","gel","gip","gmd","gnf","gtq","gyd","hkd","hnl","htg","huf","idr","ils","inr","isk","jmd","jpy","kes","kgs","khr","kmf","krw","kyd","kzt","lak","lkr","lrd","lsl","mad","mdl","mga","mkd","mnt","mop","mur","mvr","mwk","mxn","myr","mzn","nad","ngn","nio","nok","npr","nzd","pab","pen","pgk","php","pkr","pln","pyg","qar","ron","rsd","rwf","sar","sbd","scr","sek","sgd","shp","sos","srd","szl","thb","tjs","top","try","ttd","twd","tzs","uah","ugx","usd","uyu","uzs","vnd","vuv","wst","xaf","xcd","xcg","xof","xpf","yer","zar","zmw"],"title":"PresentmentCurrency"},"Product":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"type":"string","title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase."},"recurring_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. None for one-time products."},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The meter cycle of the product, independent of the billing interval. If `None`, metered concerns follow the billing interval."},"meter_interval_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. None when no meter cycle is set."},"is_recurring":{"type":"boolean","title":"Is Recurring","description":"Whether the product is a subscription."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the product is archived and no longer available."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the product."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of prices for this product."},"benefits":{"items":{"$ref":"#/components/schemas/Benefit","title":"Benefit"},"type":"array","title":"Benefits","description":"List of benefits granted by the product."},"medias":{"items":{"$ref":"#/components/schemas/ProductMediaFileRead"},"type":"array","title":"Medias","description":"List of medias associated to the product."},"attached_custom_fields":{"items":{"$ref":"#/components/schemas/AttachedCustomField"},"type":"array","title":"Attached Custom Fields","description":"List of custom fields attached to the product."}},"type":"object","required":["id","created_at","modified_at","trial_interval","trial_interval_count","name","description","visibility","recurring_interval","recurring_interval_count","meter_interval","meter_interval_count","is_recurring","is_archived","organization_id","metadata","prices","benefits","medias","attached_custom_fields"],"title":"Product","description":"A product."},"ProductBenefitsUpdate":{"properties":{"benefits":{"items":{"type":"string","format":"uuid4","description":"The benefit ID."},"type":"array","title":"Benefits","description":"List of benefit IDs. Each one must be on the same organization as the product."}},"type":"object","required":["benefits"],"title":"ProductBenefitsUpdate","description":"Schema to update the benefits granted by a product."},"ProductBillingType":{"type":"string","enum":["one_time","recurring"],"title":"ProductBillingType"},"ProductCreate":{"oneOf":[{"$ref":"#/components/schemas/ProductCreateRecurring"},{"$ref":"#/components/schemas/ProductCreateOneTime"}]},"ProductCreateOneTime":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"type":"string","maxLength":64,"minLength":3,"title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product.","default":"public"},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/ProductPriceFixedCreate"},{"$ref":"#/components/schemas/ProductPriceCustomCreate"},{"$ref":"#/components/schemas/ProductPriceSeatBasedCreate"},{"$ref":"#/components/schemas/ProductPriceMeteredUnitCreate"}],"discriminator":{"propertyName":"amount_type","mapping":{"custom":"#/components/schemas/ProductPriceCustomCreate","fixed":"#/components/schemas/ProductPriceFixedCreate","metered_unit":"#/components/schemas/ProductPriceMeteredUnitCreate","seat_based":"#/components/schemas/ProductPriceSeatBasedCreate"}}},"type":"array","minItems":1,"title":"ProductPriceCreateList","description":"List of available prices for this product. It may combine at most one fixed price with one seat-based price (billed as `fixed + seat_charge`), or contain a single custom or free price, plus any number of metered prices. A free price cannot be combined with other prices, and a custom price cannot be combined with a fixed or seat-based price. Metered prices are not supported on one-time purchase products."},"medias":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array"},{"type":"null"}],"title":"Medias","description":"List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded."},"attached_custom_fields":{"items":{"$ref":"#/components/schemas/AttachedCustomFieldCreate"},"type":"array","title":"Attached Custom Fields","description":"List of custom fields to attach."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the product. **Required unless you use an organization token.**"},"recurring_interval":{"type":"null","title":"Recurring Interval","description":"States that the product is a one-time purchase."},"recurring_interval_count":{"type":"null","title":"Recurring Interval Count","description":"One-time products don't have a recurring interval count."}},"type":"object","required":["name","prices"],"title":"ProductCreateOneTime"},"ProductCreateRecurring":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"name":{"type":"string","maxLength":64,"minLength":3,"title":"Name","description":"The name of the product."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"visibility":{"$ref":"#/components/schemas/ProductVisibility","description":"The visibility of the product.","default":"public"},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/ProductPriceFixedCreate"},{"$ref":"#/components/schemas/ProductPriceCustomCreate"},{"$ref":"#/components/schemas/ProductPriceSeatBasedCreate"},{"$ref":"#/components/schemas/ProductPriceMeteredUnitCreate"}],"discriminator":{"propertyName":"amount_type","mapping":{"custom":"#/components/schemas/ProductPriceCustomCreate","fixed":"#/components/schemas/ProductPriceFixedCreate","metered_unit":"#/components/schemas/ProductPriceMeteredUnitCreate","seat_based":"#/components/schemas/ProductPriceSeatBasedCreate"}}},"type":"array","minItems":1,"title":"ProductPriceCreateList","description":"List of available prices for this product. It may combine at most one fixed price with one seat-based price (billed as `fixed + seat_charge`), or contain a single custom or free price, plus any number of metered prices. A free price cannot be combined with other prices, and a custom price cannot be combined with a fixed or seat-based price. Metered prices are not supported on one-time purchase products."},"medias":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array"},{"type":"null"}],"title":"Medias","description":"List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded."},"attached_custom_fields":{"items":{"$ref":"#/components/schemas/AttachedCustomFieldCreate"},"type":"array","title":"Attached Custom Fields","description":"List of custom fields to attach."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The ID of the organization owning the product. **Required unless you use an organization token.**"},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The recurring interval of the product."},"recurring_interval_count":{"type":"integer","maximum":999.0,"minimum":1.0,"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on.","default":1},"meter_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"Optional meter cycle, independent of the billing interval. When set, overage settlement, meter resets and meter-credit grants run on this cadence rather than the billing interval — e.g. yearly billing with monthly credits. It must evenly divide the billing interval. If `None`, metered concerns follow the billing interval. **Once set, it can't be changed.**"},"meter_interval_count":{"anyOf":[{"type":"integer","maximum":999.0,"minimum":1.0},{"type":"null"}],"title":"Meter Interval Count","description":"Number of meter interval units. Defaults to 1 when `meter_interval` is set. Ignored when `meter_interval` is `None`."}},"type":"object","required":["name","prices","recurring_interval"],"title":"ProductCreateRecurring"},"ProductMediaFileCreate":{"properties":{"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id"},"name":{"type":"string","title":"Name"},"mime_type":{"type":"string","pattern":"^image\\/(jpeg|png|gif|webp|svg\\+xml)$","title":"Mime Type","description":"MIME type of the file. Only images are supported for this type of file."},"size":{"type":"integer","maximum":10485760.0,"title":"Size","description":"Size of the file. A maximum of 10 MB is allowed for this type of file."},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"upload":{"$ref":"#/components/schemas/S3FileCreateMultipart"},"service":{"type":"string","const":"product_media","title":"Service"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"}},"type":"object","required":["name","mime_type","size","upload","service"],"title":"ProductMediaFileCreate","description":"Schema to create a file to be used as a product media file."},"ProductMediaFileRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"name":{"type":"string","title":"Name"},"path":{"type":"string","title":"Path"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"storage_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Version"},"checksum_etag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"checksum_sha256_hex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Hex"},"last_modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Modified At"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"service":{"type":"string","const":"product_media","title":"Service"},"is_uploaded":{"type":"boolean","title":"Is Uploaded"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"size_readable":{"type":"string","title":"Size Readable","readOnly":true},"public_url":{"type":"string","title":"Public Url","readOnly":true}},"type":"object","required":["id","organization_id","name","path","mime_type","size","storage_version","checksum_etag","checksum_sha256_base64","checksum_sha256_hex","last_modified_at","version","service","is_uploaded","created_at","size_readable","public_url"],"title":"ProductMediaFileRead","description":"File to be used as a product media file."},"ProductPrice":{"oneOf":[{"$ref":"#/components/schemas/ProductPriceFixed"},{"$ref":"#/components/schemas/ProductPriceCustom"},{"$ref":"#/components/schemas/ProductPriceSeatBased"},{"$ref":"#/components/schemas/ProductPriceMeteredUnit"}],"discriminator":{"propertyName":"amount_type","mapping":{"custom":"#/components/schemas/ProductPriceCustom","fixed":"#/components/schemas/ProductPriceFixed","metered_unit":"#/components/schemas/ProductPriceMeteredUnit","seat_based":"#/components/schemas/ProductPriceSeatBased"}}},"ProductPriceCustom":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the price."},"source":{"$ref":"#/components/schemas/ProductPriceSource","description":"The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session."},"amount_type":{"type":"string","const":"custom","title":"Amount Type"},"price_currency":{"type":"string","title":"Price Currency","description":"The currency in which the customer will be charged."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If null, it defaults to the organization's default tax behavior."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the price is archived and no longer available."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the product owning the price."},"minimum_amount":{"type":"integer","title":"Minimum Amount","description":"The minimum amount the customer can pay. If 0, the price is 'free or pay what you want'."},"maximum_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Maximum Amount","description":"The maximum amount the customer can pay."},"preset_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Preset Amount","description":"The initial amount shown to the customer."}},"type":"object","required":["created_at","modified_at","id","source","amount_type","price_currency","tax_behavior","is_archived","product_id","minimum_amount","maximum_amount","preset_amount"],"title":"ProductPriceCustom","description":"A pay-what-you-want price for a product."},"ProductPriceCustomCreate":{"properties":{"amount_type":{"type":"string","const":"custom","title":"Amount Type"},"price_currency":{"$ref":"#/components/schemas/PresentmentCurrency","description":"The currency in which the customer will be charged.","default":"usd"},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If not set, it will default to the organization's default tax behavior."},"minimum_amount":{"type":"integer","minimum":0.0,"title":"Minimum Amount","description":"The minimum amount the customer can pay. If set to 0, the price is 'free or pay what you want' and $0 is accepted. If set to a value below the minimum price amount for the currency, it will be rejected. Defaults to the minimum price amount for the currency. Minimum per currency:\n- USD: 0.5\n- AED: 2\n- ALL: 50\n- AMD: 200\n- AOA: 500\n- ARS: 750\n- AUD: 0.7\n- AWG: 1\n- AZN: 1\n- BAM: 1\n- BBD: 2\n- BDT: 70\n- BIF: 2,000\n- BMD: 1\n- BND: 1\n- BOB: 5\n- BRL: 2.5\n- BSD: 1\n- BWP: 10\n- BZD: 2\n- CAD: 0.7\n- CDF: 2,000\n- CHF: 0.5\n- CLP: 500\n- CNY: 5\n- COP: 2,000\n- CRC: 300\n- CVE: 50\n- CZK: 15\n- DJF: 100\n- DKK: 3.2\n- DOP: 40\n- DZD: 70\n- EGP: 30\n- ETB: 80\n- EUR: 0.5\n- FJD: 2\n- FKP: 1\n- GBP: 0.4\n- GEL: 2\n- GNF: 5,000\n- GIP: 1\n- GMD: 40\n- GTQ: 5\n- GYD: 200\n- HKD: 4\n- HNL: 20\n- HTG: 70\n- HUF: 175\n- IDR: 9,000\n- ILS: 1.5\n- INR: 60\n- ISK: 70\n- JMD: 80\n- JPY: 80\n- KES: 70\n- KGS: 50\n- KHR: 3,000\n- KMF: 500\n- KRW: 800\n- KYD: 1\n- KZT: 300\n- LAK: 20,000\n- LKR: 200\n- LRD: 100\n- LSL: 10\n- MAD: 5\n- MDL: 10\n- MGA: 3,000\n- MKD: 50\n- MNT: 2,000\n- MOP: 5\n- MUR: 50\n- MVR: 8\n- MXN: 9\n- MWK: 1,000\n- MYR: 2\n- MZN: 50\n- NAD: 10\n- NGN: 700\n- NIO: 20\n- NOK: 5\n- NPR: 80\n- NZD: 0.9\n- PAB: 1\n- PEN: 2\n- PGK: 3\n- PHP: 35\n- PKR: 200\n- PLN: 2\n- PYG: 4,000\n- QAR: 2\n- RON: 2.5\n- RSD: 60\n- RWF: 1,000\n- SAR: 2\n- SBD: 4\n- SCR: 8\n- SEK: 5\n- SGD: 0.7\n- SHP: 1\n- SOS: 500\n- SRD: 20\n- SZL: 10\n- THB: 20\n- TJS: 5\n- TOP: 2\n- TRY: 30\n- TTD: 4\n- TWD: 20\n- TZS: 2,000\n- UAH: 30\n- UGX: 2,000\n- UYU: 20\n- UZS: 7,000\n- VND: 20,000\n- VUV: 100\n- WST: 2\n- XAF: 500\n- XCD: 2\n- XCG: 1\n- XOF: 500\n- XPF: 100\n- YER: 200\n- ZAR: 9\n- ZMW: 10\n- Other currencies: 50 minor units","default":50},"maximum_amount":{"anyOf":[{"type":"integer","minimum":1.0,"description":"The price in cents.\nMinimum amounts per currency:\n- USD: 0.5\n- AED: 2\n- ALL: 50\n- AMD: 200\n- AOA: 500\n- ARS: 750\n- AUD: 0.7\n- AWG: 1\n- AZN: 1\n- BAM: 1\n- BBD: 2\n- BDT: 70\n- BIF: 2,000\n- BMD: 1\n- BND: 1\n- BOB: 5\n- BRL: 2.5\n- BSD: 1\n- BWP: 10\n- BZD: 2\n- CAD: 0.7\n- CDF: 2,000\n- CHF: 0.5\n- CLP: 500\n- CNY: 5\n- COP: 2,000\n- CRC: 300\n- CVE: 50\n- CZK: 15\n- DJF: 100\n- DKK: 3.2\n- DOP: 40\n- DZD: 70\n- EGP: 30\n- ETB: 80\n- EUR: 0.5\n- FJD: 2\n- FKP: 1\n- GBP: 0.4\n- GEL: 2\n- GNF: 5,000\n- GIP: 1\n- GMD: 40\n- GTQ: 5\n- GYD: 200\n- HKD: 4\n- HNL: 20\n- HTG: 70\n- HUF: 175\n- IDR: 9,000\n- ILS: 1.5\n- INR: 60\n- ISK: 70\n- JMD: 80\n- JPY: 80\n- KES: 70\n- KGS: 50\n- KHR: 3,000\n- KMF: 500\n- KRW: 800\n- KYD: 1\n- KZT: 300\n- LAK: 20,000\n- LKR: 200\n- LRD: 100\n- LSL: 10\n- MAD: 5\n- MDL: 10\n- MGA: 3,000\n- MKD: 50\n- MNT: 2,000\n- MOP: 5\n- MUR: 50\n- MVR: 8\n- MXN: 9\n- MWK: 1,000\n- MYR: 2\n- MZN: 50\n- NAD: 10\n- NGN: 700\n- NIO: 20\n- NOK: 5\n- NPR: 80\n- NZD: 0.9\n- PAB: 1\n- PEN: 2\n- PGK: 3\n- PHP: 35\n- PKR: 200\n- PLN: 2\n- PYG: 4,000\n- QAR: 2\n- RON: 2.5\n- RSD: 60\n- RWF: 1,000\n- SAR: 2\n- SBD: 4\n- SCR: 8\n- SEK: 5\n- SGD: 0.7\n- SHP: 1\n- SOS: 500\n- SRD: 20\n- SZL: 10\n- THB: 20\n- TJS: 5\n- TOP: 2\n- TRY: 30\n- TTD: 4\n- TWD: 20\n- TZS: 2,000\n- UAH: 30\n- UGX: 2,000\n- UYU: 20\n- UZS: 7,000\n- VND: 20,000\n- VUV: 100\n- WST: 2\n- XAF: 500\n- XCD: 2\n- XCG: 1\n- XOF: 500\n- XPF: 100\n- YER: 200\n- ZAR: 9\n- ZMW: 10\n- Other currencies: 50 minor units"},{"type":"null"}],"title":"Maximum Amount","description":"The maximum amount the customer can pay. Maximum per currency:\n- USD: 999,999.99\n- EUR: 999,999.99\n- GBP: 999,999.99\n- ARS: 1,400,000\n- CDF: 2,800,000\n- COP: 4,000,000\n- IDR: 16,000,000\n- KHR: 4,000,000\n- LAK: 21,000,000\n- MNT: 3,500,000\n- MWK: 1,750,000\n- NGN: 1,550,000\n- TZS: 2,500,000\n- UGX: 3,700,000\n- UZS: 12,500,000\n- Other currencies: 99,999,999 minor units"},"preset_amount":{"anyOf":[{"type":"integer","minimum":0.0,"description":"The price in cents.\nMinimum amounts per currency:\n- USD: 0.5\n- AED: 2\n- ALL: 50\n- AMD: 200\n- AOA: 500\n- ARS: 750\n- AUD: 0.7\n- AWG: 1\n- AZN: 1\n- BAM: 1\n- BBD: 2\n- BDT: 70\n- BIF: 2,000\n- BMD: 1\n- BND: 1\n- BOB: 5\n- BRL: 2.5\n- BSD: 1\n- BWP: 10\n- BZD: 2\n- CAD: 0.7\n- CDF: 2,000\n- CHF: 0.5\n- CLP: 500\n- CNY: 5\n- COP: 2,000\n- CRC: 300\n- CVE: 50\n- CZK: 15\n- DJF: 100\n- DKK: 3.2\n- DOP: 40\n- DZD: 70\n- EGP: 30\n- ETB: 80\n- EUR: 0.5\n- FJD: 2\n- FKP: 1\n- GBP: 0.4\n- GEL: 2\n- GNF: 5,000\n- GIP: 1\n- GMD: 40\n- GTQ: 5\n- GYD: 200\n- HKD: 4\n- HNL: 20\n- HTG: 70\n- HUF: 175\n- IDR: 9,000\n- ILS: 1.5\n- INR: 60\n- ISK: 70\n- JMD: 80\n- JPY: 80\n- KES: 70\n- KGS: 50\n- KHR: 3,000\n- KMF: 500\n- KRW: 800\n- KYD: 1\n- KZT: 300\n- LAK: 20,000\n- LKR: 200\n- LRD: 100\n- LSL: 10\n- MAD: 5\n- MDL: 10\n- MGA: 3,000\n- MKD: 50\n- MNT: 2,000\n- MOP: 5\n- MUR: 50\n- MVR: 8\n- MXN: 9\n- MWK: 1,000\n- MYR: 2\n- MZN: 50\n- NAD: 10\n- NGN: 700\n- NIO: 20\n- NOK: 5\n- NPR: 80\n- NZD: 0.9\n- PAB: 1\n- PEN: 2\n- PGK: 3\n- PHP: 35\n- PKR: 200\n- PLN: 2\n- PYG: 4,000\n- QAR: 2\n- RON: 2.5\n- RSD: 60\n- RWF: 1,000\n- SAR: 2\n- SBD: 4\n- SCR: 8\n- SEK: 5\n- SGD: 0.7\n- SHP: 1\n- SOS: 500\n- SRD: 20\n- SZL: 10\n- THB: 20\n- TJS: 5\n- TOP: 2\n- TRY: 30\n- TTD: 4\n- TWD: 20\n- TZS: 2,000\n- UAH: 30\n- UGX: 2,000\n- UYU: 20\n- UZS: 7,000\n- VND: 20,000\n- VUV: 100\n- WST: 2\n- XAF: 500\n- XCD: 2\n- XCG: 1\n- XOF: 500\n- XPF: 100\n- YER: 200\n- ZAR: 9\n- ZMW: 10\n- Other currencies: 50 minor units"},{"type":"null"}],"title":"Preset Amount","description":"The initial amount shown to the customer. If 0, the customer will see $0 as the default. If set to a value below the minimum price amount for the currency, it will be rejected.Minimum per currency:\n- USD: 0.5\n- AED: 2\n- ALL: 50\n- AMD: 200\n- AOA: 500\n- ARS: 750\n- AUD: 0.7\n- AWG: 1\n- AZN: 1\n- BAM: 1\n- BBD: 2\n- BDT: 70\n- BIF: 2,000\n- BMD: 1\n- BND: 1\n- BOB: 5\n- BRL: 2.5\n- BSD: 1\n- BWP: 10\n- BZD: 2\n- CAD: 0.7\n- CDF: 2,000\n- CHF: 0.5\n- CLP: 500\n- CNY: 5\n- COP: 2,000\n- CRC: 300\n- CVE: 50\n- CZK: 15\n- DJF: 100\n- DKK: 3.2\n- DOP: 40\n- DZD: 70\n- EGP: 30\n- ETB: 80\n- EUR: 0.5\n- FJD: 2\n- FKP: 1\n- GBP: 0.4\n- GEL: 2\n- GNF: 5,000\n- GIP: 1\n- GMD: 40\n- GTQ: 5\n- GYD: 200\n- HKD: 4\n- HNL: 20\n- HTG: 70\n- HUF: 175\n- IDR: 9,000\n- ILS: 1.5\n- INR: 60\n- ISK: 70\n- JMD: 80\n- JPY: 80\n- KES: 70\n- KGS: 50\n- KHR: 3,000\n- KMF: 500\n- KRW: 800\n- KYD: 1\n- KZT: 300\n- LAK: 20,000\n- LKR: 200\n- LRD: 100\n- LSL: 10\n- MAD: 5\n- MDL: 10\n- MGA: 3,000\n- MKD: 50\n- MNT: 2,000\n- MOP: 5\n- MUR: 50\n- MVR: 8\n- MXN: 9\n- MWK: 1,000\n- MYR: 2\n- MZN: 50\n- NAD: 10\n- NGN: 700\n- NIO: 20\n- NOK: 5\n- NPR: 80\n- NZD: 0.9\n- PAB: 1\n- PEN: 2\n- PGK: 3\n- PHP: 35\n- PKR: 200\n- PLN: 2\n- PYG: 4,000\n- QAR: 2\n- RON: 2.5\n- RSD: 60\n- RWF: 1,000\n- SAR: 2\n- SBD: 4\n- SCR: 8\n- SEK: 5\n- SGD: 0.7\n- SHP: 1\n- SOS: 500\n- SRD: 20\n- SZL: 10\n- THB: 20\n- TJS: 5\n- TOP: 2\n- TRY: 30\n- TTD: 4\n- TWD: 20\n- TZS: 2,000\n- UAH: 30\n- UGX: 2,000\n- UYU: 20\n- UZS: 7,000\n- VND: 20,000\n- VUV: 100\n- WST: 2\n- XAF: 500\n- XCD: 2\n- XCG: 1\n- XOF: 500\n- XPF: 100\n- YER: 200\n- ZAR: 9\n- ZMW: 10\n- Other currencies: 50 minor units"}},"type":"object","required":["amount_type"],"title":"ProductPriceCustomCreate","description":"Schema to create a pay-what-you-want price."},"ProductPriceFixed":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the price."},"source":{"$ref":"#/components/schemas/ProductPriceSource","description":"The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session."},"amount_type":{"type":"string","const":"fixed","title":"Amount Type"},"price_currency":{"type":"string","title":"Price Currency","description":"The currency in which the customer will be charged."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If null, it defaults to the organization's default tax behavior."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the price is archived and no longer available."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the product owning the price."},"price_amount":{"type":"integer","title":"Price Amount","description":"The price in cents."}},"type":"object","required":["created_at","modified_at","id","source","amount_type","price_currency","tax_behavior","is_archived","product_id","price_amount"],"title":"ProductPriceFixed","description":"A fixed price for a product."},"ProductPriceFixedCreate":{"properties":{"amount_type":{"type":"string","const":"fixed","title":"Amount Type"},"price_currency":{"$ref":"#/components/schemas/PresentmentCurrency","description":"The currency in which the customer will be charged.","default":"usd"},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If not set, it will default to the organization's default tax behavior."},"price_amount":{"type":"integer","minimum":0.0,"title":"Price Amount","description":"The price in cents. Set to `0` for a free price.\nMinimum amounts per currency:\n- USD: 0.5\n- AED: 2\n- ALL: 50\n- AMD: 200\n- AOA: 500\n- ARS: 750\n- AUD: 0.7\n- AWG: 1\n- AZN: 1\n- BAM: 1\n- BBD: 2\n- BDT: 70\n- BIF: 2,000\n- BMD: 1\n- BND: 1\n- BOB: 5\n- BRL: 2.5\n- BSD: 1\n- BWP: 10\n- BZD: 2\n- CAD: 0.7\n- CDF: 2,000\n- CHF: 0.5\n- CLP: 500\n- CNY: 5\n- COP: 2,000\n- CRC: 300\n- CVE: 50\n- CZK: 15\n- DJF: 100\n- DKK: 3.2\n- DOP: 40\n- DZD: 70\n- EGP: 30\n- ETB: 80\n- EUR: 0.5\n- FJD: 2\n- FKP: 1\n- GBP: 0.4\n- GEL: 2\n- GNF: 5,000\n- GIP: 1\n- GMD: 40\n- GTQ: 5\n- GYD: 200\n- HKD: 4\n- HNL: 20\n- HTG: 70\n- HUF: 175\n- IDR: 9,000\n- ILS: 1.5\n- INR: 60\n- ISK: 70\n- JMD: 80\n- JPY: 80\n- KES: 70\n- KGS: 50\n- KHR: 3,000\n- KMF: 500\n- KRW: 800\n- KYD: 1\n- KZT: 300\n- LAK: 20,000\n- LKR: 200\n- LRD: 100\n- LSL: 10\n- MAD: 5\n- MDL: 10\n- MGA: 3,000\n- MKD: 50\n- MNT: 2,000\n- MOP: 5\n- MUR: 50\n- MVR: 8\n- MXN: 9\n- MWK: 1,000\n- MYR: 2\n- MZN: 50\n- NAD: 10\n- NGN: 700\n- NIO: 20\n- NOK: 5\n- NPR: 80\n- NZD: 0.9\n- PAB: 1\n- PEN: 2\n- PGK: 3\n- PHP: 35\n- PKR: 200\n- PLN: 2\n- PYG: 4,000\n- QAR: 2\n- RON: 2.5\n- RSD: 60\n- RWF: 1,000\n- SAR: 2\n- SBD: 4\n- SCR: 8\n- SEK: 5\n- SGD: 0.7\n- SHP: 1\n- SOS: 500\n- SRD: 20\n- SZL: 10\n- THB: 20\n- TJS: 5\n- TOP: 2\n- TRY: 30\n- TTD: 4\n- TWD: 20\n- TZS: 2,000\n- UAH: 30\n- UGX: 2,000\n- UYU: 20\n- UZS: 7,000\n- VND: 20,000\n- VUV: 100\n- WST: 2\n- XAF: 500\n- XCD: 2\n- XCG: 1\n- XOF: 500\n- XPF: 100\n- YER: 200\n- ZAR: 9\n- ZMW: 10\n- Other currencies: 50 minor units"}},"type":"object","required":["amount_type","price_amount"],"title":"ProductPriceFixedCreate","description":"Schema to create a fixed price."},"ProductPriceMeter":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"name":{"type":"string","title":"Name","description":"The name of the meter."},"unit":{"$ref":"#/components/schemas/MeterUnit","description":"The unit of the meter."},"custom_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Label","description":"The label for the custom unit."},"custom_multiplier":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Custom Multiplier","description":"The multiplier to convert from base unit to display scale."}},"type":"object","required":["id","name","unit","custom_label","custom_multiplier"],"title":"ProductPriceMeter","description":"A meter associated to a metered price."},"ProductPriceMeteredUnit":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the price."},"source":{"$ref":"#/components/schemas/ProductPriceSource","description":"The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session."},"amount_type":{"type":"string","const":"metered_unit","title":"Amount Type"},"price_currency":{"type":"string","title":"Price Currency","description":"The currency in which the customer will be charged."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If null, it defaults to the organization's default tax behavior."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the price is archived and no longer available."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the product owning the price."},"unit_amount":{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$","title":"Unit Amount","description":"The price per unit in cents."},"cap_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cap Amount","description":"The maximum amount in cents that can be charged, regardless of the number of units consumed."},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter associated to the price."},"meter":{"$ref":"#/components/schemas/ProductPriceMeter","description":"The meter associated to the price."}},"type":"object","required":["created_at","modified_at","id","source","amount_type","price_currency","tax_behavior","is_archived","product_id","unit_amount","cap_amount","meter_id","meter"],"title":"ProductPriceMeteredUnit","description":"A metered, usage-based, price for a product, with a fixed unit price."},"ProductPriceMeteredUnitCreate":{"properties":{"amount_type":{"type":"string","const":"metered_unit","title":"Amount Type"},"price_currency":{"$ref":"#/components/schemas/PresentmentCurrency","description":"The currency in which the customer will be charged.","default":"usd"},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If not set, it will default to the organization's default tax behavior."},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter associated to the price."},"unit_amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"string","pattern":"^(?!^[-+.]*$)[+-]?0*(?:\\d{0,5}|(?=[\\d.]{1,18}0*$)\\d{0,5}\\.\\d{0,12}0*$)"}],"title":"Unit Amount","description":"The price per unit in cents. Supports up to 12 decimal places."},"cap_amount":{"anyOf":[{"type":"integer","maximum":2147483647.0,"minimum":0.0},{"type":"null"}],"title":"Cap Amount","description":"Optional maximum amount in cents that can be charged, regardless of the number of units consumed."}},"type":"object","required":["amount_type","meter_id","unit_amount"],"title":"ProductPriceMeteredUnitCreate","description":"Schema to create a metered price with a fixed unit price."},"ProductPriceSeatBased":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the price."},"source":{"$ref":"#/components/schemas/ProductPriceSource","description":"The source of the price . `catalog` is a predefined price, while `ad_hoc` is a price created dynamically on a Checkout session."},"amount_type":{"type":"string","const":"seat_based","title":"Amount Type"},"price_currency":{"type":"string","title":"Price Currency","description":"The currency in which the customer will be charged."},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If null, it defaults to the organization's default tax behavior."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether the price is archived and no longer available."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the product owning the price."},"seat_tiers":{"$ref":"#/components/schemas/ProductPriceSeatTiers-Output","description":"Tiered pricing based on seat quantity"}},"type":"object","required":["created_at","modified_at","id","source","amount_type","price_currency","tax_behavior","is_archived","product_id","seat_tiers"],"title":"ProductPriceSeatBased","description":"A seat-based price for a product."},"ProductPriceSeatBasedCreate":{"properties":{"amount_type":{"type":"string","const":"seat_based","title":"Amount Type"},"price_currency":{"$ref":"#/components/schemas/PresentmentCurrency","description":"The currency in which the customer will be charged.","default":"usd"},"tax_behavior":{"anyOf":[{"$ref":"#/components/schemas/TaxBehaviorOption"},{"type":"null"}],"description":"The tax behavior of the price. If not set, it will default to the organization's default tax behavior."},"seat_tiers":{"$ref":"#/components/schemas/ProductPriceSeatTiers-Input","description":"Tiered pricing based on seat quantity"}},"type":"object","required":["amount_type","seat_tiers"],"title":"ProductPriceSeatBasedCreate","description":"Schema to create a seat-based price with volume-based tiers."},"ProductPriceSeatTier":{"properties":{"min_seats":{"type":"integer","minimum":1.0,"title":"Min Seats","description":"Minimum number of seats (inclusive)"},"max_seats":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Max Seats","description":"Maximum number of seats (inclusive). None for unlimited."},"price_per_seat":{"type":"integer","minimum":0.0,"title":"Price Per Seat","description":"Price per seat in cents for this tier"}},"type":"object","required":["min_seats","price_per_seat"],"title":"ProductPriceSeatTier","description":"A pricing tier for seat-based pricing."},"ProductPriceSeatTiers-Input":{"properties":{"seat_tier_type":{"$ref":"#/components/schemas/SeatTierType","description":"How tiers are applied. 'volume' prices all seats at the matching tier's rate. 'graduated' prices each tier's range independently.","default":"volume"},"tiers":{"items":{"$ref":"#/components/schemas/ProductPriceSeatTier"},"type":"array","minItems":1,"title":"Tiers","description":"List of pricing tiers"}},"type":"object","required":["tiers"],"title":"ProductPriceSeatTiers","description":"List of pricing tiers for seat-based pricing.\n\nThe minimum and maximum seat limits are derived from the tiers:\n- minimum_seats = first tier's min_seats\n- maximum_seats = last tier's max_seats (None for unlimited)"},"ProductPriceSeatTiers-Output":{"properties":{"seat_tier_type":{"$ref":"#/components/schemas/SeatTierType","description":"How tiers are applied. 'volume' prices all seats at the matching tier's rate. 'graduated' prices each tier's range independently.","default":"volume"},"tiers":{"items":{"$ref":"#/components/schemas/ProductPriceSeatTier"},"type":"array","minItems":1,"title":"Tiers","description":"List of pricing tiers"},"minimum_seats":{"type":"integer","title":"Minimum Seats","description":"Minimum number of seats required for purchase, derived from first tier.","readOnly":true},"maximum_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Maximum Seats","description":"Maximum number of seats allowed for purchase, derived from last tier. None for unlimited.","readOnly":true}},"type":"object","required":["tiers","minimum_seats","maximum_seats"],"title":"ProductPriceSeatTiers","description":"List of pricing tiers for seat-based pricing.\n\nThe minimum and maximum seat limits are derived from the tiers:\n- minimum_seats = first tier's min_seats\n- maximum_seats = last tier's max_seats (None for unlimited)"},"ProductPriceSource":{"type":"string","enum":["catalog","ad_hoc"],"title":"ProductPriceSource"},"ProductPriceType":{"type":"string","enum":["one_time","recurring"],"title":"ProductPriceType"},"ProductSortProperty":{"type":"string","enum":["created_at","-created_at","name","-name","price_amount_type","-price_amount_type","price_amount","-price_amount"],"title":"ProductSortProperty"},"ProductUpdate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"trial_interval":{"anyOf":[{"$ref":"#/components/schemas/TrialInterval"},{"type":"null"}],"description":"The interval unit for the trial period."},"trial_interval_count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Trial Interval Count","description":"The number of interval units for the trial period."},"name":{"anyOf":[{"type":"string","maxLength":64,"minLength":3,"description":"The name of the product."},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"The description of the product."},"recurring_interval":{"anyOf":[{"$ref":"#/components/schemas/RecurringInterval"},{"type":"null"}],"description":"The recurring interval of the product. If `None`, the product is a one-time purchase. **Can only be set on legacy recurring products. Once set, it can't be changed.**"},"recurring_interval_count":{"anyOf":[{"type":"integer","maximum":999.0,"minimum":1.0},{"type":"null"}],"title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on. Once set, it can't be changed.**"},"is_archived":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Archived","description":"Whether the product is archived. If `true`, the product won't be available for purchase anymore. Existing customers will still have access to their benefits, and subscriptions will continue normally."},"visibility":{"anyOf":[{"$ref":"#/components/schemas/ProductVisibility"},{"type":"null"}],"description":"The visibility of the product."},"prices":{"anyOf":[{"items":{"anyOf":[{"$ref":"#/components/schemas/ExistingProductPrice"},{"oneOf":[{"$ref":"#/components/schemas/ProductPriceFixedCreate"},{"$ref":"#/components/schemas/ProductPriceCustomCreate"},{"$ref":"#/components/schemas/ProductPriceSeatBasedCreate"},{"$ref":"#/components/schemas/ProductPriceMeteredUnitCreate"}],"discriminator":{"propertyName":"amount_type","mapping":{"custom":"#/components/schemas/ProductPriceCustomCreate","fixed":"#/components/schemas/ProductPriceFixedCreate","metered_unit":"#/components/schemas/ProductPriceMeteredUnitCreate","seat_based":"#/components/schemas/ProductPriceSeatBasedCreate"}}}]},"type":"array"},{"type":"null"}],"title":"Prices","description":"List of available prices for this product. If you want to keep existing prices, include them in the list as an `ExistingProductPrice` object."},"medias":{"anyOf":[{"items":{"type":"string","format":"uuid4"},"type":"array"},{"type":"null"}],"title":"Medias","description":"List of file IDs. Each one must be on the same organization as the product, of type `product_media` and correctly uploaded."},"attached_custom_fields":{"anyOf":[{"items":{"$ref":"#/components/schemas/AttachedCustomFieldCreate"},"type":"array","description":"List of custom fields to attach."},{"type":"null"}],"title":"Attached Custom Fields"}},"type":"object","title":"ProductUpdate","description":"Schema to update a product."},"ProductVisibility":{"type":"string","enum":["draft","private","public"],"title":"Visibility"},"PropertyAggregation":{"properties":{"func":{"type":"string","enum":["sum","max","min","avg"],"title":"Func"},"property":{"type":"string","title":"Property"}},"type":"object","required":["func","property"],"title":"PropertyAggregation"},"RecurringInterval":{"type":"string","enum":["day","week","month","year"],"title":"RecurringInterval"},"Refund":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"status":{"$ref":"#/components/schemas/RefundStatus"},"reason":{"$ref":"#/components/schemas/RefundReason"},"amount":{"type":"integer","title":"Amount"},"tax_amount":{"type":"integer","title":"Tax Amount"},"currency":{"type":"string","title":"Currency"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"order_id":{"type":"string","format":"uuid4","title":"Order Id"},"subscription_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Subscription Id"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"revoke_benefits":{"type":"boolean","title":"Revoke Benefits"},"dispute":{"anyOf":[{"$ref":"#/components/schemas/RefundDispute"},{"type":"null"}]}},"type":"object","required":["created_at","modified_at","id","metadata","status","reason","amount","tax_amount","currency","organization_id","order_id","subscription_id","customer_id","revoke_benefits","dispute"],"title":"Refund"},"RefundCreate":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"order_id":{"type":"string","format":"uuid4","title":"Order Id"},"reason":{"type":"string","enum":["duplicate","fraudulent","customer_request","service_disruption","satisfaction_guarantee","other"],"title":"Reason","description":"Reason for the refund."},"amount":{"type":"integer","exclusiveMinimum":0.0,"title":"Amount","description":"Amount to refund in cents. Minimum is 1."},"comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Comment","description":"An internal comment about the refund."},"revoke_benefits":{"type":"boolean","title":"Revoke Benefits","description":"Should this refund trigger the associated customer benefits to be revoked?\n\n**Note:**\nOnly allowed in case the `order` is a one-time purchase.\nSubscriptions automatically revoke customer benefits once the\nsubscription itself is revoked, i.e fully canceled.","default":false}},"type":"object","required":["order_id","reason","amount"],"title":"RefundCreate"},"RefundDispute":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"status":{"$ref":"#/components/schemas/DisputeStatus","description":"Status of the dispute. `prevented` means we issued a refund before the dispute was escalated, avoiding any fees.","examples":["needs_response","prevented"]},"resolved":{"type":"boolean","title":"Resolved","description":"Whether the dispute has been resolved (won or lost).","examples":[false]},"closed":{"type":"boolean","title":"Closed","description":"Whether the dispute is closed (prevented, won, or lost).","examples":[false]},"amount":{"type":"integer","title":"Amount","description":"Amount in cents disputed.","examples":[1000]},"tax_amount":{"type":"integer","title":"Tax Amount","description":"Tax amount in cents disputed.","examples":[200]},"currency":{"type":"string","title":"Currency","description":"Currency code of the dispute.","examples":["usd"]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason","description":"The reason for the dispute as reported by the card network (e.g. `fraudulent`, `product_not_received`). `None` until the processor reports it.","examples":["fraudulent"]},"evidence_due_by":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Evidence Due By","description":"Deadline to submit evidence in response to the dispute. `None` when no response is required."},"past_due":{"type":"boolean","title":"Past Due","description":"Whether the evidence submission deadline has passed.","examples":[false]},"order_id":{"type":"string","format":"uuid4","title":"Order Id","description":"The ID of the order associated with the dispute.","examples":["57107b74-8400-4d80-a2fc-54c2b4239cb3"]},"payment_id":{"type":"string","format":"uuid4","title":"Payment Id","description":"The ID of the payment associated with the dispute.","examples":["42b94870-36b9-4573-96b6-b90b1c99a353"]}},"type":"object","required":["created_at","modified_at","id","status","resolved","closed","amount","tax_amount","currency","reason","evidence_due_by","past_due","order_id","payment_id"],"title":"RefundDispute","description":"Dispute associated with a refund,\nin case we prevented a dispute by issuing a refund."},"RefundReason":{"type":"string","enum":["duplicate","fraudulent","customer_request","service_disruption","satisfaction_guarantee","dispute_prevention","other"],"title":"RefundReason"},"RefundSortProperty":{"type":"string","enum":["created_at","-created_at","amount","-amount"],"title":"RefundSortProperty"},"RefundStatus":{"type":"string","enum":["pending","succeeded","failed","canceled"],"title":"RefundStatus"},"RefundedAlready":{"properties":{"error":{"type":"string","const":"RefundedAlready","title":"Error","examples":["RefundedAlready"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"RefundedAlready"},"ResourceNotFound":{"properties":{"error":{"type":"string","const":"ResourceNotFound","title":"Error","examples":["ResourceNotFound"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"ResourceNotFound"},"RevokeTokenResponse":{"properties":{},"type":"object","title":"RevokeTokenResponse"},"S3DownloadURL":{"properties":{"url":{"type":"string","title":"Url"},"headers":{"additionalProperties":{"type":"string"},"type":"object","title":"Headers","default":{}},"expires_at":{"type":"string","format":"date-time","title":"Expires At"}},"type":"object","required":["url","expires_at"],"title":"S3DownloadURL"},"S3FileCreateMultipart":{"properties":{"parts":{"items":{"$ref":"#/components/schemas/S3FileCreatePart"},"type":"array","maxItems":10000,"title":"Parts"}},"type":"object","required":["parts"],"title":"S3FileCreateMultipart"},"S3FileCreatePart":{"properties":{"number":{"type":"integer","title":"Number"},"chunk_start":{"type":"integer","title":"Chunk Start"},"chunk_end":{"type":"integer","title":"Chunk End"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"}},"type":"object","required":["number","chunk_start","chunk_end"],"title":"S3FileCreatePart"},"S3FileUploadCompletedPart":{"properties":{"number":{"type":"integer","title":"Number"},"checksum_etag":{"type":"string","title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"}},"type":"object","required":["number","checksum_etag","checksum_sha256_base64"],"title":"S3FileUploadCompletedPart"},"S3FileUploadMultipart":{"properties":{"id":{"type":"string","title":"Id"},"path":{"type":"string","title":"Path"},"parts":{"items":{"$ref":"#/components/schemas/S3FileUploadPart"},"type":"array","title":"Parts"}},"type":"object","required":["id","path","parts"],"title":"S3FileUploadMultipart"},"S3FileUploadPart":{"properties":{"number":{"type":"integer","title":"Number"},"chunk_start":{"type":"integer","title":"Chunk Start"},"chunk_end":{"type":"integer","title":"Chunk End"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"url":{"type":"string","title":"Url"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"headers":{"additionalProperties":{"type":"string"},"type":"object","title":"Headers","default":{}}},"type":"object","required":["number","chunk_start","chunk_end","url","expires_at"],"title":"S3FileUploadPart"},"SSOEnforcementRequiresConnection":{"properties":{"error":{"type":"string","const":"SSOEnforcementRequiresConnection","title":"Error","examples":["SSOEnforcementRequiresConnection"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"SSOEnforcementRequiresConnection"},"Scope":{"type":"string","enum":["openid","profile","email","user:read","user:write","organizations:read","organizations:write","custom_fields:read","custom_fields:write","discounts:read","discounts:write","checkout_links:read","checkout_links:write","checkouts:read","checkouts:write","transactions:read","transactions:write","payouts:read","payouts:write","products:read","products:write","benefits:read","benefits:write","events:read","events:write","meters:read","meters:write","files:read","files:write","subscriptions:read","subscriptions:write","customers:read","customers:write","members:read","members:write","wallets:read","wallets:write","disputes:read","disputes:write","customer_meters:read","customer_sessions:write","member_sessions:write","customer_seats:read","customer_seats:write","orders:read","orders:write","refunds:read","refunds:write","payments:read","metrics:read","metrics:write","webhooks:read","webhooks:write","license_keys:read","license_keys:write","customer_portal:read","customer_portal:write","notifications:read","notifications:write","notification_recipients:read","notification_recipients:write","organization_access_tokens:read","organization_access_tokens:write"],"title":"Scope","enumNames":{"benefits:read":"Read benefits","benefits:write":"Create or modify benefits","checkout_links:read":"Read checkout links","checkout_links:write":"Create or modify checkout links","checkouts:read":"Read checkout sessions","checkouts:write":"Create or modify checkout sessions","custom_fields:read":"Read custom fields","custom_fields:write":"Create or modify custom fields","customer_meters:read":"Read customer meters","customer_portal:read":"Read your orders, subscriptions and benefits","customer_portal:write":"Create or modify your orders, subscriptions and benefits","customer_seats:read":"Read customer seats","customer_seats:write":"Create or modify customer seats","customer_sessions:write":"Create or modify customer sessions","customers:read":"Read customers","customers:write":"Create or modify customers","discounts:read":"Read discounts","discounts:write":"Create or modify discounts","disputes:read":"Read disputes","disputes:write":"Create or modify disputes","email":"Read your email address","events:read":"Read events","events:write":"Create events","files:read":"Read file uploads","files:write":"Create or modify file uploads","license_keys:read":"Read license keys","license_keys:write":"Modify license keys","member_sessions:write":"Create or modify member sessions","members:read":"Read members","members:write":"Create or modify members","meters:read":"Read meters","meters:write":"Create or modify meters","metrics:read":"Read metrics","metrics:write":"Create or modify metric definitions","notification_recipients:read":"Read notification recipients","notification_recipients:write":"Create or modify notification recipients","notifications:read":"Read notifications","notifications:write":"Mark notifications as read","openid":"OpenID","orders:read":"Read orders made on your organizations","orders:write":"Modify orders made on your organizations","organization_access_tokens:read":"Read organization access tokens","organization_access_tokens:write":"Create or modify organization access tokens","organizations:read":"Read your organizations","organizations:write":"Create or modify organizations","payments:read":"Read payments made on your organizations","payouts:read":"Read payouts","payouts:write":"Create or modify payouts","products:read":"Read products","products:write":"Create or modify products","profile":"Read your profile","refunds:read":"Read refunds made on your organizations","refunds:write":"Create or modify refunds","subscriptions:read":"Read subscriptions made on your organizations","subscriptions:write":"Create or modify subscriptions made on your organizations","transactions:read":"Read transactions","transactions:write":"Create or modify transactions","user:read":"Read your user account","user:write":"Manage your user account","wallets:read":"Read wallets","wallets:write":"Create or modify wallets","webhooks:read":"Read webhooks","webhooks:write":"Create or modify webhooks"}},"SeatAssign":{"properties":{"subscription_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Subscription Id","description":"Subscription ID. Required if neither order_id nor checkout_id is provided."},"order_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Order Id","description":"Order ID for one-time purchases. Required if subscription_id is not provided."},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"Email of the customer to assign the seat to"},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"External customer ID for the seat assignment"},"customer_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Customer Id","description":"Customer ID for the seat assignment"},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"External member ID for the seat assignment. Can be used alone (lookup existing member) or with email (create/validate member)."},"member_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Member Id","description":"Member ID for the seat assignment."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata for the seat (max 10 keys, 1KB total)"},"immediate_claim":{"type":"boolean","title":"Immediate Claim","description":"If true, the seat will be immediately claimed without sending an invitation email. API-only feature.","default":false}},"type":"object","title":"SeatAssign"},"SeatClaim":{"properties":{"invitation_token":{"type":"string","title":"Invitation Token","description":"Invitation token to claim the seat"}},"type":"object","required":["invitation_token"],"title":"SeatClaim"},"SeatClaimInfo":{"properties":{"product_name":{"type":"string","title":"Product Name","description":"Name of the product"},"product_id":{"type":"string","format":"uuid","title":"Product Id","description":"ID of the product"},"organization_name":{"type":"string","title":"Organization Name","description":"Name of the organization"},"organization_slug":{"type":"string","title":"Organization Slug","description":"Slug of the organization"},"customer_email":{"type":"string","title":"Customer Email","description":"Email of the customer assigned to this seat"},"can_claim":{"type":"boolean","title":"Can Claim","description":"Whether the seat can be claimed"}},"type":"object","required":["product_name","product_id","organization_name","organization_slug","customer_email","can_claim"],"title":"SeatClaimInfo","description":"Read-only information about a seat claim invitation.\nSafe for email scanners - no side effects when fetched."},"SeatStatus":{"type":"string","enum":["pending","claimed","revoked"],"title":"SeatStatus"},"SeatTierType":{"type":"string","enum":["volume","graduated"],"title":"SeatTierType"},"SeatsList":{"properties":{"seats":{"items":{"$ref":"#/components/schemas/CustomerSeat"},"type":"array","title":"Seats","description":"List of seats"},"available_seats":{"type":"integer","title":"Available Seats","description":"Number of available seats"},"total_seats":{"type":"integer","title":"Total Seats","description":"Total number of seats for the subscription"}},"type":"object","required":["seats","available_seats","total_seats"],"title":"SeatsList"},"SubType":{"type":"string","enum":["user","organization"],"title":"SubType"},"Subscription":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"amount":{"type":"integer","title":"Amount","description":"The amount of the subscription.","examples":[10000]},"currency":{"type":"string","title":"Currency","description":"The currency of the subscription.","examples":["usd"]},"recurring_interval":{"$ref":"#/components/schemas/RecurringInterval","description":"The interval at which the subscription recurs.","examples":["month"]},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count","description":"Number of interval units of the subscription. If this is set to 1 the charge will happen every interval (e.g. every month), if set to 2 it will be every other month, and so on."},"status":{"$ref":"#/components/schemas/SubscriptionStatus","description":"The status of the subscription.","examples":["active"]},"current_period_start":{"type":"string","format":"date-time","title":"Current Period Start","description":"The start timestamp of the current billing period."},"current_period_end":{"type":"string","format":"date-time","title":"Current Period End","description":"The end timestamp of the current billing period."},"current_meter_period_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period Start","description":"The start timestamp of the current meter period, if the product has a meter cycle set. Metered credits are granted and overage is settled on this cadence."},"current_meter_period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Meter Period End","description":"The end timestamp of the current meter period, if the product has a meter cycle set. This is when credits next renew."},"trial_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Start","description":"The start timestamp of the trial period, if any."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial End","description":"The end timestamp of the trial period, if any."},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","description":"Whether the subscription will be canceled at the end of the current period."},"canceled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Canceled At","description":"The timestamp when the subscription was canceled. The subscription might still be active if `cancel_at_period_end` is `true`."},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At","description":"The timestamp when the subscription started."},"ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ends At","description":"The timestamp when the subscription will end."},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At","description":"The timestamp when the subscription ended."},"past_due_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Past Due At","description":"The timestamp when the subscription entered `past_due` status."},"pause_at_period_end":{"type":"boolean","title":"Pause At Period End","description":"Whether the subscription will be paused at the end of the current period."},"paused_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paused At","description":"The timestamp when the subscription was paused."},"resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resumes At","description":"The timestamp when a paused subscription is scheduled to automatically resume, if set."},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the subscribed customer."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the subscribed product."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"The ID of the applied discount, if any."},"checkout_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Checkout Id"},"seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seats","description":"The number of seats for seat-based subscriptions. None for non-seat subscriptions."},"customer_cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}]},"customer_cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Cancellation Comment"},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"custom_field_data":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"string","format":"date-time"},{"type":"null"}]},"type":"object","title":"Custom Field Data","description":"Key-value object storing custom field values."},"customer":{"$ref":"#/components/schemas/SubscriptionCustomer"},"product":{"$ref":"#/components/schemas/Product"},"discount":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/DiscountFixedOnceForeverDurationBase"},{"$ref":"#/components/schemas/DiscountFixedRepeatDurationBase"},{"$ref":"#/components/schemas/DiscountPercentageOnceForeverDurationBase"},{"$ref":"#/components/schemas/DiscountPercentageRepeatDurationBase"}],"title":"SubscriptionDiscount"},{"type":"null"}],"title":"Discount"},"prices":{"items":{"oneOf":[{"$ref":"#/components/schemas/LegacyRecurringProductPrice"},{"$ref":"#/components/schemas/ProductPrice"}]},"type":"array","title":"Prices","description":"List of enabled prices for the subscription."},"meters":{"items":{"$ref":"#/components/schemas/SubscriptionMeter"},"type":"array","title":"Meters","description":"List of meters associated with the subscription."},"pending_update":{"anyOf":[{"$ref":"#/components/schemas/PendingSubscriptionUpdate"},{"type":"null"}],"description":"Pending subscription update that will be applied at the beginning of the next period. If `null`, there is no pending update."}},"type":"object","required":["created_at","modified_at","id","amount","currency","recurring_interval","recurring_interval_count","status","current_period_start","current_period_end","current_meter_period_start","current_meter_period_end","trial_start","trial_end","cancel_at_period_end","canceled_at","started_at","ends_at","ended_at","pause_at_period_end","paused_at","resumes_at","customer_id","product_id","discount_id","checkout_id","customer_cancellation_reason","customer_cancellation_comment","metadata","customer","product","discount","prices","meters","pending_update"],"title":"Subscription"},"SubscriptionBillingPeriodUpdatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.billing_period_updated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionBillingPeriodUpdatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionBillingPeriodUpdatedEvent","description":"An event created by Polar when a subscription billing period is updated."},"SubscriptionBillingPeriodUpdatedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"old_period_end":{"type":"string","title":"Old Period End"},"new_period_end":{"type":"string","title":"New Period End"}},"type":"object","required":["subscription_id","old_period_end","new_period_end"],"title":"SubscriptionBillingPeriodUpdatedMetadata"},"SubscriptionCancel":{"properties":{"customer_cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}],"description":"Customer reason for cancellation.\n\nHelpful to monitor reasons behind churn for future improvements.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you know based on direct conversations, i.e support, with\nthe customer.\n\n* `too_expensive`: Too expensive for the customer.\n* `missing_features`: Customer is missing certain features.\n* `switched_service`: Customer switched to another service.\n* `unused`: Customer is not using it enough.\n* `customer_service`: Customer is not satisfied with the customer service.\n* `low_quality`: Customer is unhappy with the quality.\n* `too_complex`: Customer considers the service too complicated.\n* `other`: Other reason(s)."},"customer_cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Cancellation Comment","description":"Customer feedback and why they decided to cancel.\n\n**IMPORTANT:**\nDo not use this to store internal notes! It's intended to be input\nfrom the customer and is therefore also available in their Polar\npurchases library.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you copy a message directly from a customer\nconversation, i.e support."},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","description":"Cancel an active subscription once the current period ends.\n\nOr uncancel a subscription currently set to be revoked at period end."}},"additionalProperties":false,"type":"object","required":["cancel_at_period_end"],"title":"SubscriptionCancel"},"SubscriptionCanceledEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.canceled","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionCanceledMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionCanceledEvent","description":"An event created by Polar when a subscription is canceled."},"SubscriptionCanceledMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"},"customer_cancellation_reason":{"type":"string","title":"Customer Cancellation Reason"},"customer_cancellation_comment":{"type":"string","title":"Customer Cancellation Comment"},"canceled_at":{"type":"string","title":"Canceled At"},"ends_at":{"type":"string","title":"Ends At"},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End"}},"type":"object","required":["subscription_id","amount","currency","recurring_interval","recurring_interval_count","canceled_at"],"title":"SubscriptionCanceledMetadata"},"SubscriptionCreateCustomer":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.","examples":["d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23"]},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id","description":"The ID of the customer to create the subscription for.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]}},"type":"object","required":["product_id","customer_id"],"title":"SubscriptionCreateCustomer","description":"Create a subscription for an existing customer."},"SubscriptionCreateExternalCustomer":{"properties":{"metadata":{"additionalProperties":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"integer"},{"type":"number"},{"type":"boolean"}]},"propertyNames":{"maxLength":40,"minLength":1},"type":"object","maxProperties":50,"title":"Metadata","description":"Key-value object allowing you to store additional information.\n\nThe key must be a string with a maximum length of **40 characters**.\nThe value must be either:\n\n* A string with a maximum length of **500 characters**\n* An integer\n* A floating-point number\n* A boolean\n\nYou can store up to **50 key-value pairs**."},"product_id":{"type":"string","format":"uuid4","title":"Product Id","description":"The ID of the recurring product to subscribe to. Must be a free product, otherwise the customer should go through a checkout flow.","examples":["d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23"]},"external_customer_id":{"type":"string","title":"External Customer Id","description":"The ID of the customer in your system to create the subscription for. It must already exist in Polar."}},"type":"object","required":["product_id","external_customer_id"],"title":"SubscriptionCreateExternalCustomer","description":"Create a subscription for an existing customer identified by an external ID."},"SubscriptionCreatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.created","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionCreatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionCreatedEvent","description":"An event created by Polar when a subscription is created."},"SubscriptionCreatedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"},"started_at":{"type":"string","title":"Started At"}},"type":"object","required":["subscription_id","product_id","amount","currency","recurring_interval","recurring_interval_count","started_at"],"title":"SubscriptionCreatedMetadata"},"SubscriptionCustomer":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the customer.","examples":["992fae2a-2a17-4b7a-8d9e-e287cf90131b"]},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"metadata":{"$ref":"#/components/schemas/MetadataOutputType"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id","description":"The ID of the customer in your system. This must be unique within the organization. Once set, it can't be updated.","examples":["usr_1337"]},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"The email address of the customer. This must be unique within the organization.","examples":["customer@example.com"]},"email_verified":{"type":"boolean","title":"Email Verified","description":"Whether the customer email address is verified. The address is automatically verified when the customer accesses the customer portal using their email address.","examples":[true]},"type":{"$ref":"#/components/schemas/CustomerType","description":"The type of customer: 'individual' for single users, 'team' for customers with multiple members.","examples":["individual"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"The name of the customer.","examples":["John Doe"]},"billing_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Name","description":"The name that should appear on the customer's invoices. Falls back to the customer name when not explicitly set.","examples":["John Doe"]},"billing_address":{"anyOf":[{"$ref":"#/components/schemas/Address"},{"type":"null"}]},"tax_id":{"anyOf":[{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/TaxIDFormat"}],"type":"array","maxItems":2,"minItems":2,"examples":[["911144442","us_ein"],["FR61954506077","eu_vat"]]},{"type":"null"}],"title":"Tax Id"},"locale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locale"},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the customer.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"default_payment_method_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Default Payment Method Id","description":"The ID of the customer's default payment method, if any. Use the payment methods endpoint to retrieve its details."},"deleted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Deleted At","description":"Timestamp for when the customer was soft deleted."},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url","examples":["https://www.gravatar.com/avatar/xxx?d=404"]}},"type":"object","required":["id","created_at","modified_at","metadata","email_verified","type","name","billing_name","billing_address","tax_id","organization_id","deleted_at","avatar_url"],"title":"SubscriptionCustomer"},"SubscriptionCycledEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.cycled","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionCycledMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionCycledEvent","description":"An event created by Polar when a subscription is cycled."},"SubscriptionCycledMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["subscription_id"],"title":"SubscriptionCycledMetadata"},"SubscriptionLocked":{"properties":{"error":{"type":"string","const":"SubscriptionLocked","title":"Error","examples":["SubscriptionLocked"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"SubscriptionLocked"},"SubscriptionMeter":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"consumed_units":{"type":"number","title":"Consumed Units","description":"The number of consumed units so far in this billing period.","examples":[25.0]},"credited_units":{"type":"integer","title":"Credited Units","description":"The number of credited units so far in this billing period.","examples":[100]},"amount":{"type":"integer","title":"Amount","description":"The amount due in cents so far in this billing period.","examples":[0]},"meter_id":{"type":"string","format":"uuid4","title":"Meter Id","description":"The ID of the meter.","examples":["d498a884-e2cd-4d3e-8002-f536468a8b22"]},"meter":{"$ref":"#/components/schemas/Meter","description":"The meter associated with this subscription."}},"type":"object","required":["created_at","modified_at","id","consumed_units","credited_units","amount","meter_id","meter"],"title":"SubscriptionMeter","description":"Current consumption and spending for a subscription meter."},"SubscriptionPastDueEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.past_due","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionPastDueMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionPastDueEvent","description":"An event created by Polar when a subscription becomes past due."},"SubscriptionPastDueMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"past_due_at":{"type":"string","title":"Past Due At"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["subscription_id","past_due_at"],"title":"SubscriptionPastDueMetadata"},"SubscriptionPause":{"properties":{"pause_at_period_end":{"type":"boolean","title":"Pause At Period End","description":"Pause an active subscription at the end of the current period.\n\nOr cancel a scheduled pause on a subscription set to be paused at\nperiod end."},"resumes_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resumes At","description":"Date at which the paused subscription should automatically resume.\n\nIf not set, the subscription stays paused until it is resumed manually.\nMust be after the current period end."}},"additionalProperties":false,"type":"object","required":["pause_at_period_end"],"title":"SubscriptionPause"},"SubscriptionPausedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.paused","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionPausedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionPausedEvent","description":"An event created by Polar when a subscription is paused."},"SubscriptionPausedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"},"paused_at":{"type":"string","title":"Paused At"},"resumes_at":{"type":"string","title":"Resumes At"}},"type":"object","required":["subscription_id","paused_at"],"title":"SubscriptionPausedMetadata"},"SubscriptionProductUpdatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.product_updated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionProductUpdatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionProductUpdatedEvent","description":"An event created by Polar when a subscription changes the product."},"SubscriptionProductUpdatedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"old_product_id":{"type":"string","title":"Old Product Id"},"new_product_id":{"type":"string","title":"New Product Id"}},"type":"object","required":["subscription_id","old_product_id","new_product_id"],"title":"SubscriptionProductUpdatedMetadata"},"SubscriptionProrationBehavior":{"type":"string","enum":["invoice","prorate","next_period","reset"],"title":"SubscriptionProrationBehavior"},"SubscriptionReactivatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.reactivated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionReactivatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionReactivatedEvent","description":"An event created by Polar when a past due subscription is recovered."},"SubscriptionReactivatedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["subscription_id"],"title":"SubscriptionReactivatedMetadata"},"SubscriptionResume":{"properties":{"resume":{"type":"boolean","const":true,"title":"Resume","description":"Resume a paused subscription immediately, starting a new billing period and charging the customer."}},"additionalProperties":false,"type":"object","required":["resume"],"title":"SubscriptionResume"},"SubscriptionResumedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.resumed","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionResumedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionResumedEvent","description":"An event created by Polar when a paused subscription is resumed."},"SubscriptionResumedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["subscription_id"],"title":"SubscriptionResumedMetadata"},"SubscriptionRevoke":{"properties":{"customer_cancellation_reason":{"anyOf":[{"$ref":"#/components/schemas/CustomerCancellationReason"},{"type":"null"}],"description":"Customer reason for cancellation.\n\nHelpful to monitor reasons behind churn for future improvements.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you know based on direct conversations, i.e support, with\nthe customer.\n\n* `too_expensive`: Too expensive for the customer.\n* `missing_features`: Customer is missing certain features.\n* `switched_service`: Customer switched to another service.\n* `unused`: Customer is not using it enough.\n* `customer_service`: Customer is not satisfied with the customer service.\n* `low_quality`: Customer is unhappy with the quality.\n* `too_complex`: Customer considers the service too complicated.\n* `other`: Other reason(s)."},"customer_cancellation_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Cancellation Comment","description":"Customer feedback and why they decided to cancel.\n\n**IMPORTANT:**\nDo not use this to store internal notes! It's intended to be input\nfrom the customer and is therefore also available in their Polar\npurchases library.\n\nOnly set this in case your own service is requesting the reason from the\ncustomer. Or you copy a message directly from a customer\nconversation, i.e support."},"revoke":{"type":"boolean","const":true,"title":"Revoke","description":"Cancel and revoke an active subscription immediately"}},"additionalProperties":false,"type":"object","required":["revoke"],"title":"SubscriptionRevoke"},"SubscriptionRevokedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.revoked","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionRevokedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionRevokedEvent","description":"An event created by Polar when a subscription is revoked from a customer."},"SubscriptionRevokedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["subscription_id"],"title":"SubscriptionRevokedMetadata"},"SubscriptionSeatsUpdatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.seats_updated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionSeatsUpdatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionSeatsUpdatedEvent","description":"An event created by Polar when a the seats on a subscription is changed."},"SubscriptionSeatsUpdatedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"old_seats":{"type":"integer","title":"Old Seats"},"new_seats":{"type":"integer","title":"New Seats"},"proration_behavior":{"type":"string","title":"Proration Behavior"}},"type":"object","required":["subscription_id","old_seats","new_seats","proration_behavior"],"title":"SubscriptionSeatsUpdatedMetadata"},"SubscriptionSortProperty":{"type":"string","enum":["customer","-customer","status","-status","started_at","-started_at","current_period_end","-current_period_end","ended_at","-ended_at","ends_at","-ends_at","amount","-amount","product","-product","discount","-discount"],"title":"SubscriptionSortProperty"},"SubscriptionStatus":{"type":"string","enum":["incomplete","incomplete_expired","trialing","active","past_due","canceled","unpaid","paused"],"title":"SubscriptionStatus"},"SubscriptionUncanceledEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.uncanceled","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionUncanceledMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionUncanceledEvent","description":"An event created by Polar when a subscription cancellation is reversed."},"SubscriptionUncanceledMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"},"product_id":{"type":"string","title":"Product Id"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"recurring_interval":{"type":"string","title":"Recurring Interval"},"recurring_interval_count":{"type":"integer","title":"Recurring Interval Count"}},"type":"object","required":["subscription_id","product_id","amount","currency","recurring_interval","recurring_interval_count"],"title":"SubscriptionUncanceledMetadata"},"SubscriptionUpdate":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionUpdateBase"},{"$ref":"#/components/schemas/SubscriptionUpdateSeats"},{"$ref":"#/components/schemas/SubscriptionUpdateBillingPeriod"},{"$ref":"#/components/schemas/SubscriptionCancel"},{"$ref":"#/components/schemas/SubscriptionRevoke"},{"$ref":"#/components/schemas/SubscriptionPause"},{"$ref":"#/components/schemas/SubscriptionResume"},{"$ref":"#/components/schemas/SubscriptionUpdateClear"}]},"SubscriptionUpdateBase":{"properties":{"product_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Product Id","description":"Update subscription to another product.","examples":["d8dd2de1-21b7-4a41-8bc3-ce909c0cfe23"]},"proration_behavior":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionProrationBehavior"},{"type":"null"}],"description":"Determine how to handle the proration billing. If not provided, will use the default organization setting."},"discount_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Discount Id","description":"Update the subscription to apply a new discount. If set to `null`, the discount will be removed. The change will be applied on the next billing cycle."},"trial_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string","const":"now"},{"type":"null"}],"title":"Trial End","description":"Set or extend the trial period of the subscription. If set to `now`, the trial will end immediately."}},"additionalProperties":false,"type":"object","title":"SubscriptionUpdateBase"},"SubscriptionUpdateBillingPeriod":{"properties":{"current_billing_period_end":{"type":"string","format":"date-time","title":"Current Billing Period End","description":"Set a new date for the end of the current billing period. The subscription will renew on this date. The new date can be earlier or later than the current period end, as long as it's in the future.\n\nIt is not possible to update the current billing period on a canceled subscription."}},"additionalProperties":false,"type":"object","required":["current_billing_period_end"],"title":"SubscriptionUpdateBillingPeriod"},"SubscriptionUpdateClear":{"properties":{"pending_update":{"type":"null","title":"Pending Update","description":"Clear the pending subscription update. Set to null to remove scheduled changes."}},"additionalProperties":false,"type":"object","required":["pending_update"],"title":"SubscriptionUpdateClear"},"SubscriptionUpdateClearedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.update_cleared","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionUpdateClearedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionUpdateClearedEvent","description":"An event created by Polar when a pending subscription update is cleared without being applied."},"SubscriptionUpdateClearedMetadata":{"properties":{"subscription_id":{"type":"string","title":"Subscription Id"}},"type":"object","required":["subscription_id"],"title":"SubscriptionUpdateClearedMetadata"},"SubscriptionUpdateSeats":{"properties":{"seats":{"type":"integer","maximum":2147483647.0,"minimum":-2147483648.0,"title":"Seats","description":"Update the number of seats for this subscription."},"proration_behavior":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionProrationBehavior"},{"type":"null"}],"description":"Determine how to handle the proration billing. If not provided, will use the default organization setting."}},"additionalProperties":false,"type":"object","required":["seats"],"title":"SubscriptionUpdateSeats"},"SubscriptionUpdatedEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"source":{"type":"string","const":"system","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"name":{"type":"string","const":"subscription.updated","title":"Name","description":"The name of the event."},"metadata":{"$ref":"#/components/schemas/SubscriptionUpdatedMetadata"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","source","name","metadata"],"title":"SubscriptionUpdatedEvent","description":"An event created by Polar when a subscription is updated."},"SubscriptionUpdatedMetadata":{"properties":{"product_id":{"type":"string","title":"Product Id"},"proration_behavior":{"$ref":"#/components/schemas/SubscriptionProrationBehavior"},"discount_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discount Id"},"trial_end":{"type":"string","title":"Trial End"},"seats":{"type":"integer","title":"Seats"},"billing_period_end":{"type":"string","title":"Billing Period End"},"subscription_id":{"type":"string","title":"Subscription Id"}},"type":"object","required":["subscription_id"],"title":"SubscriptionUpdatedMetadata"},"SubscriptionUser":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"public_name":{"type":"string","title":"Public Name"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"},"github_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Github Username"}},"type":"object","required":["id","public_name"],"title":"SubscriptionUser"},"SupportCaseAttachmentFileCreate":{"properties":{"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id"},"name":{"type":"string","title":"Name"},"mime_type":{"type":"string","pattern":"^(image\\/(jpeg|png|gif|webp)|video\\/(mp4|quicktime|webm)|application\\/pdf|text\\/(csv|plain)|application\\/msword|application\\/vnd\\.openxmlformats-officedocument\\.wordprocessingml\\.document|application\\/vnd\\.ms-excel|application\\/vnd\\.openxmlformats-officedocument\\.spreadsheetml\\.sheet)$","title":"Mime Type","description":"MIME type of the file. Images, videos, PDF, CSV, plain text, Word and Excel documents are supported."},"size":{"type":"integer","maximum":262144000.0,"title":"Size","description":"Size of the file. A maximum of 250 MB is allowed for this type of file."},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"upload":{"$ref":"#/components/schemas/S3FileCreateMultipart"},"service":{"type":"string","const":"support_case_attachment","title":"Service"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"}},"type":"object","required":["name","mime_type","size","upload","service"],"title":"SupportCaseAttachmentFileCreate","description":"Schema to create a file attached to a support case."},"SupportCaseAttachmentFileRead":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"name":{"type":"string","title":"Name"},"path":{"type":"string","title":"Path"},"mime_type":{"type":"string","title":"Mime Type"},"size":{"type":"integer","title":"Size"},"storage_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Storage Version"},"checksum_etag":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Etag"},"checksum_sha256_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Base64"},"checksum_sha256_hex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checksum Sha256 Hex"},"last_modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Modified At"},"version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Version"},"service":{"type":"string","const":"support_case_attachment","title":"Service"},"is_uploaded":{"type":"boolean","title":"Is Uploaded"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"size_readable":{"type":"string","title":"Size Readable","readOnly":true}},"type":"object","required":["id","organization_id","name","path","mime_type","size","storage_version","checksum_etag","checksum_sha256_base64","checksum_sha256_hex","last_modified_at","version","service","is_uploaded","created_at","size_readable"],"title":"SupportCaseAttachmentFileRead","description":"File attached to a support case (private; fetched via presigned URL)."},"SystemEvent":{"oneOf":[{"$ref":"#/components/schemas/MeterCreditEvent"},{"$ref":"#/components/schemas/MeterResetEvent"},{"$ref":"#/components/schemas/BenefitGrantedEvent"},{"$ref":"#/components/schemas/BenefitCycledEvent"},{"$ref":"#/components/schemas/BenefitUpdatedEvent"},{"$ref":"#/components/schemas/BenefitRevokedEvent"},{"$ref":"#/components/schemas/SubscriptionCreatedEvent"},{"$ref":"#/components/schemas/SubscriptionUpdatedEvent"},{"$ref":"#/components/schemas/SubscriptionCycledEvent"},{"$ref":"#/components/schemas/SubscriptionCanceledEvent"},{"$ref":"#/components/schemas/SubscriptionRevokedEvent"},{"$ref":"#/components/schemas/SubscriptionPastDueEvent"},{"$ref":"#/components/schemas/SubscriptionReactivatedEvent"},{"$ref":"#/components/schemas/SubscriptionPausedEvent"},{"$ref":"#/components/schemas/SubscriptionResumedEvent"},{"$ref":"#/components/schemas/SubscriptionUncanceledEvent"},{"$ref":"#/components/schemas/SubscriptionProductUpdatedEvent"},{"$ref":"#/components/schemas/SubscriptionSeatsUpdatedEvent"},{"$ref":"#/components/schemas/SubscriptionBillingPeriodUpdatedEvent"},{"$ref":"#/components/schemas/SubscriptionUpdateClearedEvent"},{"$ref":"#/components/schemas/OrderPaidEvent"},{"$ref":"#/components/schemas/OrderRefundedEvent"},{"$ref":"#/components/schemas/OrderVoidedEvent"},{"$ref":"#/components/schemas/CheckoutCreatedEvent"},{"$ref":"#/components/schemas/CustomerCreatedEvent"},{"$ref":"#/components/schemas/CustomerUpdatedEvent"},{"$ref":"#/components/schemas/CustomerDeletedEvent"},{"$ref":"#/components/schemas/BalanceOrderEvent"},{"$ref":"#/components/schemas/BalanceCreditOrderEvent"},{"$ref":"#/components/schemas/BalanceRefundEvent"},{"$ref":"#/components/schemas/BalanceRefundReversalEvent"},{"$ref":"#/components/schemas/BalanceDisputeEvent"},{"$ref":"#/components/schemas/BalanceDisputeReversalEvent"}],"discriminator":{"propertyName":"name","mapping":{"balance.credit_order":"#/components/schemas/BalanceCreditOrderEvent","balance.dispute":"#/components/schemas/BalanceDisputeEvent","balance.dispute_reversal":"#/components/schemas/BalanceDisputeReversalEvent","balance.order":"#/components/schemas/BalanceOrderEvent","balance.refund":"#/components/schemas/BalanceRefundEvent","balance.refund_reversal":"#/components/schemas/BalanceRefundReversalEvent","benefit.cycled":"#/components/schemas/BenefitCycledEvent","benefit.granted":"#/components/schemas/BenefitGrantedEvent","benefit.revoked":"#/components/schemas/BenefitRevokedEvent","benefit.updated":"#/components/schemas/BenefitUpdatedEvent","checkout.created":"#/components/schemas/CheckoutCreatedEvent","customer.created":"#/components/schemas/CustomerCreatedEvent","customer.deleted":"#/components/schemas/CustomerDeletedEvent","customer.updated":"#/components/schemas/CustomerUpdatedEvent","meter.credited":"#/components/schemas/MeterCreditEvent","meter.reset":"#/components/schemas/MeterResetEvent","order.paid":"#/components/schemas/OrderPaidEvent","order.refunded":"#/components/schemas/OrderRefundedEvent","order.voided":"#/components/schemas/OrderVoidedEvent","subscription.billing_period_updated":"#/components/schemas/SubscriptionBillingPeriodUpdatedEvent","subscription.canceled":"#/components/schemas/SubscriptionCanceledEvent","subscription.created":"#/components/schemas/SubscriptionCreatedEvent","subscription.cycled":"#/components/schemas/SubscriptionCycledEvent","subscription.past_due":"#/components/schemas/SubscriptionPastDueEvent","subscription.paused":"#/components/schemas/SubscriptionPausedEvent","subscription.product_updated":"#/components/schemas/SubscriptionProductUpdatedEvent","subscription.reactivated":"#/components/schemas/SubscriptionReactivatedEvent","subscription.resumed":"#/components/schemas/SubscriptionResumedEvent","subscription.revoked":"#/components/schemas/SubscriptionRevokedEvent","subscription.seats_updated":"#/components/schemas/SubscriptionSeatsUpdatedEvent","subscription.uncanceled":"#/components/schemas/SubscriptionUncanceledEvent","subscription.update_cleared":"#/components/schemas/SubscriptionUpdateClearedEvent","subscription.updated":"#/components/schemas/SubscriptionUpdatedEvent"}}},"TaxBehavior":{"type":"string","enum":["inclusive","exclusive"],"title":"TaxBehavior"},"TaxBehaviorOption":{"type":"string","enum":["location","inclusive","exclusive"],"title":"TaxBehaviorOption"},"TaxIDFormat":{"type":"string","enum":["ad_nrt","ae_trn","ar_cuit","au_abn","au_arn","bg_uic","bh_vat","bo_tin","br_cnpj","br_cpf","ca_bn","ca_gst_hst","ca_pst_bc","ca_pst_mb","ca_pst_sk","ca_qst","ch_uid","ch_vat","cl_tin","cn_tin","co_nit","cr_tin","de_stn","do_rcn","ec_ruc","eg_tin","es_cif","eu_oss_vat","eu_vat","gb_vat","ge_vat","hk_br","hr_oib","hu_tin","id_npwp","il_vat","in_gst","is_vat","jp_cn","jp_rn","jp_trn","ke_pin","kr_brn","kz_bin","li_uid","mk_vat","mx_rfc","my_frp","my_itn","my_sst","ng_tin","no_vat","no_voec","nz_gst","om_vat","pe_ruc","ph_tin","ro_tin","rs_pib","ru_inn","ru_kpp","sa_vat","sg_gst","sg_uen","si_tin","sv_nit","th_vat","tr_tin","tw_vat","ua_vat","us_ein","uy_ruc","ve_rif","vn_tin","za_vat","mu_tan"],"title":"TaxIDFormat","description":"List of supported tax ID formats.\n\nRef: https://docs.stripe.com/billing/customer/tax-ids#supported-tax-id"},"TimeInterval":{"type":"string","enum":["year","month","week","day","hour"],"title":"TimeInterval"},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","const":"Bearer","title":"Token Type"},"expires_in":{"type":"integer","title":"Expires In"},"refresh_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refresh Token"},"scope":{"type":"string","title":"Scope"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"}},"type":"object","required":["access_token","token_type","expires_in","scope"],"title":"TokenResponse"},"TrialAlreadyRedeemed":{"properties":{"error":{"type":"string","const":"TrialAlreadyRedeemed","title":"Error","examples":["TrialAlreadyRedeemed"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"TrialAlreadyRedeemed"},"TrialInterval":{"type":"string","enum":["day","week","month","year"],"title":"TrialInterval"},"Unauthorized":{"properties":{"error":{"type":"string","const":"Unauthorized","title":"Error","examples":["Unauthorized"]},"detail":{"type":"string","title":"Detail"}},"type":"object","required":["error","detail"],"title":"Unauthorized"},"UniqueAggregation":{"properties":{"func":{"type":"string","const":"unique","title":"Func","default":"unique"},"property":{"type":"string","title":"Property"}},"type":"object","required":["property"],"title":"UniqueAggregation"},"UserEvent":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"timestamp":{"type":"string","format":"date-time","title":"Timestamp","description":"The timestamp of the event."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The ID of the organization owning the event.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},"customer_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Customer Id","description":"ID of the customer in your Polar organization associated with the event."},"customer":{"anyOf":[{"$ref":"#/components/schemas/Customer"},{"type":"null"}],"description":"The customer associated with the event."},"external_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Customer Id","description":"ID of the customer in your system associated with the event."},"member_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Member Id","description":"ID of the member within the customer's organization who performed the action inside B2B."},"external_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Member Id","description":"ID of the member in your system within the customer's organization who performed the action inside B2B."},"child_count":{"type":"integer","title":"Child Count","description":"Number of direct child events linked to this event.","default":0},"parent_id":{"anyOf":[{"type":"string","format":"uuid4"},{"type":"null"}],"title":"Parent Id","description":"The ID of the parent event."},"label":{"type":"string","title":"Label","description":"Human readable label of the event type."},"name":{"type":"string","title":"Name","description":"The name of the event."},"source":{"type":"string","const":"user","title":"Source","description":"The source of the event. `system` events are created by Polar. `user` events are the one you create through our ingestion API."},"metadata":{"$ref":"#/components/schemas/EventMetadataOutput"}},"type":"object","required":["id","timestamp","organization_id","customer_id","customer","external_customer_id","label","name","source","metadata"],"title":"UserEvent","description":"An event you created through the ingestion API."},"UserInfoOrganization":{"properties":{"sub":{"type":"string","title":"Sub"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","required":["sub"],"title":"UserInfoOrganization"},"UserInfoUser":{"properties":{"sub":{"type":"string","title":"Sub"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"email_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email Verified"}},"type":"object","required":["sub"],"title":"UserInfoUser"},"ValidatedLicenseKey":{"properties":{"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id"},"customer_id":{"type":"string","format":"uuid4","title":"Customer Id"},"customer":{"$ref":"#/components/schemas/LicenseKeyCustomer"},"benefit_id":{"type":"string","format":"uuid4","title":"Benefit Id","description":"The benefit ID."},"key":{"type":"string","title":"Key"},"display_key":{"type":"string","title":"Display Key"},"status":{"$ref":"#/components/schemas/LicenseKeyStatus"},"limit_activations":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Activations"},"usage":{"type":"integer","title":"Usage"},"limit_usage":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit Usage"},"validations":{"type":"integer","title":"Validations"},"last_validated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Validated At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"activation":{"anyOf":[{"$ref":"#/components/schemas/LicenseKeyActivationBase"},{"type":"null"}]}},"type":"object","required":["id","created_at","modified_at","organization_id","customer_id","customer","benefit_id","key","display_key","status","limit_activations","usage","limit_usage","validations","last_validated_at","expires_at"],"title":"ValidatedLicenseKey"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"Visibility":{"type":"string","enum":["draft","private","public"],"title":"Visibility"},"WebhookBenefitCreatedPayload":{"properties":{"type":{"type":"string","const":"benefit.created","title":"Type","examples":["benefit.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Benefit","title":"Benefit"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookBenefitCreatedPayload","description":"Sent when a new benefit is created.\n\n**Discord & Slack support:** Basic"},"WebhookBenefitGrantCreatedPayload":{"properties":{"type":{"type":"string","const":"benefit_grant.created","title":"Type","examples":["benefit_grant.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/BenefitGrantWebhook","title":"BenefitGrantWebhook"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookBenefitGrantCreatedPayload","description":"Sent when a new benefit grant is created.\n\n**Discord & Slack support:** Basic"},"WebhookBenefitGrantCycledPayload":{"properties":{"type":{"type":"string","const":"benefit_grant.cycled","title":"Type","examples":["benefit_grant.cycled"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/BenefitGrantWebhook","title":"BenefitGrantWebhook"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookBenefitGrantCycledPayload","description":"Sent when a benefit grant is cycled,\nmeaning the related subscription has been renewed for another period.\n\n**Discord & Slack support:** Basic"},"WebhookBenefitGrantRevokedPayload":{"properties":{"type":{"type":"string","const":"benefit_grant.revoked","title":"Type","examples":["benefit_grant.revoked"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/BenefitGrantWebhook","title":"BenefitGrantWebhook"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookBenefitGrantRevokedPayload","description":"Sent when a benefit grant is revoked.\n\n**Discord & Slack support:** Basic"},"WebhookBenefitGrantUpdatedPayload":{"properties":{"type":{"type":"string","const":"benefit_grant.updated","title":"Type","examples":["benefit_grant.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/BenefitGrantWebhook","title":"BenefitGrantWebhook"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookBenefitGrantUpdatedPayload","description":"Sent when a benefit grant is updated.\n\n**Discord & Slack support:** Basic"},"WebhookBenefitUpdatedPayload":{"properties":{"type":{"type":"string","const":"benefit.updated","title":"Type","examples":["benefit.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Benefit","title":"Benefit"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookBenefitUpdatedPayload","description":"Sent when a benefit is updated.\n\n**Discord & Slack support:** Basic"},"WebhookCheckoutCreatedPayload":{"properties":{"type":{"type":"string","const":"checkout.created","title":"Type","examples":["checkout.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Checkout"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCheckoutCreatedPayload","description":"Sent when a new checkout is created.\n\n**Discord & Slack support:** Basic"},"WebhookCheckoutExpiredPayload":{"properties":{"type":{"type":"string","const":"checkout.expired","title":"Type","examples":["checkout.expired"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Checkout"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCheckoutExpiredPayload","description":"Sent when a checkout expires.\n\nThis event fires when a checkout reaches its expiration time without being completed.\nDevelopers can use this to send reminder emails or track checkout abandonment.\n\n**Discord & Slack support:** Basic"},"WebhookCheckoutUpdatedPayload":{"properties":{"type":{"type":"string","const":"checkout.updated","title":"Type","examples":["checkout.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Checkout"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCheckoutUpdatedPayload","description":"Sent when a checkout is updated.\n\n**Discord & Slack support:** Basic"},"WebhookCustomerCreatedPayload":{"properties":{"type":{"type":"string","const":"customer.created","title":"Type","examples":["customer.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Customer"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerCreatedPayload","description":"Sent when a new customer is created.\n\nA customer can be created:\n\n* After a successful checkout.\n* Programmatically via the API.\n\n**Discord & Slack support:** Basic"},"WebhookCustomerDeletedPayload":{"properties":{"type":{"type":"string","const":"customer.deleted","title":"Type","examples":["customer.deleted"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Customer"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerDeletedPayload","description":"Sent when a customer is deleted.\n\n**Discord & Slack support:** Basic"},"WebhookCustomerSeatAssignedPayload":{"properties":{"type":{"type":"string","const":"customer_seat.assigned","title":"Type","examples":["customer_seat.assigned"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/CustomerSeat"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerSeatAssignedPayload","description":"Sent when a new customer seat is assigned.\n\nThis event is triggered when a seat is assigned to a customer by the organization.\nThe customer will receive an invitation email to claim the seat."},"WebhookCustomerSeatClaimedPayload":{"properties":{"type":{"type":"string","const":"customer_seat.claimed","title":"Type","examples":["customer_seat.claimed"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/CustomerSeat"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerSeatClaimedPayload","description":"Sent when a customer seat is claimed.\n\nThis event is triggered when a customer accepts the seat invitation and claims their access."},"WebhookCustomerSeatRevokedPayload":{"properties":{"type":{"type":"string","const":"customer_seat.revoked","title":"Type","examples":["customer_seat.revoked"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/CustomerSeat"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerSeatRevokedPayload","description":"Sent when a customer seat is revoked.\n\nThis event is triggered when access to a seat is revoked, either manually by the organization or automatically when a subscription is canceled."},"WebhookCustomerStateChangedPayload":{"properties":{"type":{"type":"string","const":"customer.state_changed","title":"Type","examples":["customer.state_changed"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/CustomerState"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerStateChangedPayload","description":"Sent when a customer state has changed.\n\nIt's triggered when:\n\n* Customer is created, updated or deleted.\n* A subscription is created or updated.\n* A benefit is granted or revoked.\n\n**Discord & Slack support:** Basic"},"WebhookCustomerUpdatedPayload":{"properties":{"type":{"type":"string","const":"customer.updated","title":"Type","examples":["customer.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Customer"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookCustomerUpdatedPayload","description":"Sent when a customer is updated.\n\nThis event is fired when the customer details are updated.\n\nIf you want to be notified when a customer subscription or benefit state changes, you should listen to the `customer_state_changed` event.\n\n**Discord & Slack support:** Basic"},"WebhookDelivery":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"succeeded":{"type":"boolean","title":"Succeeded","description":"Whether the delivery was successful."},"http_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Http Code","description":"The HTTP code returned by the URL. `null` if the endpoint was unreachable."},"response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response","description":"The response body returned by the URL, or the error message if the endpoint was unreachable."},"webhook_event":{"$ref":"#/components/schemas/WebhookEvent","description":"The webhook event sent by this delivery."}},"type":"object","required":["created_at","modified_at","id","succeeded","http_code","response","webhook_event"],"title":"WebhookDelivery","description":"A webhook delivery for a webhook event."},"WebhookEndpoint":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"url":{"type":"string","title":"Url","description":"The URL where the webhook events will be sent.","examples":["https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"An optional name for the webhook endpoint to help organize and identify it."},"format":{"$ref":"#/components/schemas/WebhookFormat","description":"The format of the webhook payload."},"secret":{"type":"string","title":"Secret","description":"The secret used to sign the webhook events.","examples":["whsec_ovyN6cPrTv56AApvzCaJno08SSmGJmgbWilb33N2JuK"]},"organization_id":{"type":"string","format":"uuid4","title":"Organization Id","description":"The organization ID associated with the webhook endpoint."},"events":{"items":{"$ref":"#/components/schemas/WebhookEventType"},"type":"array","title":"Events","description":"The events that will trigger the webhook."},"enabled":{"type":"boolean","title":"Enabled","description":"Whether the webhook endpoint is enabled and will receive events."}},"type":"object","required":["created_at","modified_at","id","url","format","secret","organization_id","events","enabled"],"title":"WebhookEndpoint","description":"A webhook endpoint."},"WebhookEndpointCreate":{"properties":{"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url","description":"The URL where the webhook events will be sent.","examples":["https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0"]},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"An optional name for the webhook endpoint to help organize and identify it."},"format":{"$ref":"#/components/schemas/WebhookFormat","description":"The format of the webhook payload."},"events":{"items":{"$ref":"#/components/schemas/WebhookEventType"},"type":"array","title":"Events","description":"The events that will trigger the webhook."},"organization_id":{"anyOf":[{"type":"string","format":"uuid4","description":"The organization ID.","examples":["1dbfc517-0bbf-4301-9ba8-555ca42b9737"]},{"type":"null"}],"title":"Organization Id","description":"The organization ID associated with the webhook endpoint. **Required unless you use an organization token.**"}},"type":"object","required":["url","format","events"],"title":"WebhookEndpointCreate","description":"Schema to create a webhook endpoint."},"WebhookEndpointUpdate":{"properties":{"url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri","description":"The URL where the webhook events will be sent.","examples":["https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0"]},{"type":"null"}],"title":"Url"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"An optional name for the webhook endpoint to help organize and identify it."},"format":{"anyOf":[{"$ref":"#/components/schemas/WebhookFormat","description":"The format of the webhook payload."},{"type":"null"}]},"events":{"anyOf":[{"items":{"$ref":"#/components/schemas/WebhookEventType"},"type":"array","description":"The events that will trigger the webhook."},{"type":"null"}],"title":"Events"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled","description":"Whether the webhook endpoint is enabled."}},"type":"object","title":"WebhookEndpointUpdate","description":"Schema to update a webhook endpoint."},"WebhookEvent":{"properties":{"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Creation timestamp of the object."},"modified_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Modified At","description":"Last modification timestamp of the object."},"id":{"type":"string","format":"uuid4","title":"Id","description":"The ID of the object."},"last_http_code":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Last Http Code","description":"Last HTTP code returned by the URL. `null` if no delviery has been attempted or if the endpoint was unreachable."},"succeeded":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Succeeded","description":"Whether this event was successfully delivered. `null` if no delivery has been attempted."},"skipped":{"type":"boolean","title":"Skipped","description":"Whether this event was skipped because the webhook endpoint was disabled."},"payload":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payload","description":"The payload of the webhook event."},"type":{"$ref":"#/components/schemas/WebhookEventType","description":"The type of the webhook event."},"is_archived":{"type":"boolean","title":"Is Archived","description":"Whether this event is archived. Archived events can't be redelivered, and the payload is not accessible anymore."}},"type":"object","required":["created_at","modified_at","id","skipped","payload","type","is_archived"],"title":"WebhookEvent","description":"A webhook event.\n\nAn event represent something that happened in the system\nthat should be sent to the webhook endpoint.\n\nIt can be delivered multiple times until it's marked as succeeded,\neach one creating a new delivery."},"WebhookEventType":{"type":"string","enum":["checkout.created","checkout.updated","checkout.expired","customer.created","customer.updated","customer.deleted","customer.state_changed","customer_seat.assigned","customer_seat.claimed","customer_seat.revoked","member.created","member.updated","member.deleted","order.created","order.updated","order.paid","order.refunded","subscription.created","subscription.updated","subscription.active","subscription.canceled","subscription.uncanceled","subscription.revoked","subscription.past_due","subscription.paused","subscription.resumed","refund.created","refund.updated","product.created","product.updated","benefit.created","benefit.updated","benefit_grant.created","benefit_grant.cycled","benefit_grant.updated","benefit_grant.revoked","organization.updated"],"title":"WebhookEventType"},"WebhookFormat":{"type":"string","enum":["raw","discord","slack"],"title":"WebhookFormat"},"WebhookMemberCreatedPayload":{"properties":{"type":{"type":"string","const":"member.created","title":"Type","examples":["member.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Member"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookMemberCreatedPayload","description":"Sent when a new member is created.\n\nA member represents an individual within a customer (team).\nThis event is triggered when a member is added to a customer,\neither programmatically via the API or when an owner is automatically\ncreated for a new customer.\n\n**Discord & Slack support:** Basic"},"WebhookMemberDeletedPayload":{"properties":{"type":{"type":"string","const":"member.deleted","title":"Type","examples":["member.deleted"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Member"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookMemberDeletedPayload","description":"Sent when a member is deleted.\n\nThis event is triggered when a member is removed from a customer.\nAny active seats assigned to the member will be automatically revoked.\n\n**Discord & Slack support:** Basic"},"WebhookMemberUpdatedPayload":{"properties":{"type":{"type":"string","const":"member.updated","title":"Type","examples":["member.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Member"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookMemberUpdatedPayload","description":"Sent when a member is updated.\n\nThis event is triggered when member details are updated,\nsuch as their name or role within the customer.\n\n**Discord & Slack support:** Basic"},"WebhookOrderCreatedPayload":{"properties":{"type":{"type":"string","const":"order.created","title":"Type","examples":["order.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Order"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookOrderCreatedPayload","description":"Sent when a new order is created.\n\nA new order is created when:\n\n* A customer purchases a one-time product. In this case, `billing_reason` is set to `purchase`.\n* A customer starts a subscription. In this case, `billing_reason` is set to `subscription_create`.\n* A subscription is renewed. In this case, `billing_reason` is set to `subscription_cycle`.\n* A subscription is upgraded or downgraded with an immediate proration invoice. In this case, `billing_reason` is set to `subscription_update`.\n\n> [!WARNING]\n> The order might not be paid yet, so the `status` field might be `pending`.\n\n**Discord & Slack support:** Full"},"WebhookOrderPaidPayload":{"properties":{"type":{"type":"string","const":"order.paid","title":"Type","examples":["order.paid"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Order"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookOrderPaidPayload","description":"Sent when an order is paid.\n\nWhen you receive this event, the order is fully processed and payment has been received.\n\n**Discord & Slack support:** Full"},"WebhookOrderRefundedPayload":{"properties":{"type":{"type":"string","const":"order.refunded","title":"Type","examples":["order.refunded"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Order"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookOrderRefundedPayload","description":"Sent when an order is fully or partially refunded.\n\n**Discord & Slack support:** Full"},"WebhookOrderUpdatedPayload":{"properties":{"type":{"type":"string","const":"order.updated","title":"Type","examples":["order.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Order"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookOrderUpdatedPayload","description":"Sent when an order is updated.\n\nAn order is updated when:\n\n* Its status changes, e.g. from `pending` to `paid`.\n* It's refunded, partially or fully.\n\n**Discord & Slack support:** Full"},"WebhookOrganizationUpdatedPayload":{"properties":{"type":{"type":"string","const":"organization.updated","title":"Type","examples":["organization.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Organization"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookOrganizationUpdatedPayload","description":"Sent when a organization is updated.\n\n**Discord & Slack support:** Basic"},"WebhookProductCreatedPayload":{"properties":{"type":{"type":"string","const":"product.created","title":"Type","examples":["product.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Product"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookProductCreatedPayload","description":"Sent when a new product is created.\n\n**Discord & Slack support:** Basic"},"WebhookProductUpdatedPayload":{"properties":{"type":{"type":"string","const":"product.updated","title":"Type","examples":["product.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Product"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookProductUpdatedPayload","description":"Sent when a product is updated.\n\n**Discord & Slack support:** Basic"},"WebhookRefundCreatedPayload":{"properties":{"type":{"type":"string","const":"refund.created","title":"Type","examples":["refund.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Refund"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookRefundCreatedPayload","description":"Sent when a refund is created regardless of status.\n\n**Discord & Slack support:** Full"},"WebhookRefundUpdatedPayload":{"properties":{"type":{"type":"string","const":"refund.updated","title":"Type","examples":["refund.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Refund"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookRefundUpdatedPayload","description":"Sent when a refund is updated.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionActivePayload":{"properties":{"type":{"type":"string","const":"subscription.active","title":"Type","examples":["subscription.active"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionActivePayload","description":"Sent when a subscription becomes active,\nwhether because it's a new paid subscription or because payment was recovered.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionCanceledPayload":{"properties":{"type":{"type":"string","const":"subscription.canceled","title":"Type","examples":["subscription.canceled"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionCanceledPayload","description":"Sent when a subscription is canceled.\nCustomers might still have access until the end of the current period.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionCreatedPayload":{"properties":{"type":{"type":"string","const":"subscription.created","title":"Type","examples":["subscription.created"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionCreatedPayload","description":"Sent when a new subscription is created.\n\nWhen this event occurs, the subscription `status` might not be `active` yet, as we can still have to wait for the first payment to be processed.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionPastDuePayload":{"properties":{"type":{"type":"string","const":"subscription.past_due","title":"Type","examples":["subscription.past_due"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionPastDuePayload","description":"Sent when a subscription payment fails and the subscription enters `past_due` status.\n\nThis is a recoverable state - the customer can update their payment method to restore the subscription.\nBenefits may be revoked depending on the organization's grace period settings.\n\nIf payment retries are exhausted, a `subscription.revoked` event will be sent.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionPausedPayload":{"properties":{"type":{"type":"string","const":"subscription.paused","title":"Type","examples":["subscription.paused"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionPausedPayload","description":"Sent when a subscription is paused and the customer temporarily loses access.\n\nNo order is created while paused. The subscription resumes either on its\nscheduled resume date or when resumed manually, starting a new billing period.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionResumedPayload":{"properties":{"type":{"type":"string","const":"subscription.resumed","title":"Type","examples":["subscription.resumed"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionResumedPayload","description":"Sent when a paused subscription resumes, restoring the customer's access.\n\nResuming starts a new billing period and charges the customer immediately.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionRevokedPayload":{"properties":{"type":{"type":"string","const":"subscription.revoked","title":"Type","examples":["subscription.revoked"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionRevokedPayload","description":"Sent when a subscription is revoked and the user loses access immediately.\nHappens when the subscription is canceled or payment retries are exhausted (status becomes `unpaid`).\n\nFor payment failures that can still be recovered, see `subscription.past_due`.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionUncanceledPayload":{"properties":{"type":{"type":"string","const":"subscription.uncanceled","title":"Type","examples":["subscription.uncanceled"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionUncanceledPayload","description":"Sent when a customer revokes a pending cancellation.\n\nWhen a customer cancels with \"at period end\", they retain access until the\nsubscription would renew. During this time, they can change their mind and\nundo the cancellation. This event is triggered when they do so.\n\n**Discord & Slack support:** Full"},"WebhookSubscriptionUpdatedPayload":{"properties":{"type":{"type":"string","const":"subscription.updated","title":"Type","examples":["subscription.updated"]},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"data":{"$ref":"#/components/schemas/Subscription"}},"type":"object","required":["type","timestamp","data"],"title":"WebhookSubscriptionUpdatedPayload","description":"Sent when a subscription is updated. This event fires for all changes to the subscription, including renewals.\n\nIf you want more specific events, you can listen to `subscription.active`, `subscription.canceled`, `subscription.past_due`, and `subscription.revoked`.\n\nTo listen specifically for renewals, you can listen to `order.created` events and check the `billing_reason` field.\n\n**Discord & Slack support:** On cancellation, past due, and revocation. Renewals are skipped."},"MetadataQuery":{"anyOf":[{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"integer"}},{"type":"array","items":{"type":"boolean"}}]}},{"type":"null"}],"title":"MetadataQuery"},"AuthorizationCodeTokenRequest":{"properties":{"grant_type":{"const":"authorization_code","title":"Grant Type","type":"string"},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"},"code":{"title":"Code","type":"string"},"redirect_uri":{"format":"uri","maxLength":2083,"minLength":1,"title":"Redirect Uri","type":"string"}},"required":["grant_type","client_id","client_secret","code","redirect_uri"],"title":"AuthorizationCodeTokenRequest","type":"object"},"RefreshTokenRequest":{"properties":{"grant_type":{"const":"refresh_token","title":"Grant Type","type":"string"},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"},"refresh_token":{"title":"Refresh Token","type":"string"}},"required":["grant_type","client_id","client_secret","refresh_token"],"title":"RefreshTokenRequest","type":"object"},"WebTokenRequest":{"properties":{"grant_type":{"const":"web","title":"Grant Type","type":"string"},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"},"session_token":{"title":"Session Token","type":"string"},"sub_type":{"default":"user","enum":["user","organization"],"title":"Sub Type","type":"string"},"sub":{"anyOf":[{"format":"uuid4","type":"string"},{"type":"null"}],"default":null,"title":"Sub"},"scope":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Scope"}},"required":["grant_type","client_id","client_secret","session_token"],"title":"WebTokenRequest","type":"object"},"RevokeTokenRequest":{"properties":{"token":{"title":"Token","type":"string"},"token_type_hint":{"anyOf":[{"enum":["access_token","refresh_token"],"type":"string"},{"type":"null"}],"default":null,"title":"Token Type Hint"},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"}},"required":["token","client_id","client_secret"],"title":"RevokeTokenRequest","type":"object"},"IntrospectTokenRequest":{"properties":{"token":{"title":"Token","type":"string"},"token_type_hint":{"anyOf":[{"enum":["access_token","refresh_token"],"type":"string"},{"type":"null"}],"default":null,"title":"Token Type Hint"},"client_id":{"title":"Client Id","type":"string"},"client_secret":{"title":"Client Secret","type":"string"}},"required":["token","client_id","client_secret"],"title":"IntrospectTokenRequest","type":"object"}},"securitySchemes":{"oidc":{"type":"openIdConnect","openIdConnectUrl":"/.well-known/openid-configuration"},"pat":{"type":"http","description":"You can generate a **Personal Access Token** from your [settings](https://polar.sh/settings).","scheme":"bearer"},"oat":{"type":"http","description":"You can generate an **Organization Access Token** from your organization's settings.","scheme":"bearer"},"customer_session":{"type":"http","description":"Customer session tokens are specific tokens that are used to authenticate customers on your organization. You can create those sessions programmatically using the [Create Customer Session endpoint](/api-reference/customer-portal/sessions/create).","scheme":"bearer"},"member_session":{"type":"http","description":"Member session tokens are specific tokens that are used to authenticate members on your organization. You can create those sessions programmatically using the [Create Member Session endpoint](/api-reference/member-portal/sessions/create).","scheme":"bearer"}}},"tags":[{"name":"public","description":"Endpoints shown and documented in the Polar API documentation and available in our SDKs."},{"name":"private","description":"Endpoints that should appear in the schema only in development to generate our internal JS SDK."}]} \ No newline at end of file diff --git a/packages/polar/src/category.ts b/packages/polar/src/category.ts new file mode 100644 index 0000000000..a09ac2ecca --- /dev/null +++ b/packages/polar/src/category.ts @@ -0,0 +1,4 @@ +/** + * Re-export the shared category system from sdk-core. + */ +export * from "@distilled.cloud/core/category"; diff --git a/packages/polar/src/client.ts b/packages/polar/src/client.ts new file mode 100644 index 0000000000..cf08fc2af8 --- /dev/null +++ b/packages/polar/src/client.ts @@ -0,0 +1,99 @@ +/** + * Polar API client. + * + * Wraps the shared REST client from sdk-core with Polar-specific error + * matching and Bearer credential handling. + */ +import * as Effect from "effect/Effect"; +import * as Redacted from "effect/Redacted"; +import * as Schema from "effect/Schema"; +import { makeAPI } from "@distilled.cloud/core/client"; +import { parseRetryAfterForStatus } from "@distilled.cloud/core/retry-after"; +import { Retry } from "./retry.ts"; +import { + HTTP_STATUS_MAP, + PolarParseError, + UnknownPolarError, +} from "./errors.ts"; +import { Credentials } from "./credentials.ts"; + +// Re-export for backwards compatibility with generated imports. +export { UnknownPolarError } from "./errors.ts"; + +/** + * Polar API error response. + * + * Business errors are `{ error, detail }` with a string `detail`; + * request-validation errors (422) are `{ detail: [{ loc, msg, type }, …] }` + * with an array `detail` and no `error`. Both keys are optional so an + * unexpected shape still parses. + */ +const ApiErrorResponse = Schema.Struct({ + error: Schema.optional(Schema.String), + detail: Schema.optional(Schema.Unknown), +}); + +/** Render Polar's `detail` (string or FastAPI validation array) as a message. */ +const formatDetail = (detail: unknown): string => { + if (typeof detail === "string") return detail; + if (Array.isArray(detail)) { + return detail + .map((d) => { + const item = d as { loc?: unknown[]; msg?: string }; + const loc = Array.isArray(item.loc) ? item.loc.join(".") : ""; + return loc ? `${loc}: ${item.msg ?? ""}` : (item.msg ?? ""); + }) + .filter(Boolean) + .join("; "); + } + return ""; +}; + +/** + * Match a Polar error response to a typed error class based on HTTP status. + * Known statuses map through {@link HTTP_STATUS_MAP}; anything else surfaces + * as {@link UnknownPolarError} carrying Polar's `error`/`detail`. + */ +const matchError = ( + status: number, + errorBody: unknown, + _errors?: readonly unknown[], + headers?: Record, +): Effect.Effect => { + let error: string | undefined; + let message = ""; + try { + const parsed = Schema.decodeUnknownSync(ApiErrorResponse)(errorBody); + error = parsed.error; + message = formatDetail(parsed.detail); + } catch { + if (typeof errorBody === "string") message = errorBody; + } + + const ErrorClass = (HTTP_STATUS_MAP as any)[status]; + if (ErrorClass) { + return Effect.fail( + new ErrorClass({ + message: message || error || `HTTP ${status}`, + retryAfter: parseRetryAfterForStatus(status, headers), + }), + ); + } + return Effect.fail( + new UnknownPolarError({ error, detail: message, body: errorBody }), + ); +}; + +/** + * Polar API client. + */ +export const API = makeAPI({ + credentials: Credentials as any, + getBaseUrl: (creds: any) => creds.apiBaseUrl, + getAuthHeaders: (creds: any) => ({ + Authorization: `Bearer ${Redacted.value(creds.accessToken)}`, + }), + matchError, + ParseError: PolarParseError as any, + retry: Retry as any, +}); diff --git a/packages/polar/src/credentials.ts b/packages/polar/src/credentials.ts new file mode 100644 index 0000000000..232e1406e6 --- /dev/null +++ b/packages/polar/src/credentials.ts @@ -0,0 +1,87 @@ +/** + * Polar credentials. + * + * Auth is a Bearer token — a Personal Access Token (PAT) or Organization + * Access Token (OAT) from the Polar dashboard, sent as + * `Authorization: Bearer `. Polar runs two environments; select with + * `POLAR_SERVER` (`production` | `sandbox`) or pin a base URL directly. + */ +import { ConfigError } from "@distilled.cloud/core/errors"; +import * as EffectConfig from "effect/Config"; +import * as Context from "effect/Context"; +import * as Effect from "effect/Effect"; +import * as Layer from "effect/Layer"; +import * as Redacted from "effect/Redacted"; + +/** Production API base URL. */ +export const PRODUCTION_BASE_URL = "https://api.polar.sh"; +/** Sandbox API base URL. */ +export const SANDBOX_BASE_URL = "https://sandbox-api.polar.sh"; + +export type Server = "production" | "sandbox"; + +export interface Config { + readonly accessToken: Redacted.Redacted; + readonly apiBaseUrl: string; +} + +export class Credentials extends Context.Service< + Credentials, + Effect.Effect +>()("PolarCredentials") {} + +const baseUrlForServer = (server: string): string => + server === "production" ? PRODUCTION_BASE_URL : SANDBOX_BASE_URL; + +/** + * Build a credentials Layer directly from an access token and target server + * (defaults to `sandbox`) or an explicit base URL. + */ +export const layer = (config: { + accessToken: string | Redacted.Redacted; + server?: Server; + baseUrl?: string; +}): Layer.Layer => + Layer.succeed( + Credentials, + Effect.succeed({ + accessToken: Redacted.isRedacted(config.accessToken) + ? config.accessToken + : Redacted.make(config.accessToken), + apiBaseUrl: + config.baseUrl ?? baseUrlForServer(config.server ?? "sandbox"), + }), + ); + +const envConfig = EffectConfig.all({ + accessToken: EffectConfig.string("POLAR_ACCESS_TOKEN"), + server: EffectConfig.string("POLAR_SERVER").pipe( + EffectConfig.withDefault("production"), + ), + baseUrl: EffectConfig.option(EffectConfig.string("POLAR_BASE_URL")), +}); + +/** + * Credentials from the environment. + * + * - `POLAR_ACCESS_TOKEN` (required) — PAT or OAT. + * - `POLAR_SERVER` (optional) — `production` (default) or `sandbox`. + * - `POLAR_BASE_URL` (optional) — override the base URL entirely. + */ +export const CredentialsFromEnv = Layer.succeed( + Credentials, + envConfig.pipe( + Effect.mapError( + () => + new ConfigError({ + message: "POLAR_ACCESS_TOKEN environment variable is required", + }), + ), + Effect.map(({ accessToken, server, baseUrl }) => ({ + accessToken: Redacted.make(accessToken), + apiBaseUrl: + baseUrl._tag === "Some" ? baseUrl.value : baseUrlForServer(server), + })), + Effect.orDie, + ), +); diff --git a/packages/polar/src/errors.ts b/packages/polar/src/errors.ts new file mode 100644 index 0000000000..8844deb9e6 --- /dev/null +++ b/packages/polar/src/errors.ts @@ -0,0 +1,56 @@ +/** + * Polar-specific error types. + * + * Re-exports the common HTTP errors from sdk-core and adds Polar's own + * error-matching types. Polar (a FastAPI service) serializes business errors + * as `{ error: "", detail: "" }` under a conventional HTTP + * status (e.g. 404 `ResourceNotFound`, 401 `Unauthorized`, 403 `NotPermitted`) + * and request-validation failures as `422 { detail: [{ loc, msg, type }, …] }`. + * The status is mapped to a typed class in `client.ts`; anything unrecognized + * falls back to {@link UnknownPolarError}. + */ +export { + BadGateway, + BadRequest, + Conflict, + ConfigError, + Forbidden, + GatewayTimeout, + InternalServerError, + Locked, + NotFound, + ServiceUnavailable, + TooManyRequests, + Unauthorized, + UnprocessableEntity, + HTTP_STATUS_MAP, + DEFAULT_ERRORS, + API_ERRORS, +} from "@distilled.cloud/core/errors"; +export type { DefaultErrors } from "@distilled.cloud/core/errors"; + +import * as Schema from "effect/Schema"; +import * as Category from "@distilled.cloud/core/category"; + +/** + * Returned when a Polar error response does not map to a known HTTP status + * error class. Carries Polar's `error` discriminator and `detail` message + * plus the raw response `body`. + */ +export class UnknownPolarError extends Schema.TaggedErrorClass()( + "UnknownPolarError", + { + error: Schema.optional(Schema.String), + detail: Schema.optional(Schema.String), + body: Schema.Unknown, + }, +).pipe(Category.withServerError) {} + +/** Wraps a schema decode failure on a Polar response body. */ +export class PolarParseError extends Schema.TaggedErrorClass()( + "PolarParseError", + { + body: Schema.Unknown, + cause: Schema.Unknown, + }, +).pipe(Category.withParseError) {} diff --git a/packages/polar/src/index.ts b/packages/polar/src/index.ts new file mode 100644 index 0000000000..eb8fcb3a75 --- /dev/null +++ b/packages/polar/src/index.ts @@ -0,0 +1,21 @@ +/** + * Polar SDK for Effect. + * + * Effect-native client for the [Polar](https://polar.sh) billing API — + * products, prices, subscriptions, customers, meters, events, checkouts, and + * benefits — with exhaustive error typing, retry policies, and streaming + * pagination. + * + * @example + * ```ts + * import * as Polar from "@distilled.cloud/polar"; + * ``` + */ +export * from "./credentials.ts"; +export * as Category from "./category.ts"; +export * as T from "./traits.ts"; +export * as Retry from "./retry.ts"; +export { API } from "./client.ts"; +export * from "./errors.ts"; +export * from "./operations/index.ts"; +export { SensitiveString, SensitiveNullableString } from "./sensitive.ts"; diff --git a/packages/polar/src/operations/benefitGrantslist.ts b/packages/polar/src/operations/benefitGrantslist.ts new file mode 100644 index 0000000000..40d4268717 --- /dev/null +++ b/packages/polar/src/operations/benefitGrantslist.ts @@ -0,0 +1,366 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitGrantslistInput { + organization_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + is_granted?: boolean | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "granted_at" + | "-granted_at" + | "revoked_at" + | "-revoked_at" + > | null; +} +export const BenefitGrantslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + is_granted: Schema.optional(Schema.NullOr(Schema.Boolean)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "granted_at", + "-granted_at", + "revoked_at", + "-revoked_at", + ]), + ), + ), + ), + }, +).pipe( + T.Http({ method: "GET", path: "/v1/benefit-grants/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface BenefitGrantslistOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + granted_at?: string | null; + is_granted: boolean; + revoked_at?: string | null; + is_revoked: boolean; + subscription_id: string | null; + order_id: string | null; + customer_id: string; + member_id?: string | null; + benefit_id: string; + error?: { message: string; type: string; timestamp: string } | null; + customer: unknown; + member?: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + benefit: + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + }; + properties: + | { + account_id?: string | null; + guild_id?: string; + role_id?: string; + granted_account_id?: string; + } + | { + account_id?: string | null; + repository_owner?: string; + repository_name?: string; + permission?: "pull" | "triage" | "push" | "maintain" | "admin"; + granted_account_id?: string; + } + | { files?: ReadonlyArray } + | { + user_provided_key?: string; + license_key_id?: string; + display_key?: string; + } + | {} + | { + invited_email?: string; + channel_id?: string; + channel_name?: string; + invite_id?: string; + invite_url?: string; + connected_team_id?: string; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const BenefitGrantslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + granted_at: Schema.optional(Schema.NullOr(Schema.String)), + is_granted: Schema.Boolean, + revoked_at: Schema.optional(Schema.NullOr(Schema.String)), + is_revoked: Schema.Boolean, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + customer_id: Schema.String, + member_id: Schema.optional(Schema.NullOr(Schema.String)), + benefit_id: Schema.String, + error: Schema.optional( + Schema.NullOr( + Schema.Struct({ + message: Schema.String, + type: Schema.String, + timestamp: Schema.String, + }), + ), + ), + customer: Schema.Unknown, + member: Schema.optional( + Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + ), + benefit: Schema.Unknown, + properties: Schema.Union([ + Schema.Struct({ + account_id: Schema.optional(Schema.NullOr(Schema.String)), + guild_id: Schema.optional(Schema.String), + role_id: Schema.optional(Schema.String), + granted_account_id: Schema.optional(Schema.String), + }), + Schema.Struct({ + account_id: Schema.optional(Schema.NullOr(Schema.String)), + repository_owner: Schema.optional(Schema.String), + repository_name: Schema.optional(Schema.String), + permission: Schema.optional( + Schema.Literals(["pull", "triage", "push", "maintain", "admin"]), + ), + granted_account_id: Schema.optional(Schema.String), + }), + Schema.Struct({ + files: Schema.optional(Schema.Array(Schema.String)), + }), + Schema.Struct({ + user_provided_key: Schema.optional(Schema.String), + license_key_id: Schema.optional(Schema.String), + display_key: Schema.optional(Schema.String), + }), + Schema.Struct({}), + Schema.Struct({ + invited_email: Schema.optional(Schema.String), + channel_id: Schema.optional(Schema.String), + channel_name: Schema.optional(Schema.String), + invite_id: Schema.optional(Schema.String), + invite_url: Schema.optional(Schema.String), + connected_team_id: Schema.optional(Schema.String), + }), + ]), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Benefit Grants + * + * List benefit grants across all benefits accessible to the authenticated subject. + * **Scopes**: `benefits:read` `benefits:write` + * + * @param organization_id - Filter by organization ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by customer external ID. + * @param is_granted - Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const benefitGrantslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitGrantslistInput, + outputSchema: BenefitGrantslistOutput, +})); diff --git a/packages/polar/src/operations/benefitscreate.ts b/packages/polar/src/operations/benefitscreate.ts new file mode 100644 index 0000000000..fb46863926 --- /dev/null +++ b/packages/polar/src/operations/benefitscreate.ts @@ -0,0 +1,205 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitscreateInput { + metadata?: Record; + type: string; + description: string; + organization_id?: string | null; + visibility?: "draft" | "private" | "public" | null; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; +} +export const BenefitscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + type: Schema.String, + description: Schema.String, + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + visibility: Schema.optional( + Schema.NullOr(Schema.Literals(["draft", "private", "public"])), + ), + properties: Schema.Struct({ + slack_integration_id: Schema.String, + channel_name_template: Schema.String, + private: Schema.optional(Schema.Boolean), + welcome_message: Schema.optional(Schema.NullOr(Schema.String)), + archive_on_revoke: Schema.optional(Schema.Boolean), + team_invitees: Schema.optional(Schema.Array(Schema.String)), + }), +}).pipe( + T.Http({ method: "POST", path: "/v1/benefits/" }), +) as unknown as Schema.Codec; + +// Output Schema +export type BenefitscreateOutput = + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + }; +export const BenefitscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Create Benefit + * + * Create a benefit. + * **Scopes**: `benefits:write` + */ +export const benefitscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitscreateInput, + outputSchema: BenefitscreateOutput, +})); diff --git a/packages/polar/src/operations/benefitsdelete.ts b/packages/polar/src/operations/benefitsdelete.ts new file mode 100644 index 0000000000..c34f198c83 --- /dev/null +++ b/packages/polar/src/operations/benefitsdelete.ts @@ -0,0 +1,33 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitsdeleteInput { + id: string; +} +export const BenefitsdeleteInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "DELETE", path: "/v1/benefits/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type BenefitsdeleteOutput = void; +export const BenefitsdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Benefit + * + * Delete a benefit. + * > [!WARNING] + * > Every grants associated with the benefit will be revoked. + * > Users will lose access to the benefit. + * **Scopes**: `benefits:write` + */ +export const benefitsdelete = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitsdeleteInput, + outputSchema: BenefitsdeleteOutput, +})); diff --git a/packages/polar/src/operations/benefitsget.ts b/packages/polar/src/operations/benefitsget.ts new file mode 100644 index 0000000000..33fc9894a8 --- /dev/null +++ b/packages/polar/src/operations/benefitsget.ts @@ -0,0 +1,174 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitsgetInput { + id: string; +} +export const BenefitsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/benefits/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type BenefitsgetOutput = + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + }; +export const BenefitsgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Benefit + * + * Get a benefit by ID. + * **Scopes**: `benefits:read` `benefits:write` + */ +export const benefitsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitsgetInput, + outputSchema: BenefitsgetOutput, +})); diff --git a/packages/polar/src/operations/benefitsgrants.ts b/packages/polar/src/operations/benefitsgrants.ts new file mode 100644 index 0000000000..f1837a1476 --- /dev/null +++ b/packages/polar/src/operations/benefitsgrants.ts @@ -0,0 +1,338 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitsgrantsInput { + id: string; + is_granted?: boolean | null; + customer_id?: string | ReadonlyArray | null; + member_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; +} +export const BenefitsgrantsInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + is_granted: Schema.optional(Schema.NullOr(Schema.Boolean)), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + member_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), +}).pipe( + T.Http({ method: "GET", path: "/v1/benefits/{id}/grants" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface BenefitsgrantsOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + granted_at?: string | null; + is_granted: boolean; + revoked_at?: string | null; + is_revoked: boolean; + subscription_id: string | null; + order_id: string | null; + customer_id: string; + member_id?: string | null; + benefit_id: string; + error?: { message: string; type: string; timestamp: string } | null; + customer: unknown; + member?: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + benefit: + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + }; + properties: + | { + account_id?: string | null; + guild_id?: string; + role_id?: string; + granted_account_id?: string; + } + | { + account_id?: string | null; + repository_owner?: string; + repository_name?: string; + permission?: "pull" | "triage" | "push" | "maintain" | "admin"; + granted_account_id?: string; + } + | { files?: ReadonlyArray } + | { + user_provided_key?: string; + license_key_id?: string; + display_key?: string; + } + | {} + | { + invited_email?: string; + channel_id?: string; + channel_name?: string; + invite_id?: string; + invite_url?: string; + connected_team_id?: string; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const BenefitsgrantsOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + granted_at: Schema.optional(Schema.NullOr(Schema.String)), + is_granted: Schema.Boolean, + revoked_at: Schema.optional(Schema.NullOr(Schema.String)), + is_revoked: Schema.Boolean, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + customer_id: Schema.String, + member_id: Schema.optional(Schema.NullOr(Schema.String)), + benefit_id: Schema.String, + error: Schema.optional( + Schema.NullOr( + Schema.Struct({ + message: Schema.String, + type: Schema.String, + timestamp: Schema.String, + }), + ), + ), + customer: Schema.Unknown, + member: Schema.optional( + Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + ), + benefit: Schema.Unknown, + properties: Schema.Union([ + Schema.Struct({ + account_id: Schema.optional(Schema.NullOr(Schema.String)), + guild_id: Schema.optional(Schema.String), + role_id: Schema.optional(Schema.String), + granted_account_id: Schema.optional(Schema.String), + }), + Schema.Struct({ + account_id: Schema.optional(Schema.NullOr(Schema.String)), + repository_owner: Schema.optional(Schema.String), + repository_name: Schema.optional(Schema.String), + permission: Schema.optional( + Schema.Literals(["pull", "triage", "push", "maintain", "admin"]), + ), + granted_account_id: Schema.optional(Schema.String), + }), + Schema.Struct({ + files: Schema.optional(Schema.Array(Schema.String)), + }), + Schema.Struct({ + user_provided_key: Schema.optional(Schema.String), + license_key_id: Schema.optional(Schema.String), + display_key: Schema.optional(Schema.String), + }), + Schema.Struct({}), + Schema.Struct({ + invited_email: Schema.optional(Schema.String), + channel_id: Schema.optional(Schema.String), + channel_name: Schema.optional(Schema.String), + invite_id: Schema.optional(Schema.String), + invite_url: Schema.optional(Schema.String), + connected_team_id: Schema.optional(Schema.String), + }), + ]), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Benefit Grants + * + * List the individual grants for a benefit. + * It's especially useful to check if a user has been granted a benefit. + * **Scopes**: `benefits:read` `benefits:write` + * + * @param is_granted - Filter by granted status. If `true`, only granted benefits will be returned. If `false`, only revoked benefits will be returned. + * @param customer_id - Filter by customer. + * @param member_id - Filter by member. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const benefitsgrants = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitsgrantsInput, + outputSchema: BenefitsgrantsOutput, +})); diff --git a/packages/polar/src/operations/benefitslist.ts b/packages/polar/src/operations/benefitslist.ts new file mode 100644 index 0000000000..4e3489dfa4 --- /dev/null +++ b/packages/polar/src/operations/benefitslist.ts @@ -0,0 +1,307 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitslistInput { + organization_id?: string | ReadonlyArray | null; + type?: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel" + | ReadonlyArray< + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel" + > + | null; + id?: string | ReadonlyArray | null; + exclude_id?: string | ReadonlyArray | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "description" + | "-description" + | "type" + | "-type" + | "user_order" + | "-user_order" + > | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const BenefitslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + Schema.Array( + Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + ), + ]), + ), + ), + id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + exclude_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "description", + "-description", + "type", + "-type", + "user_order", + "-user_order", + ]), + ), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/benefits/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface BenefitslistOutput { + items: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const BenefitslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array(Schema.Unknown), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Benefits + * + * List benefits. + * **Scopes**: `benefits:read` `benefits:write` + * + * @param organization_id - Filter by organization ID. + * @param type - Filter by benefit type. + * @param id - Filter by benefit IDs. + * @param exclude_id - Exclude benefits with these IDs. + * @param query - Filter by description. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const benefitslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitslistInput, + outputSchema: BenefitslistOutput, +})); diff --git a/packages/polar/src/operations/benefitsupdate.ts b/packages/polar/src/operations/benefitsupdate.ts new file mode 100644 index 0000000000..958ced8497 --- /dev/null +++ b/packages/polar/src/operations/benefitsupdate.ts @@ -0,0 +1,209 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface BenefitsupdateInput { + id: string; + metadata?: Record; + description?: string | null; + visibility?: "draft" | "private" | "public" | null; + type: string; + properties?: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + } | null; +} +export const BenefitsupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + description: Schema.optional(Schema.NullOr(Schema.String)), + visibility: Schema.optional( + Schema.NullOr(Schema.Literals(["draft", "private", "public"])), + ), + type: Schema.String, + properties: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slack_integration_id: Schema.String, + channel_name_template: Schema.String, + private: Schema.optional(Schema.Boolean), + welcome_message: Schema.optional(Schema.NullOr(Schema.String)), + archive_on_revoke: Schema.optional(Schema.Boolean), + team_invitees: Schema.optional(Schema.Array(Schema.String)), + }), + ), + ), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/benefits/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type BenefitsupdateOutput = + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + }; +export const BenefitsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Update Benefit + * + * Update a benefit. + * **Scopes**: `benefits:write` + */ +export const benefitsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: BenefitsupdateInput, + outputSchema: BenefitsupdateOutput, +})); diff --git a/packages/polar/src/operations/checkoutLinkscreate.ts b/packages/polar/src/operations/checkoutLinkscreate.ts new file mode 100644 index 0000000000..f95a74640c --- /dev/null +++ b/packages/polar/src/operations/checkoutLinkscreate.ts @@ -0,0 +1,629 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutLinkscreateInput { + metadata?: Record; + trial_interval?: "day" | "week" | "month" | "year" | null; + trial_interval_count?: number | null; + payment_processor: string; + label?: string | null; + allow_discount_codes?: boolean; + require_billing_address?: boolean; + discount_id?: string | null; + seats?: number | null; + success_url?: string | null; + return_url?: string | null; + product_price_id?: string; + product_id?: string; + products?: ReadonlyArray; +} +export const CheckoutLinkscreateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + trial_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + trial_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + payment_processor: Schema.String, + label: Schema.optional(Schema.NullOr(Schema.String)), + allow_discount_codes: Schema.optional(Schema.Boolean), + require_billing_address: Schema.optional(Schema.Boolean), + discount_id: Schema.optional(Schema.NullOr(Schema.String)), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + success_url: Schema.optional(Schema.NullOr(Schema.String)), + return_url: Schema.optional(Schema.NullOr(Schema.String)), + product_price_id: Schema.optional(Schema.String), + product_id: Schema.optional(Schema.String), + products: Schema.optional(Schema.Array(Schema.String)), + }).pipe( + T.Http({ method: "POST", path: "/v1/checkout-links/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutLinkscreateOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + payment_processor: "stripe"; + client_secret: Redacted.Redacted; + success_url: string | null; + return_url: string | null; + label: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + discount_id: string | null; + seats: number | null; + organization_id: string; + products: ReadonlyArray<{ + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + url: string; +} +export const CheckoutLinkscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + payment_processor: Schema.Literals(["stripe"]), + client_secret: SensitiveOutputString, + success_url: Schema.NullOr(Schema.String), + return_url: Schema.NullOr(Schema.String), + label: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + discount_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + organization_id: Schema.String, + products: Schema.Array( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + url: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Checkout Link + * + * Create a checkout link. + * **Scopes**: `checkout_links:write` + */ +export const checkoutLinkscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutLinkscreateInput, + outputSchema: CheckoutLinkscreateOutput, +})); diff --git a/packages/polar/src/operations/checkoutLinksdelete.ts b/packages/polar/src/operations/checkoutLinksdelete.ts new file mode 100644 index 0000000000..cd384ba34a --- /dev/null +++ b/packages/polar/src/operations/checkoutLinksdelete.ts @@ -0,0 +1,33 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CheckoutLinksdeleteInput { + id: string; +} +export const CheckoutLinksdeleteInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/checkout-links/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CheckoutLinksdeleteOutput = void; +export const CheckoutLinksdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Checkout Link + * + * Delete a checkout link. + * **Scopes**: `checkout_links:write` + * + * @param id - The checkout link ID. + */ +export const checkoutLinksdelete = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutLinksdeleteInput, + outputSchema: CheckoutLinksdeleteOutput, +})); diff --git a/packages/polar/src/operations/checkoutLinksget.ts b/packages/polar/src/operations/checkoutLinksget.ts new file mode 100644 index 0000000000..0be8559220 --- /dev/null +++ b/packages/polar/src/operations/checkoutLinksget.ts @@ -0,0 +1,598 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutLinksgetInput { + id: string; +} +export const CheckoutLinksgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/checkout-links/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutLinksgetOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + payment_processor: "stripe"; + client_secret: Redacted.Redacted; + success_url: string | null; + return_url: string | null; + label: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + discount_id: string | null; + seats: number | null; + organization_id: string; + products: ReadonlyArray<{ + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + url: string; +} +export const CheckoutLinksgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + payment_processor: Schema.Literals(["stripe"]), + client_secret: SensitiveOutputString, + success_url: Schema.NullOr(Schema.String), + return_url: Schema.NullOr(Schema.String), + label: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + discount_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + organization_id: Schema.String, + products: Schema.Array( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + url: Schema.String, + }, +) as unknown as Schema.Codec; + +// The operation +/** + * Get Checkout Link + * + * Get a checkout link by ID. + * **Scopes**: `checkout_links:read` `checkout_links:write` + * + * @param id - The checkout link ID. + */ +export const checkoutLinksget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutLinksgetInput, + outputSchema: CheckoutLinksgetOutput, +})); diff --git a/packages/polar/src/operations/checkoutLinkslist.ts b/packages/polar/src/operations/checkoutLinkslist.ts new file mode 100644 index 0000000000..a7486e358e --- /dev/null +++ b/packages/polar/src/operations/checkoutLinkslist.ts @@ -0,0 +1,517 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutLinkslistInput { + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "label" + | "-label" + | "success_url" + | "-success_url" + | "allow_discount_codes" + | "-allow_discount_codes" + > | null; +} +export const CheckoutLinkslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "label", + "-label", + "success_url", + "-success_url", + "allow_discount_codes", + "-allow_discount_codes", + ]), + ), + ), + ), + }, +).pipe( + T.Http({ method: "GET", path: "/v1/checkout-links/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutLinkslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + payment_processor: "stripe"; + client_secret: Redacted.Redacted; + success_url: string | null; + return_url: string | null; + label: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + discount_id: string | null; + seats: number | null; + organization_id: string; + products: ReadonlyArray<{ + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + url: string; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CheckoutLinkslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + payment_processor: Schema.Literals(["stripe"]), + client_secret: SensitiveOutputString, + success_url: Schema.NullOr(Schema.String), + return_url: Schema.NullOr(Schema.String), + label: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + discount_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + organization_id: Schema.String, + products: Schema.Array( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + url: Schema.String, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Checkout Links + * + * List checkout links. + * **Scopes**: `checkout_links:read` `checkout_links:write` + * + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const checkoutLinkslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutLinkslistInput, + outputSchema: CheckoutLinkslistOutput, +})); diff --git a/packages/polar/src/operations/checkoutLinksupdate.ts b/packages/polar/src/operations/checkoutLinksupdate.ts new file mode 100644 index 0000000000..82610fe33a --- /dev/null +++ b/packages/polar/src/operations/checkoutLinksupdate.ts @@ -0,0 +1,627 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutLinksupdateInput { + id: string; + trial_interval?: "day" | "week" | "month" | "year" | null; + trial_interval_count?: number | null; + metadata?: Record; + products?: ReadonlyArray | null; + label?: string | null; + allow_discount_codes?: boolean | null; + require_billing_address?: boolean | null; + discount_id?: string | null; + seats?: number | null; + success_url?: string | null; + return_url?: string | null; +} +export const CheckoutLinksupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + trial_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + trial_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + products: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), + label: Schema.optional(Schema.NullOr(Schema.String)), + allow_discount_codes: Schema.optional(Schema.NullOr(Schema.Boolean)), + require_billing_address: Schema.optional(Schema.NullOr(Schema.Boolean)), + discount_id: Schema.optional(Schema.NullOr(Schema.String)), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + success_url: Schema.optional(Schema.NullOr(Schema.String)), + return_url: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/checkout-links/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutLinksupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + payment_processor: "stripe"; + client_secret: Redacted.Redacted; + success_url: string | null; + return_url: string | null; + label: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + discount_id: string | null; + seats: number | null; + organization_id: string; + products: ReadonlyArray<{ + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + url: string; +} +export const CheckoutLinksupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + payment_processor: Schema.Literals(["stripe"]), + client_secret: SensitiveOutputString, + success_url: Schema.NullOr(Schema.String), + return_url: Schema.NullOr(Schema.String), + label: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + discount_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + organization_id: Schema.String, + products: Schema.Array( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + url: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Checkout Link + * + * Update a checkout link. + * **Scopes**: `checkout_links:write` + * + * @param id - The checkout link ID. + */ +export const checkoutLinksupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutLinksupdateInput, + outputSchema: CheckoutLinksupdateOutput, +})); diff --git a/packages/polar/src/operations/checkoutsclientConfirm.ts b/packages/polar/src/operations/checkoutsclientConfirm.ts new file mode 100644 index 0000000000..c3ad81f0e6 --- /dev/null +++ b/packages/polar/src/operations/checkoutsclientConfirm.ts @@ -0,0 +1,2492 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutsclientConfirmInput { + client_secret: string; + custom_field_data?: Record; + product_id?: string | null; + product_price_id?: string | null; + amount?: number | null; + seats?: number | null; + is_business_customer?: boolean | null; + customer_name?: string | null; + customer_email?: string | null; + customer_billing_name?: string | null; + customer_billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id?: string | null; + locale?: string | null; + discount_code?: string | null; + allow_trial?: boolean | null; + confirmation_token_id?: string | null; +} +export const CheckoutsclientConfirmInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + client_secret: Schema.String.pipe(T.PathParam()), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + product_id: Schema.optional(Schema.NullOr(Schema.String)), + product_price_id: Schema.optional(Schema.NullOr(Schema.String)), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + is_business_customer: Schema.optional(Schema.NullOr(Schema.Boolean)), + customer_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_email: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + customer_tax_id: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + discount_code: Schema.optional(Schema.NullOr(Schema.String)), + allow_trial: Schema.optional(Schema.NullOr(Schema.Boolean)), + confirmation_token_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/checkouts/client/{client_secret}/confirm", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutsclientConfirmOutput { + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: string; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + }; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; + customer_session_token: string | null; +} +export const CheckoutsclientConfirmOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.String, + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.Unknown, + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + ), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + }), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + customer_session_token: Schema.NullOr(Schema.String), + }) as unknown as Schema.Codec; + +// The operation +/** + * Confirm Checkout Session from Client + * + * Confirm a checkout session by client secret. + * Orders and subscriptions will be processed. + * + * @param client_secret - The checkout session client secret. + */ +export const checkoutsclientConfirm = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CheckoutsclientConfirmInput, + outputSchema: CheckoutsclientConfirmOutput, + }), +); diff --git a/packages/polar/src/operations/checkoutsclientGet.ts b/packages/polar/src/operations/checkoutsclientGet.ts new file mode 100644 index 0000000000..60319f0110 --- /dev/null +++ b/packages/polar/src/operations/checkoutsclientGet.ts @@ -0,0 +1,1946 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutsclientGetInput { + client_secret: string; +} +export const CheckoutsclientGetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + client_secret: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/checkouts/client/{client_secret}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutsclientGetOutput { + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: "open" | "expired" | "confirmed" | "succeeded" | "failed"; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + }; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; +} +export const CheckoutsclientGetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.Unknown, + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + ), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + }), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Checkout Session from Client + * + * Get a checkout session by client secret. + * + * @param client_secret - The checkout session client secret. + */ +export const checkoutsclientGet = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutsclientGetInput, + outputSchema: CheckoutsclientGetOutput, +})); diff --git a/packages/polar/src/operations/checkoutsclientUpdate.ts b/packages/polar/src/operations/checkoutsclientUpdate.ts new file mode 100644 index 0000000000..32020861b7 --- /dev/null +++ b/packages/polar/src/operations/checkoutsclientUpdate.ts @@ -0,0 +1,2490 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutsclientUpdateInput { + client_secret: string; + custom_field_data?: Record; + product_id?: string | null; + product_price_id?: string | null; + amount?: number | null; + seats?: number | null; + is_business_customer?: boolean | null; + customer_name?: string | null; + customer_email?: string | null; + customer_billing_name?: string | null; + customer_billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id?: string | null; + locale?: string | null; + discount_code?: string | null; + allow_trial?: boolean | null; +} +export const CheckoutsclientUpdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + client_secret: Schema.String.pipe(T.PathParam()), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + product_id: Schema.optional(Schema.NullOr(Schema.String)), + product_price_id: Schema.optional(Schema.NullOr(Schema.String)), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + is_business_customer: Schema.optional(Schema.NullOr(Schema.Boolean)), + customer_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_email: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + customer_tax_id: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + discount_code: Schema.optional(Schema.NullOr(Schema.String)), + allow_trial: Schema.optional(Schema.NullOr(Schema.Boolean)), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/checkouts/client/{client_secret}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutsclientUpdateOutput { + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: "open" | "expired" | "confirmed" | "succeeded" | "failed"; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + }; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; +} +export const CheckoutsclientUpdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.Unknown, + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + ), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + }), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Checkout Session from Client + * + * Update a checkout session by client secret. + * + * @param client_secret - The checkout session client secret. + */ +export const checkoutsclientUpdate = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CheckoutsclientUpdateInput, + outputSchema: CheckoutsclientUpdateOutput, + }), +); diff --git a/packages/polar/src/operations/checkoutscreate.ts b/packages/polar/src/operations/checkoutscreate.ts new file mode 100644 index 0000000000..bddba1c70b --- /dev/null +++ b/packages/polar/src/operations/checkoutscreate.ts @@ -0,0 +1,2772 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutscreateInput { + trial_interval?: "day" | "week" | "month" | "year" | null; + trial_interval_count?: number | null; + metadata?: Record; + custom_field_data?: Record; + discount_id?: string | null; + allow_discount_codes?: boolean; + require_billing_address?: boolean; + amount?: number | null; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + allow_trial?: boolean; + customer_id?: string | null; + is_business_customer?: boolean; + external_customer_id?: string | null; + customer_name?: string | null; + customer_email?: string | null; + customer_ip_address?: string | null; + customer_billing_name?: string | null; + customer_billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id?: string | null; + customer_metadata?: Record; + subscription_id?: string | null; + success_url?: string | null; + return_url?: string | null; + embed_origin?: string | null; + locale?: string | null; + currency?: + | "aed" + | "all" + | "amd" + | "aoa" + | "ars" + | "aud" + | "awg" + | "azn" + | "bam" + | "bbd" + | "bdt" + | "bif" + | "bmd" + | "bnd" + | "bob" + | "brl" + | "bsd" + | "bwp" + | "bzd" + | "cad" + | "cdf" + | "chf" + | "clp" + | "cny" + | "cop" + | "crc" + | "cve" + | "czk" + | "djf" + | "dkk" + | "dop" + | "dzd" + | "egp" + | "etb" + | "eur" + | "fjd" + | "fkp" + | "gbp" + | "gel" + | "gip" + | "gmd" + | "gnf" + | "gtq" + | "gyd" + | "hkd" + | "hnl" + | "htg" + | "huf" + | "idr" + | "ils" + | "inr" + | "isk" + | "jmd" + | "jpy" + | "kes" + | "kgs" + | "khr" + | "kmf" + | "krw" + | "kyd" + | "kzt" + | "lak" + | "lkr" + | "lrd" + | "lsl" + | "mad" + | "mdl" + | "mga" + | "mkd" + | "mnt" + | "mop" + | "mur" + | "mvr" + | "mwk" + | "mxn" + | "myr" + | "mzn" + | "nad" + | "ngn" + | "nio" + | "nok" + | "npr" + | "nzd" + | "pab" + | "pen" + | "pgk" + | "php" + | "pkr" + | "pln" + | "pyg" + | "qar" + | "ron" + | "rsd" + | "rwf" + | "sar" + | "sbd" + | "scr" + | "sek" + | "sgd" + | "shp" + | "sos" + | "srd" + | "szl" + | "thb" + | "tjs" + | "top" + | "try" + | "ttd" + | "twd" + | "tzs" + | "uah" + | "ugx" + | "usd" + | "uyu" + | "uzs" + | "vnd" + | "vuv" + | "wst" + | "xaf" + | "xcd" + | "xcg" + | "xof" + | "xpf" + | "yer" + | "zar" + | "zmw" + | null; + products: ReadonlyArray; + prices?: Record> | null; +} +export const CheckoutscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + trial_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + trial_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + discount_id: Schema.optional(Schema.NullOr(Schema.String)), + allow_discount_codes: Schema.optional(Schema.Boolean), + require_billing_address: Schema.optional(Schema.Boolean), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + allow_trial: Schema.optional(Schema.Boolean), + customer_id: Schema.optional(Schema.NullOr(Schema.String)), + is_business_customer: Schema.optional(Schema.Boolean), + external_customer_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_email: Schema.optional(Schema.NullOr(Schema.String)), + customer_ip_address: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + customer_tax_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + subscription_id: Schema.optional(Schema.NullOr(Schema.String)), + success_url: Schema.optional(Schema.NullOr(Schema.String)), + return_url: Schema.optional(Schema.NullOr(Schema.String)), + embed_origin: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + currency: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "aed", + "all", + "amd", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bif", + "bmd", + "bnd", + "bob", + "brl", + "bsd", + "bwp", + "bzd", + "cad", + "cdf", + "chf", + "clp", + "cny", + "cop", + "crc", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "egp", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "htg", + "huf", + "idr", + "ils", + "inr", + "isk", + "jmd", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "krw", + "kyd", + "kzt", + "lak", + "lkr", + "lrd", + "lsl", + "mad", + "mdl", + "mga", + "mkd", + "mnt", + "mop", + "mur", + "mvr", + "mwk", + "mxn", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rwf", + "sar", + "sbd", + "scr", + "sek", + "sgd", + "shp", + "sos", + "srd", + "szl", + "thb", + "tjs", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "uyu", + "uzs", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmw", + ]), + ), + ), + products: Schema.Array(Schema.String), + prices: Schema.optional( + Schema.NullOr(Schema.Record(Schema.String, Schema.Array(Schema.Unknown))), + ), +}).pipe( + T.Http({ method: "POST", path: "/v1/checkouts/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutscreateOutput { + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: "open" | "expired" | "confirmed" | "succeeded" | "failed"; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + external_customer_id: string | null; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + subscription_id: string | null; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; + customer_metadata: Record; +} +export const CheckoutscreateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_customer_id: Schema.NullOr(Schema.String), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.Unknown, + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + ), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + subscription_id: Schema.NullOr(Schema.String), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + customer_metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Create Checkout Session + * + * Create a checkout session. + * **Scopes**: `checkouts:write` + */ +export const checkoutscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutscreateInput, + outputSchema: CheckoutscreateOutput, +})); diff --git a/packages/polar/src/operations/checkoutsget.ts b/packages/polar/src/operations/checkoutsget.ts new file mode 100644 index 0000000000..2151bceb2d --- /dev/null +++ b/packages/polar/src/operations/checkoutsget.ts @@ -0,0 +1,1930 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutsgetInput { + id: string; +} +export const CheckoutsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/checkouts/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutsgetOutput { + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: "open" | "expired" | "confirmed" | "succeeded" | "failed"; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + external_customer_id: string | null; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + subscription_id: string | null; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; + customer_metadata: Record; +} +export const CheckoutsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_customer_id: Schema.NullOr(Schema.String), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.Unknown, + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + ), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + subscription_id: Schema.NullOr(Schema.String), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + customer_metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Checkout Session + * + * Get a checkout session by ID. + * **Scopes**: `checkouts:read` `checkouts:write` + * + * @param id - The checkout session ID. + */ +export const checkoutsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutsgetInput, + outputSchema: CheckoutsgetOutput, +})); diff --git a/packages/polar/src/operations/checkoutslist.ts b/packages/polar/src/operations/checkoutslist.ts new file mode 100644 index 0000000000..bbd01fca25 --- /dev/null +++ b/packages/polar/src/operations/checkoutslist.ts @@ -0,0 +1,1828 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutslistInput { + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + status?: + | "open" + | "expired" + | "confirmed" + | "succeeded" + | "failed" + | ReadonlyArray<"open" | "expired" | "confirmed" | "succeeded" | "failed"> + | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "expires_at" + | "-expires_at" + | "status" + | "-status" + > | null; +} +export const CheckoutslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + status: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + Schema.Array( + Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + ), + ]), + ), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "expires_at", + "-expires_at", + "status", + "-status", + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/checkouts/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: "open" | "expired" | "confirmed" | "succeeded" | "failed"; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + external_customer_id: string | null; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + subscription_id: string | null; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; + customer_metadata: Record; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CheckoutslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_customer_id: Schema.NullOr(Schema.String), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.Unknown, + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + subscription_id: Schema.NullOr(Schema.String), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + customer_metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Checkout Sessions + * + * List checkout sessions. + * **Scopes**: `checkouts:read` `checkouts:write` + * + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by customer external ID. + * @param status - Filter by checkout session status. + * @param query - Filter by customer email. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const checkoutslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutslistInput, + outputSchema: CheckoutslistOutput, +})); diff --git a/packages/polar/src/operations/checkoutsupdate.ts b/packages/polar/src/operations/checkoutsupdate.ts new file mode 100644 index 0000000000..8468dca8a7 --- /dev/null +++ b/packages/polar/src/operations/checkoutsupdate.ts @@ -0,0 +1,2766 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CheckoutsupdateInput { + id: string; + custom_field_data?: Record; + product_id?: string | null; + product_price_id?: string | null; + amount?: number | null; + seats?: number | null; + is_business_customer?: boolean | null; + customer_name?: string | null; + customer_email?: string | null; + customer_billing_name?: string | null; + customer_billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id?: string | null; + locale?: string | null; + trial_interval?: "day" | "week" | "month" | "year" | null; + trial_interval_count?: number | null; + metadata?: Record; + currency?: + | "aed" + | "all" + | "amd" + | "aoa" + | "ars" + | "aud" + | "awg" + | "azn" + | "bam" + | "bbd" + | "bdt" + | "bif" + | "bmd" + | "bnd" + | "bob" + | "brl" + | "bsd" + | "bwp" + | "bzd" + | "cad" + | "cdf" + | "chf" + | "clp" + | "cny" + | "cop" + | "crc" + | "cve" + | "czk" + | "djf" + | "dkk" + | "dop" + | "dzd" + | "egp" + | "etb" + | "eur" + | "fjd" + | "fkp" + | "gbp" + | "gel" + | "gip" + | "gmd" + | "gnf" + | "gtq" + | "gyd" + | "hkd" + | "hnl" + | "htg" + | "huf" + | "idr" + | "ils" + | "inr" + | "isk" + | "jmd" + | "jpy" + | "kes" + | "kgs" + | "khr" + | "kmf" + | "krw" + | "kyd" + | "kzt" + | "lak" + | "lkr" + | "lrd" + | "lsl" + | "mad" + | "mdl" + | "mga" + | "mkd" + | "mnt" + | "mop" + | "mur" + | "mvr" + | "mwk" + | "mxn" + | "myr" + | "mzn" + | "nad" + | "ngn" + | "nio" + | "nok" + | "npr" + | "nzd" + | "pab" + | "pen" + | "pgk" + | "php" + | "pkr" + | "pln" + | "pyg" + | "qar" + | "ron" + | "rsd" + | "rwf" + | "sar" + | "sbd" + | "scr" + | "sek" + | "sgd" + | "shp" + | "sos" + | "srd" + | "szl" + | "thb" + | "tjs" + | "top" + | "try" + | "ttd" + | "twd" + | "tzs" + | "uah" + | "ugx" + | "usd" + | "uyu" + | "uzs" + | "vnd" + | "vuv" + | "wst" + | "xaf" + | "xcd" + | "xcg" + | "xof" + | "xpf" + | "yer" + | "zar" + | "zmw" + | null; + discount_id?: string | null; + allow_discount_codes?: boolean | null; + require_billing_address?: boolean | null; + allow_trial?: boolean | null; + customer_ip_address?: string | null; + customer_metadata?: Record | null; + success_url?: string | null; + return_url?: string | null; + embed_origin?: string | null; +} +export const CheckoutsupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + product_id: Schema.optional(Schema.NullOr(Schema.String)), + product_price_id: Schema.optional(Schema.NullOr(Schema.String)), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + is_business_customer: Schema.optional(Schema.NullOr(Schema.Boolean)), + customer_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_email: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_name: Schema.optional(Schema.NullOr(Schema.String)), + customer_billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + customer_tax_id: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + trial_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + trial_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + currency: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "aed", + "all", + "amd", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bif", + "bmd", + "bnd", + "bob", + "brl", + "bsd", + "bwp", + "bzd", + "cad", + "cdf", + "chf", + "clp", + "cny", + "cop", + "crc", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "egp", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "htg", + "huf", + "idr", + "ils", + "inr", + "isk", + "jmd", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "krw", + "kyd", + "kzt", + "lak", + "lkr", + "lrd", + "lsl", + "mad", + "mdl", + "mga", + "mkd", + "mnt", + "mop", + "mur", + "mvr", + "mwk", + "mxn", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rwf", + "sar", + "sbd", + "scr", + "sek", + "sgd", + "shp", + "sos", + "srd", + "szl", + "thb", + "tjs", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "uyu", + "uzs", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmw", + ]), + ), + ), + discount_id: Schema.optional(Schema.NullOr(Schema.String)), + allow_discount_codes: Schema.optional(Schema.NullOr(Schema.Boolean)), + require_billing_address: Schema.optional(Schema.NullOr(Schema.Boolean)), + allow_trial: Schema.optional(Schema.NullOr(Schema.Boolean)), + customer_ip_address: Schema.optional(Schema.NullOr(Schema.String)), + customer_metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + success_url: Schema.optional(Schema.NullOr(Schema.String)), + return_url: Schema.optional(Schema.NullOr(Schema.String)), + embed_origin: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/checkouts/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CheckoutsupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + custom_field_data?: Record; + payment_processor: "stripe"; + status: "open" | "expired" | "confirmed" | "succeeded" | "failed"; + client_secret: Redacted.Redacted; + url: string; + expires_at: string; + success_url: string; + return_url: string | null; + embed_origin: string | null; + amount: number; + seats?: number | null; + min_seats?: number | null; + max_seats?: number | null; + discount_amount: number; + net_amount: number; + tax_amount: number | null; + tax_behavior: "inclusive" | "exclusive" | null; + total_amount: number; + currency: string; + allow_trial: boolean | null; + active_trial_interval: "day" | "week" | "month" | "year" | null; + active_trial_interval_count: number | null; + trial_end: string | null; + organization_id: string; + product_id: string | null; + product_price_id: string | null; + discount_id: string | null; + allow_discount_codes: boolean; + require_billing_address: boolean; + is_discount_applicable: boolean; + is_free_product_price: boolean; + is_payment_required: boolean; + is_payment_setup_required: boolean; + is_payment_form_required: boolean; + customer_id: string | null; + is_business_customer: boolean; + customer_name: string | null; + customer_email: string | null; + customer_ip_address: string | null; + customer_billing_name: string | null; + customer_billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + customer_tax_id: string | null; + locale?: string | null; + payment_processor_metadata: Record; + billing_address_fields: { + country: "required" | "optional" | "disabled"; + state: "required" | "optional" | "disabled"; + city: "required" | "optional" | "disabled"; + postal_code: "required" | "optional" | "disabled"; + line1: "required" | "optional" | "disabled"; + line2: "required" | "optional" | "disabled"; + }; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + metadata: Record; + external_customer_id: string | null; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + } | null; + product_price: + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + | null; + prices: Record< + string, + ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + > + > | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + id: string; + name: string; + code: string | null; + } + | null; + subscription_id: string | null; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }> | null; + customer_metadata: Record; +} +export const CheckoutsupdateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + payment_processor: Schema.Literals(["stripe"]), + status: Schema.Literals([ + "open", + "expired", + "confirmed", + "succeeded", + "failed", + ]), + client_secret: SensitiveOutputString, + url: Schema.String, + expires_at: Schema.String, + success_url: Schema.String, + return_url: Schema.NullOr(Schema.String), + embed_origin: Schema.NullOr(Schema.String), + amount: Schema.Number, + seats: Schema.optional(Schema.NullOr(Schema.Number)), + min_seats: Schema.optional(Schema.NullOr(Schema.Number)), + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.NullOr(Schema.Number), + tax_behavior: Schema.NullOr(Schema.Literals(["inclusive", "exclusive"])), + total_amount: Schema.Number, + currency: Schema.String, + allow_trial: Schema.NullOr(Schema.Boolean), + active_trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + active_trial_interval_count: Schema.NullOr(Schema.Number), + trial_end: Schema.NullOr(Schema.String), + organization_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + product_price_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + allow_discount_codes: Schema.Boolean, + require_billing_address: Schema.Boolean, + is_discount_applicable: Schema.Boolean, + is_free_product_price: Schema.Boolean, + is_payment_required: Schema.Boolean, + is_payment_setup_required: Schema.Boolean, + is_payment_form_required: Schema.Boolean, + customer_id: Schema.NullOr(Schema.String), + is_business_customer: Schema.Boolean, + customer_name: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + customer_ip_address: Schema.NullOr(Schema.String), + customer_billing_name: Schema.NullOr(Schema.String), + customer_billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + customer_tax_id: Schema.NullOr(Schema.String), + locale: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor_metadata: Schema.Record(Schema.String, Schema.String), + billing_address_fields: Schema.Struct({ + country: Schema.Literals(["required", "optional", "disabled"]), + state: Schema.Literals(["required", "optional", "disabled"]), + city: Schema.Literals(["required", "optional", "disabled"]), + postal_code: Schema.Literals(["required", "optional", "disabled"]), + line1: Schema.Literals(["required", "optional", "disabled"]), + line2: Schema.Literals(["required", "optional", "disabled"]), + }), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_customer_id: Schema.NullOr(Schema.String), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + product: Schema.Unknown, + product_price: Schema.NullOr( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + prices: Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + ), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + id: Schema.String, + name: Schema.String, + code: Schema.NullOr(Schema.String), + }), + ]), + ), + subscription_id: Schema.NullOr(Schema.String), + attached_custom_fields: Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + ), + customer_metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Update Checkout Session + * + * Update a checkout session. + * **Scopes**: `checkouts:write` + * + * @param id - The checkout session ID. + */ +export const checkoutsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CheckoutsupdateInput, + outputSchema: CheckoutsupdateOutput, +})); diff --git a/packages/polar/src/operations/customFieldscreate.ts b/packages/polar/src/operations/customFieldscreate.ts new file mode 100644 index 0000000000..d3c47488c6 --- /dev/null +++ b/packages/polar/src/operations/customFieldscreate.ts @@ -0,0 +1,211 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomFieldscreateInput { + metadata?: Record; + type: string; + slug: string; + name: string; + organization_id?: string | null; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; +} +export const CustomFieldscreateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }).pipe( + T.Http({ method: "POST", path: "/v1/custom-fields/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomFieldscreateOutput = + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; +export const CustomFieldscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]) as unknown as Schema.Codec; + +// The operation +/** + * Create Custom Field + * + * Create a custom field. + * **Scopes**: `custom_fields:write` + */ +export const customFieldscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomFieldscreateInput, + outputSchema: CustomFieldscreateOutput, +})); diff --git a/packages/polar/src/operations/customFieldsdelete.ts b/packages/polar/src/operations/customFieldsdelete.ts new file mode 100644 index 0000000000..b414a2108f --- /dev/null +++ b/packages/polar/src/operations/customFieldsdelete.ts @@ -0,0 +1,33 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomFieldsdeleteInput { + id: string; +} +export const CustomFieldsdeleteInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/custom-fields/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomFieldsdeleteOutput = void; +export const CustomFieldsdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Custom Field + * + * Delete a custom field. + * **Scopes**: `custom_fields:write` + * + * @param id - The custom field ID. + */ +export const customFieldsdelete = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomFieldsdeleteInput, + outputSchema: CustomFieldsdeleteOutput, +})); diff --git a/packages/polar/src/operations/customFieldsget.ts b/packages/polar/src/operations/customFieldsget.ts new file mode 100644 index 0000000000..cc430c7faa --- /dev/null +++ b/packages/polar/src/operations/customFieldsget.ts @@ -0,0 +1,181 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomFieldsgetInput { + id: string; +} +export const CustomFieldsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/custom-fields/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomFieldsgetOutput = + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; +export const CustomFieldsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), +]) as unknown as Schema.Codec; + +// The operation +/** + * Get Custom Field + * + * Get a custom field by ID. + * **Scopes**: `custom_fields:read` `custom_fields:write` + * + * @param id - The custom field ID. + */ +export const customFieldsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomFieldsgetInput, + outputSchema: CustomFieldsgetOutput, +})); diff --git a/packages/polar/src/operations/customFieldslist.ts b/packages/polar/src/operations/customFieldslist.ts new file mode 100644 index 0000000000..b63d52ebdf --- /dev/null +++ b/packages/polar/src/operations/customFieldslist.ts @@ -0,0 +1,252 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomFieldslistInput { + organization_id?: string | ReadonlyArray | null; + query?: string | null; + type?: + | "text" + | "number" + | "date" + | "checkbox" + | "select" + | ReadonlyArray<"text" | "number" | "date" | "checkbox" | "select"> + | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "slug" + | "-slug" + | "name" + | "-name" + | "type" + | "-type" + > | null; +} +export const CustomFieldslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["text", "number", "date", "checkbox", "select"]), + Schema.Array( + Schema.Literals(["text", "number", "date", "checkbox", "select"]), + ), + ]), + ), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "slug", + "-slug", + "name", + "-name", + "type", + "-type", + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/custom-fields/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CustomFieldslistOutput { + items: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const CustomFieldslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + items: Schema.Array( + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }, +) as unknown as Schema.Codec; + +// The operation +/** + * List Custom Fields + * + * List custom fields. + * **Scopes**: `custom_fields:read` `custom_fields:write` + * + * @param organization_id - Filter by organization ID. + * @param query - Filter by custom field name or slug. + * @param type - Filter by custom field type. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customFieldslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomFieldslistInput, + outputSchema: CustomFieldslistOutput, +})); diff --git a/packages/polar/src/operations/customFieldsupdate.ts b/packages/polar/src/operations/customFieldsupdate.ts new file mode 100644 index 0000000000..99684df323 --- /dev/null +++ b/packages/polar/src/operations/customFieldsupdate.ts @@ -0,0 +1,217 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomFieldsupdateInput { + id: string; + metadata?: Record; + name?: string | null; + slug?: string | null; + type: string; + properties?: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + } | null; +} +export const CustomFieldsupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + name: Schema.optional(Schema.NullOr(Schema.String)), + slug: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.String, + properties: Schema.optional( + Schema.NullOr( + Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + ), + ), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/custom-fields/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomFieldsupdateOutput = + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; +export const CustomFieldsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]) as unknown as Schema.Codec; + +// The operation +/** + * Update Custom Field + * + * Update a custom field. + * **Scopes**: `custom_fields:write` + * + * @param id - The custom field ID. + */ +export const customFieldsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomFieldsupdateInput, + outputSchema: CustomFieldsupdateOutput, +})); diff --git a/packages/polar/src/operations/customerMetersget.ts b/packages/polar/src/operations/customerMetersget.ts new file mode 100644 index 0000000000..d9ad3e3851 --- /dev/null +++ b/packages/polar/src/operations/customerMetersget.ts @@ -0,0 +1,143 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerMetersgetInput { + id: string; +} +export const CustomerMetersgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + id: Schema.String.pipe(T.PathParam()), + }, +).pipe( + T.Http({ method: "GET", path: "/v1/customer-meters/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerMetersgetOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + meter_id: string; + consumed_units: number; + credited_units: number; + balance: number; + customer: unknown; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; +} +export const CustomerMetersgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + meter_id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + balance: Schema.Number, + customer: Schema.Unknown, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Customer Meter + * + * Get a customer meter by ID. + * **Scopes**: `customer_meters:read` + * + * @param id - The customer meter ID. + */ +export const customerMetersget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerMetersgetInput, + outputSchema: CustomerMetersgetOutput, +})); diff --git a/packages/polar/src/operations/customerMeterslist.ts b/packages/polar/src/operations/customerMeterslist.ts new file mode 100644 index 0000000000..370a9070e4 --- /dev/null +++ b/packages/polar/src/operations/customerMeterslist.ts @@ -0,0 +1,223 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerMeterslistInput { + organization_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + meter_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "modified_at" + | "-modified_at" + | "customer_id" + | "-customer_id" + | "customer_name" + | "-customer_name" + | "meter_id" + | "-meter_id" + | "meter_name" + | "-meter_name" + | "consumed_units" + | "-consumed_units" + | "credited_units" + | "-credited_units" + | "balance" + | "-balance" + > | null; +} +export const CustomerMeterslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + meter_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "modified_at", + "-modified_at", + "customer_id", + "-customer_id", + "customer_name", + "-customer_name", + "meter_id", + "-meter_id", + "meter_name", + "-meter_name", + "consumed_units", + "-consumed_units", + "credited_units", + "-credited_units", + "balance", + "-balance", + ]), + ), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-meters/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerMeterslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + meter_id: string; + consumed_units: number; + credited_units: number; + balance: number; + customer: unknown; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerMeterslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + meter_id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + balance: Schema.Number, + customer: Schema.Unknown, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Customer Meters + * + * List customer meters. + * **Scopes**: `customer_meters:read` + * + * @param organization_id - Filter by organization ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by external customer ID. + * @param meter_id - Filter by meter ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customerMeterslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerMeterslistInput, + outputSchema: CustomerMeterslistOutput, +})); diff --git a/packages/polar/src/operations/customerPortalbenefitGrantsget.ts b/packages/polar/src/operations/customerPortalbenefitGrantsget.ts new file mode 100644 index 0000000000..7daabe6fb9 --- /dev/null +++ b/packages/polar/src/operations/customerPortalbenefitGrantsget.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalbenefitGrantsgetInput { + id: string; +} +export const CustomerPortalbenefitGrantsgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/benefit-grants/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalbenefitGrantsgetOutput = unknown; +export const CustomerPortalbenefitGrantsgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Benefit Grant + * + * Get a benefit grant by ID for the authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param id - The benefit grant ID. + */ +export const customerPortalbenefitGrantsget = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalbenefitGrantsgetInput, + outputSchema: CustomerPortalbenefitGrantsgetOutput, + })); diff --git a/packages/polar/src/operations/customerPortalbenefitGrantslist.ts b/packages/polar/src/operations/customerPortalbenefitGrantslist.ts new file mode 100644 index 0000000000..f61ad40fda --- /dev/null +++ b/packages/polar/src/operations/customerPortalbenefitGrantslist.ts @@ -0,0 +1,150 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalbenefitGrantslistInput { + query?: string | null; + type?: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel" + | ReadonlyArray< + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel" + > + | null; + benefit_id?: string | ReadonlyArray | null; + checkout_id?: string | ReadonlyArray | null; + order_id?: string | ReadonlyArray | null; + subscription_id?: string | ReadonlyArray | null; + member_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "granted_at" + | "-granted_at" + | "type" + | "-type" + | "organization" + | "-organization" + | "product_benefit" + | "-product_benefit" + > | null; +} +export const CustomerPortalbenefitGrantslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + query: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + Schema.Array( + Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + ), + ]), + ), + ), + benefit_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + checkout_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + order_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + subscription_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + member_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "granted_at", + "-granted_at", + "type", + "-type", + "organization", + "-organization", + "product_benefit", + "-product_benefit", + ]), + ), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/benefit-grants/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalbenefitGrantslistOutput { + items: ReadonlyArray; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalbenefitGrantslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array(Schema.Unknown), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Benefit Grants + * + * List benefits grants of the authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param query - Filter by benefit description. + * @param type - Filter by benefit type. + * @param benefit_id - Filter by benefit ID. + * @param checkout_id - Filter by checkout ID. + * @param order_id - Filter by order ID. + * @param subscription_id - Filter by subscription ID. + * @param member_id - Filter by member ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customerPortalbenefitGrantslist = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalbenefitGrantslistInput, + outputSchema: CustomerPortalbenefitGrantslistOutput, + })); diff --git a/packages/polar/src/operations/customerPortalbenefitGrantsupdate.ts b/packages/polar/src/operations/customerPortalbenefitGrantsupdate.ts new file mode 100644 index 0000000000..fed7e9345f --- /dev/null +++ b/packages/polar/src/operations/customerPortalbenefitGrantsupdate.ts @@ -0,0 +1,45 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalbenefitGrantsupdateInput { + id: string; + benefit_type: string; + properties?: { invited_email: string }; +} +export const CustomerPortalbenefitGrantsupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + benefit_type: Schema.String, + properties: Schema.optional( + Schema.Struct({ + invited_email: Schema.String, + }), + ), + }).pipe( + T.Http({ + method: "PATCH", + path: "/v1/customer-portal/benefit-grants/{id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalbenefitGrantsupdateOutput = unknown; +export const CustomerPortalbenefitGrantsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Update Benefit Grant + * + * Update a benefit grant for the authenticated customer. + * **Scopes**: `customer_portal:write` + * + * @param id - The benefit grant ID. + */ +export const customerPortalbenefitGrantsupdate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalbenefitGrantsupdateInput, + outputSchema: CustomerPortalbenefitGrantsupdateOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomerMetersget.ts b/packages/polar/src/operations/customerPortalcustomerMetersget.ts new file mode 100644 index 0000000000..4af235585a --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomerMetersget.ts @@ -0,0 +1,64 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomerMetersgetInput { + id: string; +} +export const CustomerPortalcustomerMetersgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/meters/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomerMetersgetOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + meter_id: string; + consumed_units: number; + credited_units: number; + balance: number; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; +} +export const CustomerPortalcustomerMetersgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + meter_id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + balance: Schema.Number, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Customer Meter + * + * Get a meter by ID for the authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param id - The customer meter ID. + */ +export const customerPortalcustomerMetersget = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomerMetersgetInput, + outputSchema: CustomerPortalcustomerMetersgetOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomerMeterslist.ts b/packages/polar/src/operations/customerPortalcustomerMeterslist.ts new file mode 100644 index 0000000000..2621e31e16 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomerMeterslist.ts @@ -0,0 +1,125 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomerMeterslistInput { + meter_id?: string | ReadonlyArray | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "modified_at" + | "-modified_at" + | "meter_id" + | "-meter_id" + | "meter_name" + | "-meter_name" + | "consumed_units" + | "-consumed_units" + | "credited_units" + | "-credited_units" + | "balance" + | "-balance" + > | null; +} +export const CustomerPortalcustomerMeterslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + meter_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "modified_at", + "-modified_at", + "meter_id", + "-meter_id", + "meter_name", + "-meter_name", + "consumed_units", + "-consumed_units", + "credited_units", + "-credited_units", + "balance", + "-balance", + ]), + ), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/meters/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomerMeterslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + meter_id: string; + consumed_units: number; + credited_units: number; + balance: number; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalcustomerMeterslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + meter_id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + balance: Schema.Number, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Meters + * + * List meters of the authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param meter_id - Filter by meter ID. + * @param query - Filter by meter name. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customerPortalcustomerMeterslist = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomerMeterslistInput, + outputSchema: CustomerPortalcustomerMeterslistOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomerSessiongetAuthenticatedUser.ts b/packages/polar/src/operations/customerPortalcustomerSessiongetAuthenticatedUser.ts new file mode 100644 index 0000000000..8957a33810 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomerSessiongetAuthenticatedUser.ts @@ -0,0 +1,45 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomerSessiongetAuthenticatedUserInput {} +export const CustomerPortalcustomerSessiongetAuthenticatedUserInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({}).pipe( + T.Http({ + method: "GET", + path: "/v1/customer-portal/customer-session/user", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomerSessiongetAuthenticatedUserOutput { + type: string; + name: string | null; + email: string; + customer_id: string; + member_id?: string | null; + role?: string | null; +} +export const CustomerPortalcustomerSessiongetAuthenticatedUserOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + type: Schema.String, + name: Schema.NullOr(Schema.String), + email: Schema.String, + customer_id: Schema.String, + member_id: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional(Schema.NullOr(Schema.String)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Authenticated Portal User + * + * Get information about the currently authenticated portal user. + * **Scopes**: `customer_portal:read` `customer_portal:write` + */ +export const customerPortalcustomerSessiongetAuthenticatedUser = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomerSessiongetAuthenticatedUserInput, + outputSchema: CustomerPortalcustomerSessiongetAuthenticatedUserOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomerSessionintrospect.ts b/packages/polar/src/operations/customerPortalcustomerSessionintrospect.ts new file mode 100644 index 0000000000..35b8d90896 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomerSessionintrospect.ts @@ -0,0 +1,37 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomerSessionintrospectInput {} +export const CustomerPortalcustomerSessionintrospectInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({}).pipe( + T.Http({ + method: "GET", + path: "/v1/customer-portal/customer-session/introspect", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomerSessionintrospectOutput { + expires_at: string; + return_url: string | null; +} +export const CustomerPortalcustomerSessionintrospectOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + expires_at: Schema.String, + return_url: Schema.NullOr(Schema.String), + }) as unknown as Schema.Codec; + +// The operation +/** + * Introspect Customer Session + * + * Introspect the current session and return its information. + * **Scopes**: `customer_portal:read` `customer_portal:write` + */ +export const customerPortalcustomerSessionintrospect = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomerSessionintrospectInput, + outputSchema: CustomerPortalcustomerSessionintrospectOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersaddPaymentMethod.ts b/packages/polar/src/operations/customerPortalcustomersaddPaymentMethod.ts new file mode 100644 index 0000000000..5a2a26b5b9 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersaddPaymentMethod.ts @@ -0,0 +1,101 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CustomerPortalcustomersaddPaymentMethodInput { + confirmation_token_id: string; + set_default: boolean; + return_url: string; +} +export const CustomerPortalcustomersaddPaymentMethodInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + confirmation_token_id: Schema.String, + set_default: Schema.Boolean, + return_url: Schema.String, + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/customers/me/payment-methods", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalcustomersaddPaymentMethodOutput = + | { + status: string; + payment_method: + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + method_metadata: { + brand: string; + last4: string; + exp_month: number; + exp_year: number; + wallet?: string | null; + }; + } + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + }; + } + | { status: string; client_secret: Redacted.Redacted }; +export const CustomerPortalcustomersaddPaymentMethodOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + status: Schema.String, + payment_method: Schema.Union([ + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + exp_month: Schema.Number, + exp_year: Schema.Number, + wallet: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + }), + ]), + }), + Schema.Struct({ + status: Schema.String, + client_secret: SensitiveOutputString, + }), + ]) as unknown as Schema.Codec; + +// The operation +/** + * Add Customer Payment Method + * + * Add a payment method to the authenticated customer. + */ +export const customerPortalcustomersaddPaymentMethod = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomersaddPaymentMethodInput, + outputSchema: CustomerPortalcustomersaddPaymentMethodOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomerscheckEmailUpdate.ts b/packages/polar/src/operations/customerPortalcustomerscheckEmailUpdate.ts new file mode 100644 index 0000000000..b3b300740e --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomerscheckEmailUpdate.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomerscheckEmailUpdateInput { + token: string; +} +export const CustomerPortalcustomerscheckEmailUpdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + token: Schema.String, + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customer-portal/customers/me/email-update/check", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalcustomerscheckEmailUpdateOutput = void; +export const CustomerPortalcustomerscheckEmailUpdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Check Email Change Token + * + * Check if an email change verification token is still valid. + */ +export const customerPortalcustomerscheckEmailUpdate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomerscheckEmailUpdateInput, + outputSchema: CustomerPortalcustomerscheckEmailUpdateOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersconfirmPaymentMethod.ts b/packages/polar/src/operations/customerPortalcustomersconfirmPaymentMethod.ts new file mode 100644 index 0000000000..862caadf0c --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersconfirmPaymentMethod.ts @@ -0,0 +1,99 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface CustomerPortalcustomersconfirmPaymentMethodInput { + setup_intent_id: string; + set_default: boolean; +} +export const CustomerPortalcustomersconfirmPaymentMethodInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + setup_intent_id: Schema.String, + set_default: Schema.Boolean, + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/customers/me/payment-methods/confirm", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalcustomersconfirmPaymentMethodOutput = + | { + status: string; + payment_method: + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + method_metadata: { + brand: string; + last4: string; + exp_month: number; + exp_year: number; + wallet?: string | null; + }; + } + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + }; + } + | { status: string; client_secret: Redacted.Redacted }; +export const CustomerPortalcustomersconfirmPaymentMethodOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + status: Schema.String, + payment_method: Schema.Union([ + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + exp_month: Schema.Number, + exp_year: Schema.Number, + wallet: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + }), + ]), + }), + Schema.Struct({ + status: Schema.String, + client_secret: SensitiveOutputString, + }), + ]) as unknown as Schema.Codec; + +// The operation +/** + * Confirm Customer Payment Method + * + * Confirm a payment method for the authenticated customer. + */ +export const customerPortalcustomersconfirmPaymentMethod = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomersconfirmPaymentMethodInput, + outputSchema: CustomerPortalcustomersconfirmPaymentMethodOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersdeletePaymentMethod.ts b/packages/polar/src/operations/customerPortalcustomersdeletePaymentMethod.ts new file mode 100644 index 0000000000..cab5f50a0f --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersdeletePaymentMethod.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomersdeletePaymentMethodInput { + id: string; +} +export const CustomerPortalcustomersdeletePaymentMethodInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "DELETE", + path: "/v1/customer-portal/customers/me/payment-methods/{id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalcustomersdeletePaymentMethodOutput = void; +export const CustomerPortalcustomersdeletePaymentMethodOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Customer Payment Method + * + * Delete a payment method from the authenticated customer. + */ +export const customerPortalcustomersdeletePaymentMethod = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomersdeletePaymentMethodInput, + outputSchema: CustomerPortalcustomersdeletePaymentMethodOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersget.ts b/packages/polar/src/operations/customerPortalcustomersget.ts new file mode 100644 index 0000000000..de0cf99c8e --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersget.ts @@ -0,0 +1,583 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomersgetInput {} +export const CustomerPortalcustomersgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({}).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/customers/me" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomersgetOutput { + created_at: string; + modified_at: string | null; + id: string; + email: string | null; + email_verified: boolean; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + oauth_accounts: Record< + string, + { account_id: string; account_username: string | null } + >; + default_payment_method_id?: string | null; + type?: "individual" | "team" | null; + locale?: string | null; +} +export const CustomerPortalcustomersgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + email: Schema.NullOr(Schema.String), + email_verified: Schema.Boolean, + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + oauth_accounts: Schema.Record( + Schema.String, + Schema.Struct({ + account_id: Schema.String, + account_username: Schema.NullOr(Schema.String), + }), + ), + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.optional( + Schema.NullOr(Schema.Literals(["individual", "team"])), + ), + locale: Schema.optional(Schema.NullOr(Schema.String)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Customer + * + * Get authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + */ +export const customerPortalcustomersget = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalcustomersgetInput, + outputSchema: CustomerPortalcustomersgetOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalcustomerslistPaymentMethods.ts b/packages/polar/src/operations/customerPortalcustomerslistPaymentMethods.ts new file mode 100644 index 0000000000..5006365018 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomerslistPaymentMethods.ts @@ -0,0 +1,98 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomerslistPaymentMethodsInput { + page?: number; + limit?: number; +} +export const CustomerPortalcustomerslistPaymentMethodsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customer-portal/customers/me/payment-methods", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomerslistPaymentMethodsOutput { + items: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + method_metadata: { + brand: string; + last4: string; + exp_month: number; + exp_year: number; + wallet?: string | null; + }; + } + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalcustomerslistPaymentMethodsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Union([ + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + exp_month: Schema.Number, + exp_year: Schema.Number, + wallet: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + }), + ]), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Customer Payment Methods + * + * Get saved payment methods of the authenticated customer. + * + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerPortalcustomerslistPaymentMethods = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomerslistPaymentMethodsInput, + outputSchema: CustomerPortalcustomerslistPaymentMethodsOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersrequestEmailUpdate.ts b/packages/polar/src/operations/customerPortalcustomersrequestEmailUpdate.ts new file mode 100644 index 0000000000..7856c610e0 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersrequestEmailUpdate.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomersrequestEmailUpdateInput { + email: string; +} +export const CustomerPortalcustomersrequestEmailUpdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + email: Schema.String, + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/customers/me/email-update/request", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalcustomersrequestEmailUpdateOutput = void; +export const CustomerPortalcustomersrequestEmailUpdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Request Email Change + * + * Request an email change for the authenticated customer. + */ +export const customerPortalcustomersrequestEmailUpdate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomersrequestEmailUpdateInput, + outputSchema: CustomerPortalcustomersrequestEmailUpdateOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersupdate.ts b/packages/polar/src/operations/customerPortalcustomersupdate.ts new file mode 100644 index 0000000000..b6df889d9e --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersupdate.ts @@ -0,0 +1,1098 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomersupdateInput { + billing_name?: string | null; + billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id?: string | null; + default_payment_method_id?: string | null; +} +export const CustomerPortalcustomersupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + billing_name: Schema.optional(Schema.NullOr(Schema.String)), + billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + tax_id: Schema.optional(Schema.NullOr(Schema.String)), + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/customer-portal/customers/me" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomersupdateOutput { + created_at: string; + modified_at: string | null; + id: string; + email: string | null; + email_verified: boolean; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + oauth_accounts: Record< + string, + { account_id: string; account_username: string | null } + >; + default_payment_method_id?: string | null; + type?: "individual" | "team" | null; + locale?: string | null; +} +export const CustomerPortalcustomersupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + email: Schema.NullOr(Schema.String), + email_verified: Schema.Boolean, + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + oauth_accounts: Schema.Record( + Schema.String, + Schema.Struct({ + account_id: Schema.String, + account_username: Schema.NullOr(Schema.String), + }), + ), + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.optional( + Schema.NullOr(Schema.Literals(["individual", "team"])), + ), + locale: Schema.optional(Schema.NullOr(Schema.String)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Customer + * + * Update authenticated customer. + */ +export const customerPortalcustomersupdate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomersupdateInput, + outputSchema: CustomerPortalcustomersupdateOutput, + })); diff --git a/packages/polar/src/operations/customerPortalcustomersverifyEmailUpdate.ts b/packages/polar/src/operations/customerPortalcustomersverifyEmailUpdate.ts new file mode 100644 index 0000000000..aec3e6de52 --- /dev/null +++ b/packages/polar/src/operations/customerPortalcustomersverifyEmailUpdate.ts @@ -0,0 +1,38 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalcustomersverifyEmailUpdateInput { + token: string; +} +export const CustomerPortalcustomersverifyEmailUpdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + token: Schema.String, + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/customers/me/email-update/verify", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalcustomersverifyEmailUpdateOutput { + token: string; +} +export const CustomerPortalcustomersverifyEmailUpdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + token: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Verify Email Change + * + * Verify an email change using the token from the verification email. + */ +export const customerPortalcustomersverifyEmailUpdate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalcustomersverifyEmailUpdateInput, + outputSchema: CustomerPortalcustomersverifyEmailUpdateOutput, + })); diff --git a/packages/polar/src/operations/customerPortaldownloadableslist.ts b/packages/polar/src/operations/customerPortaldownloadableslist.ts new file mode 100644 index 0000000000..e076f9530e --- /dev/null +++ b/packages/polar/src/operations/customerPortaldownloadableslist.ts @@ -0,0 +1,113 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortaldownloadableslistInput { + benefit_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; +} +export const CustomerPortaldownloadableslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + benefit_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/downloadables/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortaldownloadableslistOutput { + items: ReadonlyArray<{ + id: string; + benefit_id: string; + file: { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + download: { + url: string; + headers?: Record; + expires_at: string; + }; + version: string | null; + is_uploaded: boolean; + service: + | "downloadable" + | "product_media" + | "organization_avatar" + | "support_case_attachment"; + size_readable: string; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortaldownloadableslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + benefit_id: Schema.String, + file: Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + download: Schema.Struct({ + url: Schema.String, + headers: Schema.optional( + Schema.Record(Schema.String, Schema.String), + ), + expires_at: Schema.String, + }), + version: Schema.NullOr(Schema.String), + is_uploaded: Schema.Boolean, + service: Schema.Literals([ + "downloadable", + "product_media", + "organization_avatar", + "support_case_attachment", + ]), + size_readable: Schema.String, + }), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Downloadables + * + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param benefit_id - Filter by benefit ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerPortaldownloadableslist = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortaldownloadableslistInput, + outputSchema: CustomerPortaldownloadableslistOutput, + })); diff --git a/packages/polar/src/operations/customerPortallicenseKeysactivate.ts b/packages/polar/src/operations/customerPortallicenseKeysactivate.ts new file mode 100644 index 0000000000..86364c57cf --- /dev/null +++ b/packages/polar/src/operations/customerPortallicenseKeysactivate.ts @@ -0,0 +1,665 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortallicenseKeysactivateInput { + key: string; + organization_id: string; + label: string; + conditions?: Record; + meta?: Record; +} +export const CustomerPortallicenseKeysactivateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + key: Schema.String, + organization_id: Schema.String, + label: Schema.String, + conditions: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + meta: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/license-keys/activate", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortallicenseKeysactivateOutput { + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + license_key: { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + }; +} +export const CustomerPortallicenseKeysactivateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + license_key: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Activate License Key + * + * Activate a license key instance. + * > This endpoint doesn't require authentication and can be safely used on a public + * > client, like a desktop application or a mobile app. + * > If you plan to validate a license key on a server, use the `/v1/license-keys/activate` + * > endpoint instead. + */ +export const customerPortallicenseKeysactivate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortallicenseKeysactivateInput, + outputSchema: CustomerPortallicenseKeysactivateOutput, + })); diff --git a/packages/polar/src/operations/customerPortallicenseKeysdeactivate.ts b/packages/polar/src/operations/customerPortallicenseKeysdeactivate.ts new file mode 100644 index 0000000000..796c47a329 --- /dev/null +++ b/packages/polar/src/operations/customerPortallicenseKeysdeactivate.ts @@ -0,0 +1,42 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortallicenseKeysdeactivateInput { + key: string; + organization_id: string; + activation_id: string; +} +export const CustomerPortallicenseKeysdeactivateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + key: Schema.String, + organization_id: Schema.String, + activation_id: Schema.String, + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/license-keys/deactivate", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortallicenseKeysdeactivateOutput = void; +export const CustomerPortallicenseKeysdeactivateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Deactivate License Key + * + * Deactivate a license key instance. + * > This endpoint doesn't require authentication and can be safely used on a public + * > client, like a desktop application or a mobile app. + * > If you plan to validate a license key on a server, use the `/v1/license-keys/deactivate` + * > endpoint instead. + */ +export const customerPortallicenseKeysdeactivate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortallicenseKeysdeactivateInput, + outputSchema: CustomerPortallicenseKeysdeactivateOutput, + })); diff --git a/packages/polar/src/operations/customerPortallicenseKeysget.ts b/packages/polar/src/operations/customerPortallicenseKeysget.ts new file mode 100644 index 0000000000..b08510e072 --- /dev/null +++ b/packages/polar/src/operations/customerPortallicenseKeysget.ts @@ -0,0 +1,641 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortallicenseKeysgetInput { + id: string; +} +export const CustomerPortallicenseKeysgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/license-keys/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortallicenseKeysgetOutput { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + activations: ReadonlyArray<{ + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + }>; +} +export const CustomerPortallicenseKeysgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + activations: Schema.Array( + Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get License Key + * + * Get a license key. + * **Scopes**: `customer_portal:read` `customer_portal:write` + */ +export const customerPortallicenseKeysget = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortallicenseKeysgetInput, + outputSchema: CustomerPortallicenseKeysgetOutput, + })); diff --git a/packages/polar/src/operations/customerPortallicenseKeyslist.ts b/packages/polar/src/operations/customerPortallicenseKeyslist.ts new file mode 100644 index 0000000000..da1cc97af6 --- /dev/null +++ b/packages/polar/src/operations/customerPortallicenseKeyslist.ts @@ -0,0 +1,640 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortallicenseKeyslistInput { + benefit_id?: string | null; + page?: number; + limit?: number; +} +export const CustomerPortallicenseKeyslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + benefit_id: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/license-keys/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortallicenseKeyslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortallicenseKeyslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List License Keys + * + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param benefit_id - Filter by a specific benefit + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerPortallicenseKeyslist = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortallicenseKeyslistInput, + outputSchema: CustomerPortallicenseKeyslistOutput, + })); diff --git a/packages/polar/src/operations/customerPortallicenseKeysvalidate.ts b/packages/polar/src/operations/customerPortallicenseKeysvalidate.ts new file mode 100644 index 0000000000..bc32d8e052 --- /dev/null +++ b/packages/polar/src/operations/customerPortallicenseKeysvalidate.ts @@ -0,0 +1,666 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortallicenseKeysvalidateInput { + key: string; + organization_id: string; + activation_id?: string | null; + benefit_id?: string | null; + customer_id?: string | null; + increment_usage?: number | null; + conditions?: Record; +} +export const CustomerPortallicenseKeysvalidateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + key: Schema.String, + organization_id: Schema.String, + activation_id: Schema.optional(Schema.NullOr(Schema.String)), + benefit_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_id: Schema.optional(Schema.NullOr(Schema.String)), + increment_usage: Schema.optional(Schema.NullOr(Schema.Number)), + conditions: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/license-keys/validate", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortallicenseKeysvalidateOutput { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + activation?: { + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + } | null; +} +export const CustomerPortallicenseKeysvalidateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + activation: Schema.optional( + Schema.NullOr( + Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + }), + ), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Validate License Key + * + * Validate a license key. + * > This endpoint doesn't require authentication and can be safely used on a public + * > client, like a desktop application or a mobile app. + * > If you plan to validate a license key on a server, use the `/v1/license-keys/validate` + * > endpoint instead. + */ +export const customerPortallicenseKeysvalidate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortallicenseKeysvalidateInput, + outputSchema: CustomerPortallicenseKeysvalidateOutput, + })); diff --git a/packages/polar/src/operations/customerPortalmembersaddMember.ts b/packages/polar/src/operations/customerPortalmembersaddMember.ts new file mode 100644 index 0000000000..b130f47282 --- /dev/null +++ b/packages/polar/src/operations/customerPortalmembersaddMember.ts @@ -0,0 +1,55 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalmembersaddMemberInput { + email: string; + name?: string | null; + role?: "owner" | "billing_manager" | "member"; +} +export const CustomerPortalmembersaddMemberInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + email: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional( + Schema.Literals(["owner", "billing_manager", "member"]), + ), + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-portal/members" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalmembersaddMemberOutput { + created_at: string; + modified_at: string | null; + id: string; + email: string; + name: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomerPortalmembersaddMemberOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Add Member + * + * Add a new member to the customer's team. + * Only available to owners and billing managers of team customers. + * Rules: + * - Cannot add a member with the owner role (there must be exactly one owner) + * - If a member with this email already exists, the existing member is returned + */ +export const customerPortalmembersaddMember = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalmembersaddMemberInput, + outputSchema: CustomerPortalmembersaddMemberOutput, + })); diff --git a/packages/polar/src/operations/customerPortalmemberslistMembers.ts b/packages/polar/src/operations/customerPortalmemberslistMembers.ts new file mode 100644 index 0000000000..6aa596706c --- /dev/null +++ b/packages/polar/src/operations/customerPortalmemberslistMembers.ts @@ -0,0 +1,62 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalmemberslistMembersInput { + page?: number; + limit?: number; +} +export const CustomerPortalmemberslistMembersInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/members" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalmemberslistMembersOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + email: string; + name: string | null; + role: "owner" | "billing_manager" | "member"; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalmemberslistMembersOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Members + * + * List all members of the customer's team. + * Only available to owners and billing managers of team customers. + * + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerPortalmemberslistMembers = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalmemberslistMembersInput, + outputSchema: CustomerPortalmemberslistMembersOutput, + })); diff --git a/packages/polar/src/operations/customerPortalmembersremoveMember.ts b/packages/polar/src/operations/customerPortalmembersremoveMember.ts new file mode 100644 index 0000000000..f3ddf2955e --- /dev/null +++ b/packages/polar/src/operations/customerPortalmembersremoveMember.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalmembersremoveMemberInput { + id: string; +} +export const CustomerPortalmembersremoveMemberInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/customer-portal/members/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalmembersremoveMemberOutput = void; +export const CustomerPortalmembersremoveMemberOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Remove Member + * + * Remove a member from the team. + * Only available to owners and billing managers of team customers. + * Rules: + * - Cannot remove yourself + * - Cannot remove the only owner + */ +export const customerPortalmembersremoveMember = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalmembersremoveMemberInput, + outputSchema: CustomerPortalmembersremoveMemberOutput, + })); diff --git a/packages/polar/src/operations/customerPortalmembersupdateMember.ts b/packages/polar/src/operations/customerPortalmembersupdateMember.ts new file mode 100644 index 0000000000..8c4e3dc180 --- /dev/null +++ b/packages/polar/src/operations/customerPortalmembersupdateMember.ts @@ -0,0 +1,55 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalmembersupdateMemberInput { + id: string; + name?: string | null; + role?: "owner" | "billing_manager" | "member" | null; +} +export const CustomerPortalmembersupdateMemberInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + name: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional( + Schema.NullOr(Schema.Literals(["owner", "billing_manager", "member"])), + ), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/customer-portal/members/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalmembersupdateMemberOutput { + created_at: string; + modified_at: string | null; + id: string; + email: string; + name: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomerPortalmembersupdateMemberOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Member + * + * Update a member's name or role. + * Only available to owners and billing managers of team customers. + * Rules: + * - Cannot modify your own role (to prevent self-demotion) + * - Customer must have exactly one owner at all times + */ +export const customerPortalmembersupdateMember = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalmembersupdateMemberInput, + outputSchema: CustomerPortalmembersupdateMemberOutput, + })); diff --git a/packages/polar/src/operations/customerPortalordersconfirmRetryPayment.ts b/packages/polar/src/operations/customerPortalordersconfirmRetryPayment.ts new file mode 100644 index 0000000000..11548978f6 --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersconfirmRetryPayment.ts @@ -0,0 +1,50 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersconfirmRetryPaymentInput { + id: string; + confirmation_token_id?: string | null; + payment_method_id?: string | null; + payment_processor?: "stripe"; +} +export const CustomerPortalordersconfirmRetryPaymentInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + confirmation_token_id: Schema.optional(Schema.NullOr(Schema.String)), + payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + payment_processor: Schema.optional(Schema.Literals(["stripe"])), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/orders/{id}/confirm-payment", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalordersconfirmRetryPaymentOutput { + status: string; + client_secret?: string | null; + error?: string | null; +} +export const CustomerPortalordersconfirmRetryPaymentOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + status: Schema.String, + client_secret: Schema.optional(Schema.NullOr(Schema.String)), + error: Schema.optional(Schema.NullOr(Schema.String)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Confirm Retry Payment + * + * Confirm a retry payment using a Stripe confirmation token. + * + * @param id - The order ID. + */ +export const customerPortalordersconfirmRetryPayment = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalordersconfirmRetryPaymentInput, + outputSchema: CustomerPortalordersconfirmRetryPaymentOutput, + })); diff --git a/packages/polar/src/operations/customerPortalordersgenerateInvoice.ts b/packages/polar/src/operations/customerPortalordersgenerateInvoice.ts new file mode 100644 index 0000000000..c069e7c5c8 --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersgenerateInvoice.ts @@ -0,0 +1,33 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersgenerateInvoiceInput { + id: string; +} +export const CustomerPortalordersgenerateInvoiceInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-portal/orders/{id}/invoice" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomerPortalordersgenerateInvoiceOutput = void; +export const CustomerPortalordersgenerateInvoiceOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Generate Order Invoice + * + * Trigger generation of an order's invoice. + * + * @param id - The order ID. + */ +export const customerPortalordersgenerateInvoice = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalordersgenerateInvoiceInput, + outputSchema: CustomerPortalordersgenerateInvoiceOutput, + })); diff --git a/packages/polar/src/operations/customerPortalordersget.ts b/packages/polar/src/operations/customerPortalordersget.ts new file mode 100644 index 0000000000..38fe079871 --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersget.ts @@ -0,0 +1,762 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersgetInput { + id: string; +} +export const CustomerPortalordersgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/orders/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalordersgetOutput { + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + product: unknown; + subscription: { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; +} +export const CustomerPortalordersgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + product: Schema.Unknown, + subscription: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Order + * + * Get an order by ID for the authenticated customer. + * + * @param id - The order ID. + */ +export const customerPortalordersget = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalordersgetInput, + outputSchema: CustomerPortalordersgetOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalordersgetPaymentStatus.ts b/packages/polar/src/operations/customerPortalordersgetPaymentStatus.ts new file mode 100644 index 0000000000..bbb818a510 --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersgetPaymentStatus.ts @@ -0,0 +1,42 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersgetPaymentStatusInput { + id: string; +} +export const CustomerPortalordersgetPaymentStatusInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customer-portal/orders/{id}/payment-status", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalordersgetPaymentStatusOutput { + status: string; + error?: string | null; +} +export const CustomerPortalordersgetPaymentStatusOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + status: Schema.String, + error: Schema.optional(Schema.NullOr(Schema.String)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Order Payment Status + * + * Get the current payment status for an order. + * + * @param id - The order ID. + */ +export const customerPortalordersgetPaymentStatus = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalordersgetPaymentStatusInput, + outputSchema: CustomerPortalordersgetPaymentStatusOutput, + })); diff --git a/packages/polar/src/operations/customerPortalordersinvoice.ts b/packages/polar/src/operations/customerPortalordersinvoice.ts new file mode 100644 index 0000000000..9577605f28 --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersinvoice.ts @@ -0,0 +1,38 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersinvoiceInput { + id: string; +} +export const CustomerPortalordersinvoiceInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/orders/{id}/invoice" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalordersinvoiceOutput { + url: string; +} +export const CustomerPortalordersinvoiceOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + url: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Order Invoice + * + * Get an order's invoice data. + * + * @param id - The order ID. + */ +export const customerPortalordersinvoice = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalordersinvoiceInput, + outputSchema: CustomerPortalordersinvoiceOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalorderslist.ts b/packages/polar/src/operations/customerPortalorderslist.ts new file mode 100644 index 0000000000..bf06867245 --- /dev/null +++ b/packages/polar/src/operations/customerPortalorderslist.ts @@ -0,0 +1,945 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalorderslistInput { + product_id?: string | ReadonlyArray | null; + product_billing_type?: + | "one_time" + | "recurring" + | ReadonlyArray<"one_time" | "recurring"> + | null; + subscription_id?: string | ReadonlyArray | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "amount" + | "-amount" + | "net_amount" + | "-net_amount" + | "product" + | "-product" + | "subscription" + | "-subscription" + > | null; +} +export const CustomerPortalorderslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_billing_type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["one_time", "recurring"]), + Schema.Array(Schema.Literals(["one_time", "recurring"])), + ]), + ), + ), + subscription_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "amount", + "-amount", + "net_amount", + "-net_amount", + "product", + "-product", + "subscription", + "-subscription", + ]), + ), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/orders/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalorderslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + product: unknown; + subscription: { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalorderslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + product: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional( + Schema.Boolean, + ), + }), + ), + }), + }), + ), + subscription: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Orders + * + * List orders of the authenticated customer. + * + * @param product_id - Filter by product ID. + * @param product_billing_type - Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. + * @param subscription_id - Filter by subscription ID. + * @param query - Search by product or organization name. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customerPortalorderslist = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalorderslistInput, + outputSchema: CustomerPortalorderslistOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalordersreceipt.ts b/packages/polar/src/operations/customerPortalordersreceipt.ts new file mode 100644 index 0000000000..3edc9edcc4 --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersreceipt.ts @@ -0,0 +1,38 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersreceiptInput { + id: string; +} +export const CustomerPortalordersreceiptInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/orders/{id}/receipt" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalordersreceiptOutput { + url: string; +} +export const CustomerPortalordersreceiptOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + url: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Order Receipt + * + * Get a presigned URL to download an order's receipt PDF. + * + * @param id - The order ID. + */ +export const customerPortalordersreceipt = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalordersreceiptInput, + outputSchema: CustomerPortalordersreceiptOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalordersupdate.ts b/packages/polar/src/operations/customerPortalordersupdate.ts new file mode 100644 index 0000000000..c021d3f62c --- /dev/null +++ b/packages/polar/src/operations/customerPortalordersupdate.ts @@ -0,0 +1,1273 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalordersupdateInput { + id: string; + billing_name?: string | null; + billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; +} +export const CustomerPortalordersupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + billing_name: Schema.optional(Schema.NullOr(Schema.String)), + billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/customer-portal/orders/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalordersupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + product: unknown; + subscription: { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; +} +export const CustomerPortalordersupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + product: Schema.Unknown, + subscription: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Order + * + * Update an order for the authenticated customer. + * + * @param id - The order ID. + */ +export const customerPortalordersupdate = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalordersupdateInput, + outputSchema: CustomerPortalordersupdateOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalorganizationsget.ts b/packages/polar/src/operations/customerPortalorganizationsget.ts new file mode 100644 index 0000000000..d113eefe7c --- /dev/null +++ b/packages/polar/src/operations/customerPortalorganizationsget.ts @@ -0,0 +1,453 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalorganizationsgetInput { + slug: string; +} +export const CustomerPortalorganizationsgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + slug: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/organizations/{slug}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalorganizationsgetOutput { + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + organization_features?: { + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + }; + }; + products: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + }>; +} +export const CustomerPortalorganizationsgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + }), + ), + }), + products: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Organization + * + * Get a customer portal's organization by slug. + * + * @param slug - The organization slug. + */ +export const customerPortalorganizationsget = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalorganizationsgetInput, + outputSchema: CustomerPortalorganizationsgetOutput, + })); diff --git a/packages/polar/src/operations/customerPortalseatsassignSeat.ts b/packages/polar/src/operations/customerPortalseatsassignSeat.ts new file mode 100644 index 0000000000..3ee6502fe8 --- /dev/null +++ b/packages/polar/src/operations/customerPortalseatsassignSeat.ts @@ -0,0 +1,101 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalseatsassignSeatInput { + subscription_id?: string | null; + order_id?: string | null; + email?: string | null; + external_customer_id?: string | null; + customer_id?: string | null; + external_member_id?: string | null; + member_id?: string | null; + metadata?: Record | null; + immediate_claim?: boolean; + checkout_id?: string | null; +} +export const CustomerPortalseatsassignSeatInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + subscription_id: Schema.optional(Schema.NullOr(Schema.String)), + order_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + external_customer_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_id: Schema.optional(Schema.NullOr(Schema.String)), + external_member_id: Schema.optional(Schema.NullOr(Schema.String)), + member_id: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.optional( + Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + ), + immediate_claim: Schema.optional(Schema.Boolean), + checkout_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-portal/seats" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalseatsassignSeatOutput { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; +} +export const CustomerPortalseatsassignSeatOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Assign Seat + */ +export const customerPortalseatsassignSeat = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalseatsassignSeatInput, + outputSchema: CustomerPortalseatsassignSeatOutput, + })); diff --git a/packages/polar/src/operations/customerPortalseatslistClaimedSubscriptions.ts b/packages/polar/src/operations/customerPortalseatslistClaimedSubscriptions.ts new file mode 100644 index 0000000000..55858a20b9 --- /dev/null +++ b/packages/polar/src/operations/customerPortalseatslistClaimedSubscriptions.ts @@ -0,0 +1,716 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalseatslistClaimedSubscriptionsInput { + page?: number; + limit?: number; +} +export const CustomerPortalseatslistClaimedSubscriptionsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/seats/subscriptions" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalseatslistClaimedSubscriptionsOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + organization_features?: { + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + }; + }; + }; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalseatslistClaimedSubscriptionsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + }), + ), + }), + }), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Claimed Subscriptions + * + * List all subscriptions where the authenticated customer has claimed a seat. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerPortalseatslistClaimedSubscriptions = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalseatslistClaimedSubscriptionsInput, + outputSchema: CustomerPortalseatslistClaimedSubscriptionsOutput, + })); diff --git a/packages/polar/src/operations/customerPortalseatslistSeats.ts b/packages/polar/src/operations/customerPortalseatslistSeats.ts new file mode 100644 index 0000000000..e18d4b6cd8 --- /dev/null +++ b/packages/polar/src/operations/customerPortalseatslistSeats.ts @@ -0,0 +1,100 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalseatslistSeatsInput { + subscription_id?: string | null; + order_id?: string | null; +} +export const CustomerPortalseatslistSeatsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + subscription_id: Schema.optional(Schema.NullOr(Schema.String)), + order_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/seats" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalseatslistSeatsOutput { + seats: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; + }>; + available_seats: number; + total_seats: number; +} +export const CustomerPortalseatslistSeatsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seats: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr( + Schema.Record(Schema.String, Schema.Unknown), + ), + }), + ), + available_seats: Schema.Number, + total_seats: Schema.Number, + }) as unknown as Schema.Codec; + +// The operation +/** + * List Seats + * + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param subscription_id - Subscription ID + * @param order_id - Order ID + */ +export const customerPortalseatslistSeats = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalseatslistSeatsInput, + outputSchema: CustomerPortalseatslistSeatsOutput, + })); diff --git a/packages/polar/src/operations/customerPortalseatsresendInvitation.ts b/packages/polar/src/operations/customerPortalseatsresendInvitation.ts new file mode 100644 index 0000000000..9d1378b113 --- /dev/null +++ b/packages/polar/src/operations/customerPortalseatsresendInvitation.ts @@ -0,0 +1,84 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalseatsresendInvitationInput { + seat_id: string; +} +export const CustomerPortalseatsresendInvitationInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seat_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customer-portal/seats/{seat_id}/resend", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalseatsresendInvitationOutput { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; +} +export const CustomerPortalseatsresendInvitationOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Resend Invitation + */ +export const customerPortalseatsresendInvitation = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalseatsresendInvitationInput, + outputSchema: CustomerPortalseatsresendInvitationOutput, + })); diff --git a/packages/polar/src/operations/customerPortalseatsrevokeSeat.ts b/packages/polar/src/operations/customerPortalseatsrevokeSeat.ts new file mode 100644 index 0000000000..f3ce9374c0 --- /dev/null +++ b/packages/polar/src/operations/customerPortalseatsrevokeSeat.ts @@ -0,0 +1,81 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalseatsrevokeSeatInput { + seat_id: string; +} +export const CustomerPortalseatsrevokeSeatInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seat_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/customer-portal/seats/{seat_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalseatsrevokeSeatOutput { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; +} +export const CustomerPortalseatsrevokeSeatOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Revoke Seat + */ +export const customerPortalseatsrevokeSeat = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalseatsrevokeSeatInput, + outputSchema: CustomerPortalseatsrevokeSeatOutput, + })); diff --git a/packages/polar/src/operations/customerPortalsubscriptionscancel.ts b/packages/polar/src/operations/customerPortalsubscriptionscancel.ts new file mode 100644 index 0000000000..cba2d1b09d --- /dev/null +++ b/packages/polar/src/operations/customerPortalsubscriptionscancel.ts @@ -0,0 +1,837 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalsubscriptionscancelInput { + id: string; +} +export const CustomerPortalsubscriptionscancelInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "DELETE", + path: "/v1/customer-portal/subscriptions/{id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalsubscriptionscancelOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + organization_features?: { + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + }; + }; + }; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const CustomerPortalsubscriptionscancelOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + }), + ), + }), + }), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Cancel Subscription + * + * Cancel a subscription of the authenticated customer. + * + * @param id - The subscription ID. + */ +export const customerPortalsubscriptionscancel = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalsubscriptionscancelInput, + outputSchema: CustomerPortalsubscriptionscancelOutput, + })); diff --git a/packages/polar/src/operations/customerPortalsubscriptionsget.ts b/packages/polar/src/operations/customerPortalsubscriptionsget.ts new file mode 100644 index 0000000000..a8dd0e92ea --- /dev/null +++ b/packages/polar/src/operations/customerPortalsubscriptionsget.ts @@ -0,0 +1,835 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalsubscriptionsgetInput { + id: string; +} +export const CustomerPortalsubscriptionsgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/subscriptions/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalsubscriptionsgetOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + organization_features?: { + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + }; + }; + }; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const CustomerPortalsubscriptionsgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + }), + ), + }), + }), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Subscription + * + * Get a subscription for the authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param id - The subscription ID. + */ +export const customerPortalsubscriptionsget = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalsubscriptionsgetInput, + outputSchema: CustomerPortalsubscriptionsgetOutput, + })); diff --git a/packages/polar/src/operations/customerPortalsubscriptionslist.ts b/packages/polar/src/operations/customerPortalsubscriptionslist.ts new file mode 100644 index 0000000000..35d9b78ebb --- /dev/null +++ b/packages/polar/src/operations/customerPortalsubscriptionslist.ts @@ -0,0 +1,758 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalsubscriptionslistInput { + product_id?: string | ReadonlyArray | null; + active?: boolean | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "started_at" + | "-started_at" + | "amount" + | "-amount" + | "status" + | "-status" + | "organization" + | "-organization" + | "product" + | "-product" + > | null; +} +export const CustomerPortalsubscriptionslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + active: Schema.optional(Schema.NullOr(Schema.Boolean)), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "started_at", + "-started_at", + "amount", + "-amount", + "status", + "-status", + "organization", + "-organization", + "product", + "-product", + ]), + ), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/subscriptions/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalsubscriptionslistOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + organization_features?: { + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + }; + }; + }; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalsubscriptionslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + }), + ), + }), + }), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Subscriptions + * + * List subscriptions of the authenticated customer. + * **Scopes**: `customer_portal:read` `customer_portal:write` + * + * @param product_id - Filter by product ID. + * @param active - Filter by active or cancelled subscription. + * @param query - Search by product or organization name. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customerPortalsubscriptionslist = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalsubscriptionslistInput, + outputSchema: CustomerPortalsubscriptionslistOutput, + })); diff --git a/packages/polar/src/operations/customerPortalsubscriptionsupdate.ts b/packages/polar/src/operations/customerPortalsubscriptionsupdate.ts new file mode 100644 index 0000000000..5662d624dc --- /dev/null +++ b/packages/polar/src/operations/customerPortalsubscriptionsupdate.ts @@ -0,0 +1,874 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalsubscriptionsupdateInput { + id: string; + product_id?: string; + seats?: number; + cancel_at_period_end?: boolean | null; + cancellation_reason?: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + cancellation_comment?: string | null; + pause_at_period_end?: boolean; + resumes_at?: string | null; + resume?: boolean; + pending_update?: unknown; +} +export const CustomerPortalsubscriptionsupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + product_id: Schema.optional(Schema.String), + seats: Schema.optional(Schema.Number), + cancel_at_period_end: Schema.optional(Schema.NullOr(Schema.Boolean)), + cancellation_reason: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + ), + cancellation_comment: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.optional(Schema.Boolean), + resumes_at: Schema.optional(Schema.NullOr(Schema.String)), + resume: Schema.optional(Schema.Boolean), + pending_update: Schema.optional(Schema.Unknown), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/customer-portal/subscriptions/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalsubscriptionsupdateOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + type: + | "custom" + | "discord" + | "github_repository" + | "downloadables" + | "license_keys" + | "meter_credit" + | "feature_flag" + | "slack_shared_channel"; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + }>; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + organization: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + organization_features?: { + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + }; + }; + }; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + created_at: string; + modified_at: string | null; + id: string; + name: string; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const CustomerPortalsubscriptionsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "custom", + "discord", + "github_repository", + "downloadables", + "license_keys", + "meter_credit", + "feature_flag", + "slack_shared_channel", + ]), + description: Schema.String, + selectable: Schema.Boolean, + deletable: Schema.Boolean, + is_deleted: Schema.Boolean, + organization_id: Schema.String, + }), + ), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + organization: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + organization_features: Schema.optional( + Schema.Struct({ + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + }), + ), + }), + }), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Subscription + * + * Update a subscription of the authenticated customer. + * + * @param id - The subscription ID. + */ +export const customerPortalsubscriptionsupdate = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerPortalsubscriptionsupdateInput, + outputSchema: CustomerPortalsubscriptionsupdateOutput, + })); diff --git a/packages/polar/src/operations/customerPortalwalletsget.ts b/packages/polar/src/operations/customerPortalwalletsget.ts new file mode 100644 index 0000000000..f347c593ff --- /dev/null +++ b/packages/polar/src/operations/customerPortalwalletsget.ts @@ -0,0 +1,48 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalwalletsgetInput { + id: string; +} +export const CustomerPortalwalletsgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/wallets/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalwalletsgetOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + balance: number; + currency: string; +} +export const CustomerPortalwalletsgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + balance: Schema.Number, + currency: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Wallet + * + * Get a wallet by ID for the authenticated customer. + * + * @param id - The wallet ID. + */ +export const customerPortalwalletsget = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalwalletsgetInput, + outputSchema: CustomerPortalwalletsgetOutput, + }), +); diff --git a/packages/polar/src/operations/customerPortalwalletslist.ts b/packages/polar/src/operations/customerPortalwalletslist.ts new file mode 100644 index 0000000000..b35c682a38 --- /dev/null +++ b/packages/polar/src/operations/customerPortalwalletslist.ts @@ -0,0 +1,73 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerPortalwalletslistInput { + page?: number; + limit?: number; + sorting?: ReadonlyArray< + "created_at" | "-created_at" | "balance" | "-balance" + > | null; +} +export const CustomerPortalwalletslistInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals(["created_at", "-created_at", "balance", "-balance"]), + ), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-portal/wallets/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerPortalwalletslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + balance: number; + currency: string; + }>; + pagination: { total_count: number; max_page: number }; +} +export const CustomerPortalwalletslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + balance: Schema.Number, + currency: Schema.String, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Wallets + * + * List wallets of the authenticated customer. + * + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const customerPortalwalletslist = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerPortalwalletslistInput, + outputSchema: CustomerPortalwalletslistOutput, + }), +); diff --git a/packages/polar/src/operations/customerSeatsassignSeat.ts b/packages/polar/src/operations/customerSeatsassignSeat.ts new file mode 100644 index 0000000000..0d7df83007 --- /dev/null +++ b/packages/polar/src/operations/customerSeatsassignSeat.ts @@ -0,0 +1,102 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSeatsassignSeatInput { + subscription_id?: string | null; + order_id?: string | null; + email?: string | null; + external_customer_id?: string | null; + customer_id?: string | null; + external_member_id?: string | null; + member_id?: string | null; + metadata?: Record | null; + immediate_claim?: boolean; +} +export const CustomerSeatsassignSeatInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + subscription_id: Schema.optional(Schema.NullOr(Schema.String)), + order_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + external_customer_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_id: Schema.optional(Schema.NullOr(Schema.String)), + external_member_id: Schema.optional(Schema.NullOr(Schema.String)), + member_id: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.optional( + Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + ), + immediate_claim: Schema.optional(Schema.Boolean), + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-seats" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSeatsassignSeatOutput { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; +} +export const CustomerSeatsassignSeatOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Assign Seat + * + * **Scopes**: `customer_seats:write` + */ +export const customerSeatsassignSeat = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerSeatsassignSeatInput, + outputSchema: CustomerSeatsassignSeatOutput, + }), +); diff --git a/packages/polar/src/operations/customerSeatsclaimSeat.ts b/packages/polar/src/operations/customerSeatsclaimSeat.ts new file mode 100644 index 0000000000..c5a234b16c --- /dev/null +++ b/packages/polar/src/operations/customerSeatsclaimSeat.ts @@ -0,0 +1,90 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSeatsclaimSeatInput { + invitation_token: string; +} +export const CustomerSeatsclaimSeatInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + invitation_token: Schema.String, + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-seats/claim" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSeatsclaimSeatOutput { + seat: { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; + }; + customer_session_token: string; +} +export const CustomerSeatsclaimSeatOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seat: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr( + Schema.Record(Schema.String, Schema.Unknown), + ), + }), + customer_session_token: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Claim Seat + */ +export const customerSeatsclaimSeat = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerSeatsclaimSeatInput, + outputSchema: CustomerSeatsclaimSeatOutput, + }), +); diff --git a/packages/polar/src/operations/customerSeatsgetClaimInfo.ts b/packages/polar/src/operations/customerSeatsgetClaimInfo.ts new file mode 100644 index 0000000000..9ddb9e59d1 --- /dev/null +++ b/packages/polar/src/operations/customerSeatsgetClaimInfo.ts @@ -0,0 +1,47 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSeatsgetClaimInfoInput { + invitation_token: string; +} +export const CustomerSeatsgetClaimInfoInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + invitation_token: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customer-seats/claim/{invitation_token}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSeatsgetClaimInfoOutput { + product_name: string; + product_id: string; + organization_name: string; + organization_slug: string; + customer_email: string; + can_claim: boolean; +} +export const CustomerSeatsgetClaimInfoOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + product_name: Schema.String, + product_id: Schema.String, + organization_name: Schema.String, + organization_slug: Schema.String, + customer_email: Schema.String, + can_claim: Schema.Boolean, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Claim Info + */ +export const customerSeatsgetClaimInfo = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerSeatsgetClaimInfoInput, + outputSchema: CustomerSeatsgetClaimInfoOutput, + }), +); diff --git a/packages/polar/src/operations/customerSeatslistSeats.ts b/packages/polar/src/operations/customerSeatslistSeats.ts new file mode 100644 index 0000000000..d6636c4198 --- /dev/null +++ b/packages/polar/src/operations/customerSeatslistSeats.ts @@ -0,0 +1,98 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSeatslistSeatsInput { + subscription_id?: string | null; + order_id?: string | null; +} +export const CustomerSeatslistSeatsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + subscription_id: Schema.optional(Schema.NullOr(Schema.String)), + order_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "GET", path: "/v1/customer-seats" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSeatslistSeatsOutput { + seats: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; + }>; + available_seats: number; + total_seats: number; +} +export const CustomerSeatslistSeatsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seats: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr( + Schema.Record(Schema.String, Schema.Unknown), + ), + }), + ), + available_seats: Schema.Number, + total_seats: Schema.Number, + }) as unknown as Schema.Codec; + +// The operation +/** + * List Seats + * + * **Scopes**: `customer_seats:read` + */ +export const customerSeatslistSeats = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerSeatslistSeatsInput, + outputSchema: CustomerSeatslistSeatsOutput, + }), +); diff --git a/packages/polar/src/operations/customerSeatsresendInvitation.ts b/packages/polar/src/operations/customerSeatsresendInvitation.ts new file mode 100644 index 0000000000..80652e84ca --- /dev/null +++ b/packages/polar/src/operations/customerSeatsresendInvitation.ts @@ -0,0 +1,83 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSeatsresendInvitationInput { + seat_id: string; +} +export const CustomerSeatsresendInvitationInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seat_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-seats/{seat_id}/resend" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSeatsresendInvitationOutput { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; +} +export const CustomerSeatsresendInvitationOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Resend Invitation + * + * **Scopes**: `customer_seats:write` + */ +export const customerSeatsresendInvitation = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerSeatsresendInvitationInput, + outputSchema: CustomerSeatsresendInvitationOutput, + })); diff --git a/packages/polar/src/operations/customerSeatsrevokeSeat.ts b/packages/polar/src/operations/customerSeatsrevokeSeat.ts new file mode 100644 index 0000000000..f47d270574 --- /dev/null +++ b/packages/polar/src/operations/customerSeatsrevokeSeat.ts @@ -0,0 +1,84 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSeatsrevokeSeatInput { + seat_id: string; +} +export const CustomerSeatsrevokeSeatInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + seat_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/customer-seats/{seat_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSeatsrevokeSeatOutput { + created_at: string; + modified_at: string | null; + id: string; + subscription_id: string | null; + order_id: string | null; + status: "pending" | "claimed" | "revoked"; + customer_id: string | null; + member_id: string | null; + member: { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + } | null; + email: string | null; + customer_email: string | null; + invitation_token_expires_at: string | null; + claimed_at: string | null; + revoked_at: string | null; + seat_metadata: Record | null; +} +export const CustomerSeatsrevokeSeatOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + status: Schema.Literals(["pending", "claimed", "revoked"]), + customer_id: Schema.NullOr(Schema.String), + member_id: Schema.NullOr(Schema.String), + member: Schema.NullOr( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + email: Schema.NullOr(Schema.String), + customer_email: Schema.NullOr(Schema.String), + invitation_token_expires_at: Schema.NullOr(Schema.String), + claimed_at: Schema.NullOr(Schema.String), + revoked_at: Schema.NullOr(Schema.String), + seat_metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.Unknown)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Revoke Seat + * + * **Scopes**: `customer_seats:write` + */ +export const customerSeatsrevokeSeat = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerSeatsrevokeSeatInput, + outputSchema: CustomerSeatsrevokeSeatOutput, + }), +); diff --git a/packages/polar/src/operations/customerSessionscreate.ts b/packages/polar/src/operations/customerSessionscreate.ts new file mode 100644 index 0000000000..749ce74f70 --- /dev/null +++ b/packages/polar/src/operations/customerSessionscreate.ts @@ -0,0 +1,63 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerSessionscreateInput { + member_id?: string | null; + external_member_id?: string | null; + return_url?: string | null; + customer_id?: string; + external_customer_id?: string; +} +export const CustomerSessionscreateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + member_id: Schema.optional(Schema.NullOr(Schema.String)), + external_member_id: Schema.optional(Schema.NullOr(Schema.String)), + return_url: Schema.optional(Schema.NullOr(Schema.String)), + customer_id: Schema.optional(Schema.String), + external_customer_id: Schema.optional(Schema.String), + }).pipe( + T.Http({ method: "POST", path: "/v1/customer-sessions/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerSessionscreateOutput { + created_at: string; + modified_at: string | null; + id: string; + token: string; + expires_at: string; + return_url: string | null; + customer_portal_url: string; + customer_id: string; + customer: unknown; +} +export const CustomerSessionscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + token: Schema.String, + expires_at: Schema.String, + return_url: Schema.NullOr(Schema.String), + customer_portal_url: Schema.String, + customer_id: Schema.String, + customer: Schema.Unknown, + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Customer Session + * + * Create a customer session. + * For organizations with `member_model_enabled`, this will automatically + * create a member session for the owner member of the customer. + * **Scopes**: `customer_sessions:write` + */ +export const customerSessionscreate = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerSessionscreateInput, + outputSchema: CustomerSessionscreateOutput, + }), +); diff --git a/packages/polar/src/operations/customerscreate.ts b/packages/polar/src/operations/customerscreate.ts new file mode 100644 index 0000000000..7be4b98640 --- /dev/null +++ b/packages/polar/src/operations/customerscreate.ts @@ -0,0 +1,572 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerscreateInput { + metadata?: Record; + external_id?: string | null; + name?: string | null; + billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id?: string | null; + locale?: string | null; + organization_id?: string | null; + owner?: { + email: string; + name?: string | null; + external_id?: string | null; + } | null; + type?: string; + email?: string | null; +} +export const CustomerscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.optional(Schema.NullOr(Schema.String)), + billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + tax_id: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + owner: Schema.optional( + Schema.NullOr( + Schema.Struct({ + email: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + }), + ), + ), + type: Schema.optional(Schema.String), + email: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "POST", path: "/v1/customers/" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomerscreateOutput = unknown; +export const CustomerscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Create Customer + * + * Create a customer. + * **Scopes**: `customers:write` + */ +export const customerscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerscreateInput, + outputSchema: CustomerscreateOutput, +})); diff --git a/packages/polar/src/operations/customersdelete.ts b/packages/polar/src/operations/customersdelete.ts new file mode 100644 index 0000000000..c8fe5d8c49 --- /dev/null +++ b/packages/polar/src/operations/customersdelete.ts @@ -0,0 +1,45 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersdeleteInput { + id: string; + anonymize?: boolean; +} +export const CustomersdeleteInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + anonymize: Schema.optional(Schema.Boolean), +}).pipe( + T.Http({ method: "DELETE", path: "/v1/customers/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomersdeleteOutput = void; +export const CustomersdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Customer + * + * Delete a customer. + * This action cannot be undone and will immediately: + * - Cancel any active subscriptions for the customer + * - Revoke all their benefits + * - Clear any `external_id` + * Use it only in the context of deleting a user within your + * own service. Otherwise, use more granular API endpoints to cancel + * a specific subscription or revoke certain benefits. + * Note: The customers information will nonetheless be retained for historic + * orders and subscriptions. + * Set `anonymize=true` to also anonymize PII for GDPR compliance. + * **Scopes**: `customers:write` + * + * @param id - The customer ID. + * @param anonymize - If true, also anonymize the customer's personal data for GDPR compliance. This replaces email with a hashed version, hashes name and billing name (name preserved for businesses with tax_id), clears billing address, and removes OAuth account data. + */ +export const customersdelete = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersdeleteInput, + outputSchema: CustomersdeleteOutput, +})); diff --git a/packages/polar/src/operations/customersdeleteExternal.ts b/packages/polar/src/operations/customersdeleteExternal.ts new file mode 100644 index 0000000000..11e9e22a0f --- /dev/null +++ b/packages/polar/src/operations/customersdeleteExternal.ts @@ -0,0 +1,40 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersdeleteExternalInput { + external_id: string; + anonymize?: boolean; +} +export const CustomersdeleteExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + anonymize: Schema.optional(Schema.Boolean), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/customers/external/{external_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomersdeleteExternalOutput = void; +export const CustomersdeleteExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Customer by External ID + * + * Delete a customer by external ID. + * Immediately cancels any active subscriptions and revokes any active benefits. + * Set `anonymize=true` to also anonymize PII for GDPR compliance. + * **Scopes**: `customers:write` + * + * @param external_id - The customer external ID. + * @param anonymize - If true, also anonymize the customer's personal data for GDPR compliance. + */ +export const customersdeleteExternal = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersdeleteExternalInput, + outputSchema: CustomersdeleteExternalOutput, + }), +); diff --git a/packages/polar/src/operations/customersexport.ts b/packages/polar/src/operations/customersexport.ts new file mode 100644 index 0000000000..9680e13d44 --- /dev/null +++ b/packages/polar/src/operations/customersexport.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersexportInput { + organization_id?: string | ReadonlyArray | null; +} +export const CustomersexportInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/customers/export" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomersexportOutput = void; +export const CustomersexportOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Export Customers + * + * Export customers as a CSV file. + * **Scopes**: `customers:read` `customers:write` + * + * @param organization_id - Filter by organization ID. + */ +export const customersexport = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersexportInput, + outputSchema: CustomersexportOutput, +})); diff --git a/packages/polar/src/operations/customersget.ts b/packages/polar/src/operations/customersget.ts new file mode 100644 index 0000000000..e92a3180cb --- /dev/null +++ b/packages/polar/src/operations/customersget.ts @@ -0,0 +1,32 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersgetInput { + id: string; +} +export const CustomersgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/customers/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomersgetOutput = unknown; +export const CustomersgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Customer + * + * Get a customer by ID. + * **Scopes**: `customers:read` `customers:write` + * + * @param id - The customer ID. + */ +export const customersget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersgetInput, + outputSchema: CustomersgetOutput, +})); diff --git a/packages/polar/src/operations/customersgetExternal.ts b/packages/polar/src/operations/customersgetExternal.ts new file mode 100644 index 0000000000..2b56abf388 --- /dev/null +++ b/packages/polar/src/operations/customersgetExternal.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersgetExternalInput { + external_id: string; +} +export const CustomersgetExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customers/external/{external_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomersgetExternalOutput = unknown; +export const CustomersgetExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Customer by External ID + * + * Get a customer by external ID. + * **Scopes**: `customers:read` `customers:write` + * + * @param external_id - The customer external ID. + */ +export const customersgetExternal = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersgetExternalInput, + outputSchema: CustomersgetExternalOutput, + }), +); diff --git a/packages/polar/src/operations/customersgetState.ts b/packages/polar/src/operations/customersgetState.ts new file mode 100644 index 0000000000..5fe275d2fb --- /dev/null +++ b/packages/polar/src/operations/customersgetState.ts @@ -0,0 +1,38 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersgetStateInput { + id: string; +} +export const CustomersgetStateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + id: Schema.String.pipe(T.PathParam()), + }, +).pipe( + T.Http({ method: "GET", path: "/v1/customers/{id}/state" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomersgetStateOutput = unknown; +export const CustomersgetStateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Customer State + * + * Get a customer state by ID. + * The customer state includes information about + * the customer's active subscriptions and benefits. + * It's the ideal endpoint to use when you need to get a full overview + * of a customer's status. + * **Scopes**: `customers:read` `customers:write` + * + * @param id - The customer ID. + */ +export const customersgetState = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersgetStateInput, + outputSchema: CustomersgetStateOutput, +})); diff --git a/packages/polar/src/operations/customersgetStateExternal.ts b/packages/polar/src/operations/customersgetStateExternal.ts new file mode 100644 index 0000000000..eb80149203 --- /dev/null +++ b/packages/polar/src/operations/customersgetStateExternal.ts @@ -0,0 +1,42 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersgetStateExternalInput { + external_id: string; +} +export const CustomersgetStateExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customers/external/{external_id}/state", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomersgetStateExternalOutput = unknown; +export const CustomersgetStateExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Customer State by External ID + * + * Get a customer state by external ID. + * The customer state includes information about + * the customer's active subscriptions and benefits. + * It's the ideal endpoint to use when you need to get a full overview + * of a customer's status. + * **Scopes**: `customers:read` `customers:write` + * + * @param external_id - The customer external ID. + */ +export const customersgetStateExternal = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersgetStateExternalInput, + outputSchema: CustomersgetStateExternalOutput, + }), +); diff --git a/packages/polar/src/operations/customerslist.ts b/packages/polar/src/operations/customerslist.ts new file mode 100644 index 0000000000..f0335acf8e --- /dev/null +++ b/packages/polar/src/operations/customerslist.ts @@ -0,0 +1,100 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerslistInput { + organization_id?: string | ReadonlyArray | null; + email?: string | null; + query?: string | null; + active?: boolean | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + "created_at" | "-created_at" | "email" | "-email" | "name" | "-name" + > | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const CustomerslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + email: Schema.optional(Schema.NullOr(Schema.String)), + query: Schema.optional(Schema.NullOr(Schema.String)), + active: Schema.optional(Schema.NullOr(Schema.Boolean)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "email", + "-email", + "name", + "-name", + ]), + ), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/customers/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerslistOutput { + items: ReadonlyArray; + pagination: { total_count: number; max_page: number }; +} +export const CustomerslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array(Schema.Unknown), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Customers + * + * List customers. + * **Scopes**: `customers:read` `customers:write` + * + * @param organization_id - Filter by organization ID. + * @param email - Filter by exact email. + * @param query - Filter by name, email, or external ID. + * @param active - Filter by active customers, i.e. customers with at least one trialing, active or past_due subscription. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const customerslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerslistInput, + outputSchema: CustomerslistOutput, +})); diff --git a/packages/polar/src/operations/customerslistPaymentMethods.ts b/packages/polar/src/operations/customerslistPaymentMethods.ts new file mode 100644 index 0000000000..f05512cd28 --- /dev/null +++ b/packages/polar/src/operations/customerslistPaymentMethods.ts @@ -0,0 +1,104 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerslistPaymentMethodsInput { + id: string; + page?: number; + limit?: number; +} +export const CustomerslistPaymentMethodsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/customers/{id}/payment-methods" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerslistPaymentMethodsOutput { + items: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + method_metadata: { + brand: string; + last4: string; + exp_month: number; + exp_year: number; + wallet?: string | null; + }; + is_default: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + is_default: boolean; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const CustomerslistPaymentMethodsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Union([ + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + exp_month: Schema.Number, + exp_year: Schema.Number, + wallet: Schema.optional(Schema.NullOr(Schema.String)), + }), + is_default: Schema.Boolean, + }), + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + is_default: Schema.Boolean, + }), + ]), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Customer Payment Methods + * + * Get saved payment methods of a customer. + * **Scopes**: `customers:read` `customers:write` + * + * @param id - The customer ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerslistPaymentMethods = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomerslistPaymentMethodsInput, + outputSchema: CustomerslistPaymentMethodsOutput, + }), +); diff --git a/packages/polar/src/operations/customerslistPaymentMethodsExternal.ts b/packages/polar/src/operations/customerslistPaymentMethodsExternal.ts new file mode 100644 index 0000000000..1f733d80ea --- /dev/null +++ b/packages/polar/src/operations/customerslistPaymentMethodsExternal.ts @@ -0,0 +1,106 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomerslistPaymentMethodsExternalInput { + external_id: string; + page?: number; + limit?: number; +} +export const CustomerslistPaymentMethodsExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customers/external/{external_id}/payment-methods", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomerslistPaymentMethodsExternalOutput { + items: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + method_metadata: { + brand: string; + last4: string; + exp_month: number; + exp_year: number; + wallet?: string | null; + }; + is_default: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + processor: "stripe"; + customer_id: string; + type: string; + is_default: boolean; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const CustomerslistPaymentMethodsExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Union([ + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + exp_month: Schema.Number, + exp_year: Schema.Number, + wallet: Schema.optional(Schema.NullOr(Schema.String)), + }), + is_default: Schema.Boolean, + }), + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + processor: Schema.Literals(["stripe"]), + customer_id: Schema.String, + type: Schema.String, + is_default: Schema.Boolean, + }), + ]), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Customer Payment Methods by External ID + * + * Get saved payment methods of a customer by external ID. + * **Scopes**: `customers:read` `customers:write` + * + * @param external_id - The customer external ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const customerslistPaymentMethodsExternal = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomerslistPaymentMethodsExternalInput, + outputSchema: CustomerslistPaymentMethodsExternalOutput, + })); diff --git a/packages/polar/src/operations/customersmemberscreate.ts b/packages/polar/src/operations/customersmemberscreate.ts new file mode 100644 index 0000000000..e89170c8e5 --- /dev/null +++ b/packages/polar/src/operations/customersmemberscreate.ts @@ -0,0 +1,63 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmemberscreateInput { + id: string; + email: string; + name?: string | null; + external_id?: string | null; + role?: "member" | "billing_manager"; +} +export const CustomersmemberscreateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + email: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional(Schema.Literals(["member", "billing_manager"])), + }).pipe( + T.Http({ method: "POST", path: "/v1/customers/{id}/members" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomersmemberscreateOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomersmemberscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Member + * + * Create a new member for a customer. + * Only B2B customers with the member management feature enabled can add members. + * The authenticated user or organization must have access to the customer's organization. + * **Scopes**: `members:write` + * + * @param id - The customer ID. + */ +export const customersmemberscreate = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersmemberscreateInput, + outputSchema: CustomersmemberscreateOutput, + }), +); diff --git a/packages/polar/src/operations/customersmemberscreateExternal.ts b/packages/polar/src/operations/customersmemberscreateExternal.ts new file mode 100644 index 0000000000..481717cafd --- /dev/null +++ b/packages/polar/src/operations/customersmemberscreateExternal.ts @@ -0,0 +1,61 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmemberscreateExternalInput { + external_id: string; + email: string; + name?: string | null; + role?: "member" | "billing_manager"; +} +export const CustomersmemberscreateExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + email: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional(Schema.Literals(["member", "billing_manager"])), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/customers/external/{external_id}/members", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomersmemberscreateExternalOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomersmemberscreateExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Member by Customer External ID + * + * Create a new member for a customer identified by its external ID. + * **Scopes**: `members:write` + * + * @param external_id - The customer external ID. + */ +export const customersmemberscreateExternal = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersmemberscreateExternalInput, + outputSchema: CustomersmemberscreateExternalOutput, + })); diff --git a/packages/polar/src/operations/customersmembersdelete.ts b/packages/polar/src/operations/customersmembersdelete.ts new file mode 100644 index 0000000000..fa40da3fcc --- /dev/null +++ b/packages/polar/src/operations/customersmembersdelete.ts @@ -0,0 +1,40 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmembersdeleteInput { + id: string; + member_id: string; +} +export const CustomersmembersdeleteInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + member_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "DELETE", + path: "/v1/customers/{id}/members/{member_id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomersmembersdeleteOutput = void; +export const CustomersmembersdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Member + * + * Delete a member of a customer. + * **Scopes**: `members:write` + * + * @param id - The customer ID. + */ +export const customersmembersdelete = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersmembersdeleteInput, + outputSchema: CustomersmembersdeleteOutput, + }), +); diff --git a/packages/polar/src/operations/customersmembersdeleteExternal.ts b/packages/polar/src/operations/customersmembersdeleteExternal.ts new file mode 100644 index 0000000000..c5eb644910 --- /dev/null +++ b/packages/polar/src/operations/customersmembersdeleteExternal.ts @@ -0,0 +1,40 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmembersdeleteExternalInput { + external_id: string; + member_external_id: string; +} +export const CustomersmembersdeleteExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + member_external_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "DELETE", + path: "/v1/customers/external/{external_id}/members/{member_external_id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomersmembersdeleteExternalOutput = void; +export const CustomersmembersdeleteExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Member by External ID + * + * Delete a member by external ID for a customer identified by its external ID. + * **Scopes**: `members:write` + * + * @param external_id - The customer external ID. + * @param member_external_id - The member external ID. + */ +export const customersmembersdeleteExternal = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersmembersdeleteExternalInput, + outputSchema: CustomersmembersdeleteExternalOutput, + })); diff --git a/packages/polar/src/operations/customersmembersget.ts b/packages/polar/src/operations/customersmembersget.ts new file mode 100644 index 0000000000..f1233c9029 --- /dev/null +++ b/packages/polar/src/operations/customersmembersget.ts @@ -0,0 +1,53 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmembersgetInput { + id: string; + member_id: string; +} +export const CustomersmembersgetInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + member_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/customers/{id}/members/{member_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomersmembersgetOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomersmembersgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Member + * + * Get a member of a customer by its ID. + * **Scopes**: `members:read` `members:write` + * + * @param id - The customer ID. + */ +export const customersmembersget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersmembersgetInput, + outputSchema: CustomersmembersgetOutput, +})); diff --git a/packages/polar/src/operations/customersmembersgetExternal.ts b/packages/polar/src/operations/customersmembersgetExternal.ts new file mode 100644 index 0000000000..46fa625403 --- /dev/null +++ b/packages/polar/src/operations/customersmembersgetExternal.ts @@ -0,0 +1,59 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmembersgetExternalInput { + external_id: string; + member_external_id: string; +} +export const CustomersmembersgetExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + member_external_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/customers/external/{external_id}/members/{member_external_id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomersmembersgetExternalOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomersmembersgetExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Member by External ID + * + * Get a member by external ID for a customer identified by its external ID. + * **Scopes**: `members:read` `members:write` + * + * @param external_id - The customer external ID. + * @param member_external_id - The member external ID. + */ +export const customersmembersgetExternal = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersmembersgetExternalInput, + outputSchema: CustomersmembersgetExternalOutput, + }), +); diff --git a/packages/polar/src/operations/customersmembersupdate.ts b/packages/polar/src/operations/customersmembersupdate.ts new file mode 100644 index 0000000000..9baed9cea3 --- /dev/null +++ b/packages/polar/src/operations/customersmembersupdate.ts @@ -0,0 +1,64 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmembersupdateInput { + id: string; + member_id: string; + name?: string | null; + email?: string | null; + role?: "owner" | "billing_manager" | "member" | null; +} +export const CustomersmembersupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + member_id: Schema.String.pipe(T.PathParam()), + name: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional( + Schema.NullOr(Schema.Literals(["owner", "billing_manager", "member"])), + ), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/customers/{id}/members/{member_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomersmembersupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomersmembersupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Member + * + * Update a member of a customer. + * Only name, email and role can be updated. + * **Scopes**: `members:write` + * + * @param id - The customer ID. + */ +export const customersmembersupdate = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersmembersupdateInput, + outputSchema: CustomersmembersupdateOutput, + }), +); diff --git a/packages/polar/src/operations/customersmembersupdateExternal.ts b/packages/polar/src/operations/customersmembersupdateExternal.ts new file mode 100644 index 0000000000..1dfdbb4145 --- /dev/null +++ b/packages/polar/src/operations/customersmembersupdateExternal.ts @@ -0,0 +1,66 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersmembersupdateExternalInput { + external_id: string; + member_external_id: string; + name?: string | null; + email?: string | null; + role?: "owner" | "billing_manager" | "member" | null; +} +export const CustomersmembersupdateExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + member_external_id: Schema.String.pipe(T.PathParam()), + name: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional( + Schema.NullOr(Schema.Literals(["owner", "billing_manager", "member"])), + ), + }).pipe( + T.Http({ + method: "PATCH", + path: "/v1/customers/external/{external_id}/members/{member_external_id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface CustomersmembersupdateExternalOutput { + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; +} +export const CustomersmembersupdateExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Member by External ID + * + * Update a member by external ID for a customer identified by its external ID. + * **Scopes**: `members:write` + * + * @param external_id - The customer external ID. + * @param member_external_id - The member external ID. + */ +export const customersmembersupdateExternal = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersmembersupdateExternalInput, + outputSchema: CustomersmembersupdateExternalOutput, + })); diff --git a/packages/polar/src/operations/customersupdate.ts b/packages/polar/src/operations/customersupdate.ts new file mode 100644 index 0000000000..40ac9969b7 --- /dev/null +++ b/packages/polar/src/operations/customersupdate.ts @@ -0,0 +1,560 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersupdateInput { + id: string; + metadata?: Record; + email?: string | null; + name?: string | null; + billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id?: string | null; + locale?: string | null; + external_id?: string | null; + type?: "individual" | "team" | null; +} +export const CustomersupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + email: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.optional(Schema.NullOr(Schema.String)), + billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + tax_id: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.optional(Schema.NullOr(Schema.Literals(["individual", "team"]))), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/customers/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type CustomersupdateOutput = unknown; +export const CustomersupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Update Customer + * + * Update a customer. + * **Scopes**: `customers:write` + * + * @param id - The customer ID. + */ +export const customersupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: CustomersupdateInput, + outputSchema: CustomersupdateOutput, +})); diff --git a/packages/polar/src/operations/customersupdateExternal.ts b/packages/polar/src/operations/customersupdateExternal.ts new file mode 100644 index 0000000000..c766e51578 --- /dev/null +++ b/packages/polar/src/operations/customersupdateExternal.ts @@ -0,0 +1,559 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface CustomersupdateExternalInput { + external_id: string; + metadata?: Record; + email?: string | null; + name?: string | null; + billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id?: string | null; + locale?: string | null; +} +export const CustomersupdateExternalInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + external_id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + email: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.optional(Schema.NullOr(Schema.String)), + billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), + tax_id: Schema.optional(Schema.NullOr(Schema.String)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/customers/external/{external_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type CustomersupdateExternalOutput = unknown; +export const CustomersupdateExternalOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Update Customer by External ID + * + * Update a customer by external ID. + * **Scopes**: `customers:write` + * + * @param external_id - The customer external ID. + */ +export const customersupdateExternal = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: CustomersupdateExternalInput, + outputSchema: CustomersupdateExternalOutput, + }), +); diff --git a/packages/polar/src/operations/discountscreate.ts b/packages/polar/src/operations/discountscreate.ts new file mode 100644 index 0000000000..df51bbb691 --- /dev/null +++ b/packages/polar/src/operations/discountscreate.ts @@ -0,0 +1,323 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DiscountscreateInput { + metadata?: Record; + name: string; + code?: string | null; + starts_at?: string | null; + ends_at?: string | null; + max_redemptions?: number | null; + products?: ReadonlyArray | null; + organization_id?: string | null; + type?: string; + duration: "once" | "forever" | "repeating"; + duration_in_months?: number | null; + amount?: number | null; + currency?: + | "aed" + | "all" + | "amd" + | "aoa" + | "ars" + | "aud" + | "awg" + | "azn" + | "bam" + | "bbd" + | "bdt" + | "bif" + | "bmd" + | "bnd" + | "bob" + | "brl" + | "bsd" + | "bwp" + | "bzd" + | "cad" + | "cdf" + | "chf" + | "clp" + | "cny" + | "cop" + | "crc" + | "cve" + | "czk" + | "djf" + | "dkk" + | "dop" + | "dzd" + | "egp" + | "etb" + | "eur" + | "fjd" + | "fkp" + | "gbp" + | "gel" + | "gip" + | "gmd" + | "gnf" + | "gtq" + | "gyd" + | "hkd" + | "hnl" + | "htg" + | "huf" + | "idr" + | "ils" + | "inr" + | "isk" + | "jmd" + | "jpy" + | "kes" + | "kgs" + | "khr" + | "kmf" + | "krw" + | "kyd" + | "kzt" + | "lak" + | "lkr" + | "lrd" + | "lsl" + | "mad" + | "mdl" + | "mga" + | "mkd" + | "mnt" + | "mop" + | "mur" + | "mvr" + | "mwk" + | "mxn" + | "myr" + | "mzn" + | "nad" + | "ngn" + | "nio" + | "nok" + | "npr" + | "nzd" + | "pab" + | "pen" + | "pgk" + | "php" + | "pkr" + | "pln" + | "pyg" + | "qar" + | "ron" + | "rsd" + | "rwf" + | "sar" + | "sbd" + | "scr" + | "sek" + | "sgd" + | "shp" + | "sos" + | "srd" + | "szl" + | "thb" + | "tjs" + | "top" + | "try" + | "ttd" + | "twd" + | "tzs" + | "uah" + | "ugx" + | "usd" + | "uyu" + | "uzs" + | "vnd" + | "vuv" + | "wst" + | "xaf" + | "xcd" + | "xcg" + | "xof" + | "xpf" + | "yer" + | "zar" + | "zmw" + | null; + amounts?: Record | null; + basis_points?: number; +} +export const DiscountscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + name: Schema.String, + code: Schema.optional(Schema.NullOr(Schema.String)), + starts_at: Schema.optional(Schema.NullOr(Schema.String)), + ends_at: Schema.optional(Schema.NullOr(Schema.String)), + max_redemptions: Schema.optional(Schema.NullOr(Schema.Number)), + products: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + type: Schema.optional(Schema.String), + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.optional(Schema.NullOr(Schema.Number)), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + currency: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "aed", + "all", + "amd", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bif", + "bmd", + "bnd", + "bob", + "brl", + "bsd", + "bwp", + "bzd", + "cad", + "cdf", + "chf", + "clp", + "cny", + "cop", + "crc", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "egp", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "htg", + "huf", + "idr", + "ils", + "inr", + "isk", + "jmd", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "krw", + "kyd", + "kzt", + "lak", + "lkr", + "lrd", + "lsl", + "mad", + "mdl", + "mga", + "mkd", + "mnt", + "mop", + "mur", + "mvr", + "mwk", + "mxn", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rwf", + "sar", + "sbd", + "scr", + "sek", + "sgd", + "shp", + "sos", + "srd", + "szl", + "thb", + "tjs", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "uyu", + "uzs", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmw", + ]), + ), + ), + amounts: Schema.optional( + Schema.NullOr(Schema.Record(Schema.String, Schema.Number)), + ), + basis_points: Schema.optional(Schema.Number), +}).pipe( + T.Http({ method: "POST", path: "/v1/discounts/" }), +) as unknown as Schema.Codec; + +// Output Schema +export type DiscountscreateOutput = unknown; +export const DiscountscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Create Discount + * + * Create a discount. + * **Scopes**: `discounts:write` + */ +export const discountscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DiscountscreateInput, + outputSchema: DiscountscreateOutput, +})); diff --git a/packages/polar/src/operations/discountsdelete.ts b/packages/polar/src/operations/discountsdelete.ts new file mode 100644 index 0000000000..4be0a224e0 --- /dev/null +++ b/packages/polar/src/operations/discountsdelete.ts @@ -0,0 +1,32 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DiscountsdeleteInput { + id: string; +} +export const DiscountsdeleteInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "DELETE", path: "/v1/discounts/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type DiscountsdeleteOutput = void; +export const DiscountsdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Discount + * + * Delete a discount. + * **Scopes**: `discounts:write` + * + * @param id - The discount ID. + */ +export const discountsdelete = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DiscountsdeleteInput, + outputSchema: DiscountsdeleteOutput, +})); diff --git a/packages/polar/src/operations/discountsget.ts b/packages/polar/src/operations/discountsget.ts new file mode 100644 index 0000000000..7dc0fe0ed3 --- /dev/null +++ b/packages/polar/src/operations/discountsget.ts @@ -0,0 +1,32 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DiscountsgetInput { + id: string; +} +export const DiscountsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/discounts/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type DiscountsgetOutput = unknown; +export const DiscountsgetOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Discount + * + * Get a discount by ID. + * **Scopes**: `discounts:read` `discounts:write` + * + * @param id - The discount ID. + */ +export const discountsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DiscountsgetInput, + outputSchema: DiscountsgetOutput, +})); diff --git a/packages/polar/src/operations/discountslist.ts b/packages/polar/src/operations/discountslist.ts new file mode 100644 index 0000000000..7f7c744252 --- /dev/null +++ b/packages/polar/src/operations/discountslist.ts @@ -0,0 +1,82 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DiscountslistInput { + organization_id?: string | ReadonlyArray | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "name" + | "-name" + | "code" + | "-code" + | "redemptions_count" + | "-redemptions_count" + | "ends_at" + | "-ends_at" + > | null; +} +export const DiscountslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "name", + "-name", + "code", + "-code", + "redemptions_count", + "-redemptions_count", + "ends_at", + "-ends_at", + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/discounts/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface DiscountslistOutput { + items: ReadonlyArray; + pagination: { total_count: number; max_page: number }; +} +export const DiscountslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array(Schema.Unknown), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Discounts + * + * List discounts. + * **Scopes**: `discounts:read` `discounts:write` + * + * @param organization_id - Filter by organization ID. + * @param query - Filter by name. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const discountslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DiscountslistInput, + outputSchema: DiscountslistOutput, +})); diff --git a/packages/polar/src/operations/discountsupdate.ts b/packages/polar/src/operations/discountsupdate.ts new file mode 100644 index 0000000000..ec4f21f0ad --- /dev/null +++ b/packages/polar/src/operations/discountsupdate.ts @@ -0,0 +1,329 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DiscountsupdateInput { + id: string; + metadata?: Record; + name?: string | null; + code?: string | null; + starts_at?: string | null; + ends_at?: string | null; + max_redemptions?: number | null; + duration?: "once" | "forever" | "repeating" | null; + duration_in_months?: number | null; + type?: "fixed" | "percentage" | null; + amount?: number | null; + currency?: + | "aed" + | "all" + | "amd" + | "aoa" + | "ars" + | "aud" + | "awg" + | "azn" + | "bam" + | "bbd" + | "bdt" + | "bif" + | "bmd" + | "bnd" + | "bob" + | "brl" + | "bsd" + | "bwp" + | "bzd" + | "cad" + | "cdf" + | "chf" + | "clp" + | "cny" + | "cop" + | "crc" + | "cve" + | "czk" + | "djf" + | "dkk" + | "dop" + | "dzd" + | "egp" + | "etb" + | "eur" + | "fjd" + | "fkp" + | "gbp" + | "gel" + | "gip" + | "gmd" + | "gnf" + | "gtq" + | "gyd" + | "hkd" + | "hnl" + | "htg" + | "huf" + | "idr" + | "ils" + | "inr" + | "isk" + | "jmd" + | "jpy" + | "kes" + | "kgs" + | "khr" + | "kmf" + | "krw" + | "kyd" + | "kzt" + | "lak" + | "lkr" + | "lrd" + | "lsl" + | "mad" + | "mdl" + | "mga" + | "mkd" + | "mnt" + | "mop" + | "mur" + | "mvr" + | "mwk" + | "mxn" + | "myr" + | "mzn" + | "nad" + | "ngn" + | "nio" + | "nok" + | "npr" + | "nzd" + | "pab" + | "pen" + | "pgk" + | "php" + | "pkr" + | "pln" + | "pyg" + | "qar" + | "ron" + | "rsd" + | "rwf" + | "sar" + | "sbd" + | "scr" + | "sek" + | "sgd" + | "shp" + | "sos" + | "srd" + | "szl" + | "thb" + | "tjs" + | "top" + | "try" + | "ttd" + | "twd" + | "tzs" + | "uah" + | "ugx" + | "usd" + | "uyu" + | "uzs" + | "vnd" + | "vuv" + | "wst" + | "xaf" + | "xcd" + | "xcg" + | "xof" + | "xpf" + | "yer" + | "zar" + | "zmw" + | null; + amounts?: Record | null; + basis_points?: number | null; + products?: ReadonlyArray | null; +} +export const DiscountsupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + name: Schema.optional(Schema.NullOr(Schema.String)), + code: Schema.optional(Schema.NullOr(Schema.String)), + starts_at: Schema.optional(Schema.NullOr(Schema.String)), + ends_at: Schema.optional(Schema.NullOr(Schema.String)), + max_redemptions: Schema.optional(Schema.NullOr(Schema.Number)), + duration: Schema.optional( + Schema.NullOr(Schema.Literals(["once", "forever", "repeating"])), + ), + duration_in_months: Schema.optional(Schema.NullOr(Schema.Number)), + type: Schema.optional( + Schema.NullOr(Schema.Literals(["fixed", "percentage"])), + ), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + currency: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "aed", + "all", + "amd", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bif", + "bmd", + "bnd", + "bob", + "brl", + "bsd", + "bwp", + "bzd", + "cad", + "cdf", + "chf", + "clp", + "cny", + "cop", + "crc", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "egp", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "htg", + "huf", + "idr", + "ils", + "inr", + "isk", + "jmd", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "krw", + "kyd", + "kzt", + "lak", + "lkr", + "lrd", + "lsl", + "mad", + "mdl", + "mga", + "mkd", + "mnt", + "mop", + "mur", + "mvr", + "mwk", + "mxn", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rwf", + "sar", + "sbd", + "scr", + "sek", + "sgd", + "shp", + "sos", + "srd", + "szl", + "thb", + "tjs", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "uyu", + "uzs", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmw", + ]), + ), + ), + amounts: Schema.optional( + Schema.NullOr(Schema.Record(Schema.String, Schema.Number)), + ), + basis_points: Schema.optional(Schema.NullOr(Schema.Number)), + products: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/discounts/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type DiscountsupdateOutput = unknown; +export const DiscountsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Update Discount + * + * Update a discount. + * **Scopes**: `discounts:write` + * + * @param id - The discount ID. + */ +export const discountsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DiscountsupdateInput, + outputSchema: DiscountsupdateOutput, +})); diff --git a/packages/polar/src/operations/disputesaccept.ts b/packages/polar/src/operations/disputesaccept.ts new file mode 100644 index 0000000000..246e7a0c3a --- /dev/null +++ b/packages/polar/src/operations/disputesaccept.ts @@ -0,0 +1,634 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DisputesacceptInput { + id: string; +} +export const DisputesacceptInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "POST", path: "/v1/disputes/{id}/accept" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface DisputesacceptOutput { + created_at: string; + modified_at: string | null; + id: string; + status: + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won"; + resolved: boolean; + closed: boolean; + amount: number; + tax_amount: number; + currency: string; + reason: string | null; + evidence_due_by: string | null; + past_due: boolean; + order_id: string; + payment_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + case_id: string | null; +} +export const DisputesacceptOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + status: Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + resolved: Schema.Boolean, + closed: Schema.Boolean, + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + reason: Schema.NullOr(Schema.String), + evidence_due_by: Schema.NullOr(Schema.String), + past_due: Schema.Boolean, + order_id: Schema.String, + payment_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + case_id: Schema.NullOr(Schema.String), +}) as unknown as Schema.Codec; + +// The operation +/** + * Accept Dispute + * + * Accept a dispute, conceding the chargeback. + * Closes the dispute with the processor (settling it as `lost`) and records + * the merchant's decision on the dispute's support case. + * **Scopes**: `disputes:write` + * + * @param id - The dispute ID. + */ +export const disputesaccept = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DisputesacceptInput, + outputSchema: DisputesacceptOutput, +})); diff --git a/packages/polar/src/operations/disputesget.ts b/packages/polar/src/operations/disputesget.ts new file mode 100644 index 0000000000..47933b6db4 --- /dev/null +++ b/packages/polar/src/operations/disputesget.ts @@ -0,0 +1,632 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DisputesgetInput { + id: string; +} +export const DisputesgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/disputes/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface DisputesgetOutput { + created_at: string; + modified_at: string | null; + id: string; + status: + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won"; + resolved: boolean; + closed: boolean; + amount: number; + tax_amount: number; + currency: string; + reason: string | null; + evidence_due_by: string | null; + past_due: boolean; + order_id: string; + payment_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + case_id: string | null; +} +export const DisputesgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + status: Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + resolved: Schema.Boolean, + closed: Schema.Boolean, + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + reason: Schema.NullOr(Schema.String), + evidence_due_by: Schema.NullOr(Schema.String), + past_due: Schema.Boolean, + order_id: Schema.String, + payment_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + case_id: Schema.NullOr(Schema.String), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Dispute + * + * Get a dispute by ID. + * **Scopes**: `disputes:read` `disputes:write` + * + * @param id - The dispute ID. + */ +export const disputesget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DisputesgetInput, + outputSchema: DisputesgetOutput, +})); diff --git a/packages/polar/src/operations/disputeslist.ts b/packages/polar/src/operations/disputeslist.ts new file mode 100644 index 0000000000..9af4f46565 --- /dev/null +++ b/packages/polar/src/operations/disputeslist.ts @@ -0,0 +1,710 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface DisputeslistInput { + organization_id?: string | ReadonlyArray | null; + order_id?: string | ReadonlyArray | null; + status?: + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won" + | ReadonlyArray< + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won" + > + | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + "created_at" | "-created_at" | "amount" | "-amount" + > | null; +} +export const DisputeslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + order_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + status: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + Schema.Array( + Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + ), + ]), + ), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals(["created_at", "-created_at", "amount", "-amount"]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/disputes/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface DisputeslistOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + status: + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won"; + resolved: boolean; + closed: boolean; + amount: number; + tax_amount: number; + currency: string; + reason: string | null; + evidence_due_by: string | null; + past_due: boolean; + order_id: string; + payment_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + case_id: string | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const DisputeslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + status: Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + resolved: Schema.Boolean, + closed: Schema.Boolean, + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + reason: Schema.NullOr(Schema.String), + evidence_due_by: Schema.NullOr(Schema.String), + past_due: Schema.Boolean, + order_id: Schema.String, + payment_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + case_id: Schema.NullOr(Schema.String), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Disputes + * + * List disputes. + * **Scopes**: `disputes:read` `disputes:write` + * + * @param organization_id - Filter by organization ID. + * @param order_id - Filter by order ID. + * @param status - Filter by dispute status. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const disputeslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: DisputeslistInput, + outputSchema: DisputeslistOutput, +})); diff --git a/packages/polar/src/operations/eventTypeslist.ts b/packages/polar/src/operations/eventTypeslist.ts new file mode 100644 index 0000000000..9d7341c4ec --- /dev/null +++ b/packages/polar/src/operations/eventTypeslist.ts @@ -0,0 +1,127 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface EventTypeslistInput { + organization_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + query?: string | null; + root_events?: boolean; + parent_id?: string | null; + source?: "system" | "user" | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "name" + | "-name" + | "label" + | "-label" + | "occurrences" + | "-occurrences" + | "first_seen" + | "-first_seen" + | "last_seen" + | "-last_seen" + > | null; +} +export const EventTypeslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + root_events: Schema.optional(Schema.Boolean), + parent_id: Schema.optional(Schema.NullOr(Schema.String)), + source: Schema.optional(Schema.NullOr(Schema.Literals(["system", "user"]))), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "name", + "-name", + "label", + "-label", + "occurrences", + "-occurrences", + "first_seen", + "-first_seen", + "last_seen", + "-last_seen", + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/event-types/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface EventTypeslistOutput { + items: ReadonlyArray<{ + id?: string | null; + created_at?: string | null; + modified_at?: string | null; + name: string; + label: string; + label_property_selector?: string | null; + organization_id: string; + source: "system" | "user"; + occurrences: number; + first_seen: string; + last_seen: string; + }>; + pagination: { total_count: number; max_page: number }; +} +export const EventTypeslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.optional(Schema.NullOr(Schema.String)), + created_at: Schema.optional(Schema.NullOr(Schema.String)), + modified_at: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.String, + label: Schema.String, + label_property_selector: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + source: Schema.Literals(["system", "user"]), + occurrences: Schema.Number, + first_seen: Schema.String, + last_seen: Schema.String, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Event Types + * + * List event types with aggregated statistics. + * **Scopes**: `events:read` `events:write` + * + * @param organization_id - Filter by organization ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by external customer ID. + * @param query - Query to filter event types by name or label. + * @param root_events - When true, only return event types with root events (parent_id IS NULL). + * @param parent_id - Filter by specific parent event ID. + * @param source - Filter by event source (system or user). + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const eventTypeslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: EventTypeslistInput, + outputSchema: EventTypeslistOutput, +})); diff --git a/packages/polar/src/operations/eventTypesupdate.ts b/packages/polar/src/operations/eventTypesupdate.ts new file mode 100644 index 0000000000..a17f71b2ff --- /dev/null +++ b/packages/polar/src/operations/eventTypesupdate.ts @@ -0,0 +1,53 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface EventTypesupdateInput { + id: string; + label: string; + label_property_selector?: string | null; +} +export const EventTypesupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + label: Schema.String, + label_property_selector: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/event-types/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface EventTypesupdateOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + label: string; + label_property_selector?: string | null; + organization_id: string; +} +export const EventTypesupdateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + label: Schema.String, + label_property_selector: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + }, +) as unknown as Schema.Codec; + +// The operation +/** + * Update Event Type + * + * Update an event type's label. + * **Scopes**: `events:write` + * + * @param id - The event type ID. + */ +export const eventTypesupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: EventTypesupdateInput, + outputSchema: EventTypesupdateOutput, +})); diff --git a/packages/polar/src/operations/eventsget.ts b/packages/polar/src/operations/eventsget.ts new file mode 100644 index 0000000000..58817872bd --- /dev/null +++ b/packages/polar/src/operations/eventsget.ts @@ -0,0 +1,97 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface EventsgetInput { + id: string; +} +export const EventsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/events/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type EventsgetOutput = + | unknown + | { + id: string; + timestamp: string; + organization_id: string; + customer_id: string | null; + customer: unknown | null; + external_customer_id: string | null; + member_id?: string | null; + external_member_id?: string | null; + child_count?: number; + parent_id?: string | null; + label: string; + name: string; + source: string; + metadata: { + _cost?: { amount: string; currency: string }; + _llm?: { + vendor: string; + model: string; + prompt?: string | null; + response?: string | null; + input_tokens: number; + cached_input_tokens?: number; + output_tokens: number; + total_tokens: number; + }; + }; + }; +export const EventsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Unknown, + Schema.Struct({ + id: Schema.String, + timestamp: Schema.String, + organization_id: Schema.String, + customer_id: Schema.NullOr(Schema.String), + customer: Schema.NullOr(Schema.Unknown), + external_customer_id: Schema.NullOr(Schema.String), + member_id: Schema.optional(Schema.NullOr(Schema.String)), + external_member_id: Schema.optional(Schema.NullOr(Schema.String)), + child_count: Schema.optional(Schema.Number), + parent_id: Schema.optional(Schema.NullOr(Schema.String)), + label: Schema.String, + name: Schema.String, + source: Schema.String, + metadata: Schema.Struct({ + _cost: Schema.optional( + Schema.Struct({ + amount: Schema.String, + currency: Schema.String, + }), + ), + _llm: Schema.optional( + Schema.Struct({ + vendor: Schema.String, + model: Schema.String, + prompt: Schema.optional(Schema.NullOr(Schema.String)), + response: Schema.optional(Schema.NullOr(Schema.String)), + input_tokens: Schema.Number, + cached_input_tokens: Schema.optional(Schema.Number), + output_tokens: Schema.Number, + total_tokens: Schema.Number, + }), + ), + }), + }), +]) as unknown as Schema.Codec; + +// The operation +/** + * Get Event + * + * Get an event by ID. + * **Scopes**: `events:read` `events:write` + * + * @param id - The event ID. + */ +export const eventsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: EventsgetInput, + outputSchema: EventsgetOutput, +})); diff --git a/packages/polar/src/operations/eventsingest.ts b/packages/polar/src/operations/eventsingest.ts new file mode 100644 index 0000000000..3cd518819f --- /dev/null +++ b/packages/polar/src/operations/eventsingest.ts @@ -0,0 +1,145 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface EventsingestInput { + events: ReadonlyArray< + | { + timestamp?: string; + name: string; + organization_id?: string | null; + external_id?: string | null; + parent_id?: string | null; + metadata?: { + _cost?: { amount: number | string; currency: string }; + _llm?: { + vendor: string; + model: string; + prompt?: string | null; + response?: string | null; + input_tokens: number; + cached_input_tokens?: number; + output_tokens: number; + total_tokens: number; + }; + }; + customer_id: string; + member_id?: string | null; + } + | { + timestamp?: string; + name: string; + organization_id?: string | null; + external_id?: string | null; + parent_id?: string | null; + metadata?: { + _cost?: { amount: number | string; currency: string }; + _llm?: { + vendor: string; + model: string; + prompt?: string | null; + response?: string | null; + input_tokens: number; + cached_input_tokens?: number; + output_tokens: number; + total_tokens: number; + }; + }; + external_customer_id: string; + external_member_id?: string | null; + } + >; +} +export const EventsingestInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + events: Schema.Array( + Schema.Union([ + Schema.Struct({ + timestamp: Schema.optional(Schema.String), + name: Schema.String, + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + parent_id: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.optional( + Schema.Struct({ + _cost: Schema.optional( + Schema.Struct({ + amount: Schema.Union([Schema.Number, Schema.String]), + currency: Schema.String, + }), + ), + _llm: Schema.optional( + Schema.Struct({ + vendor: Schema.String, + model: Schema.String, + prompt: Schema.optional(Schema.NullOr(Schema.String)), + response: Schema.optional(Schema.NullOr(Schema.String)), + input_tokens: Schema.Number, + cached_input_tokens: Schema.optional(Schema.Number), + output_tokens: Schema.Number, + total_tokens: Schema.Number, + }), + ), + }), + ), + customer_id: Schema.String, + member_id: Schema.optional(Schema.NullOr(Schema.String)), + }), + Schema.Struct({ + timestamp: Schema.optional(Schema.String), + name: Schema.String, + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + parent_id: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.optional( + Schema.Struct({ + _cost: Schema.optional( + Schema.Struct({ + amount: Schema.Union([Schema.Number, Schema.String]), + currency: Schema.String, + }), + ), + _llm: Schema.optional( + Schema.Struct({ + vendor: Schema.String, + model: Schema.String, + prompt: Schema.optional(Schema.NullOr(Schema.String)), + response: Schema.optional(Schema.NullOr(Schema.String)), + input_tokens: Schema.Number, + cached_input_tokens: Schema.optional(Schema.Number), + output_tokens: Schema.Number, + total_tokens: Schema.Number, + }), + ), + }), + ), + external_customer_id: Schema.String, + external_member_id: Schema.optional(Schema.NullOr(Schema.String)), + }), + ]), + ), +}).pipe( + T.Http({ method: "POST", path: "/v1/events/ingest" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface EventsingestOutput { + inserted: number; + duplicates?: number; +} +export const EventsingestOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + inserted: Schema.Number, + duplicates: Schema.optional(Schema.Number), +}) as unknown as Schema.Codec; + +// The operation +/** + * Ingest Events + * + * Ingest batch of events. + * **Scopes**: `events:write` + */ +export const eventsingest = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: EventsingestInput, + outputSchema: EventsingestOutput, +})); diff --git a/packages/polar/src/operations/eventslist.ts b/packages/polar/src/operations/eventslist.ts new file mode 100644 index 0000000000..1a27b5a0f8 --- /dev/null +++ b/packages/polar/src/operations/eventslist.ts @@ -0,0 +1,262 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface EventslistInput { + filter?: string | null; + start_timestamp?: string | null; + end_timestamp?: string | null; + organization_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + meter_id?: string | null; + name?: string | ReadonlyArray | null; + source?: "system" | "user" | ReadonlyArray<"system" | "user"> | null; + query?: string | null; + parent_id?: string | null; + depth?: number | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray<"timestamp" | "-timestamp"> | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const EventslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + filter: Schema.optional(Schema.NullOr(Schema.String)), + start_timestamp: Schema.optional(Schema.NullOr(Schema.String)), + end_timestamp: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + meter_id: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + source: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["system", "user"]), + Schema.Array(Schema.Literals(["system", "user"])), + ]), + ), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + parent_id: Schema.optional(Schema.NullOr(Schema.String)), + depth: Schema.optional(Schema.NullOr(Schema.Number)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr(Schema.Array(Schema.Literals(["timestamp", "-timestamp"]))), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/events/" }), +) as unknown as Schema.Codec; + +// Output Schema +export type EventslistOutput = + | { + items: ReadonlyArray< + | unknown + | { + id: string; + timestamp: string; + organization_id: string; + customer_id: string | null; + customer: + | { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email: string; + email_verified: boolean; + type: string; + name: string | null; + billing_name: string | null; + billing_address: unknown; + tax_id: unknown; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + } + | { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: string; + name: string | null; + billing_name: string | null; + billing_address: unknown; + tax_id: unknown; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + } + | null; + external_customer_id: string | null; + member_id?: string | null; + external_member_id?: string | null; + child_count?: number; + parent_id?: string | null; + label: string; + name: string; + source: string; + metadata: { + _cost?: { amount: string; currency: string }; + _llm?: { + vendor: string; + model: string; + prompt?: string | null; + response?: string | null; + input_tokens: number; + cached_input_tokens?: number; + output_tokens: number; + total_tokens: number; + }; + }; + } + >; + pagination: { total_count: number; max_page: number }; + } + | { + items: ReadonlyArray< + | unknown + | { + id: string; + timestamp: string; + organization_id: string; + customer_id: string | null; + customer: + | { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email: string; + email_verified: boolean; + type: string; + name: string | null; + billing_name: string | null; + billing_address: unknown; + tax_id: unknown; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + } + | { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: string; + name: string | null; + billing_name: string | null; + billing_address: unknown; + tax_id: unknown; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + } + | null; + external_customer_id: string | null; + member_id?: string | null; + external_member_id?: string | null; + child_count?: number; + parent_id?: string | null; + label: string; + name: string; + source: string; + metadata: { + _cost?: { amount: string; currency: string }; + _llm?: { + vendor: string; + model: string; + prompt?: string | null; + response?: string | null; + input_tokens: number; + cached_input_tokens?: number; + output_tokens: number; + total_tokens: number; + }; + }; + } + >; + pagination: { has_next_page: boolean }; + }; +export const EventslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * List Events + * + * List events. + * **Scopes**: `events:read` `events:write` + * + * @param filter - Filter events following filter clauses. JSON string following the same schema a meter filter clause. + * @param start_timestamp - Filter events after this timestamp. + * @param end_timestamp - Filter events before this timestamp. + * @param organization_id - Filter by organization ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by external customer ID. + * @param meter_id - Filter by a meter filter clause. + * @param name - Filter by event name. + * @param source - Filter by event source. + * @param query - Query to filter events. + * @param parent_id - When combined with depth, use this event as the anchor instead of root events. + * @param depth - Fetch descendants up to this depth. When set: 0=root events only, 1=roots+children, etc. Max 5. When not set, returns all events. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const eventslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: EventslistInput, + outputSchema: EventslistOutput, +})); diff --git a/packages/polar/src/operations/eventslistNames.ts b/packages/polar/src/operations/eventslistNames.ts new file mode 100644 index 0000000000..8d3878b639 --- /dev/null +++ b/packages/polar/src/operations/eventslistNames.ts @@ -0,0 +1,114 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface EventslistNamesInput { + organization_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + source?: "system" | "user" | ReadonlyArray<"system" | "user"> | null; + query?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "name" + | "-name" + | "occurrences" + | "-occurrences" + | "first_seen" + | "-first_seen" + | "last_seen" + | "-last_seen" + > | null; +} +export const EventslistNamesInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + source: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["system", "user"]), + Schema.Array(Schema.Literals(["system", "user"])), + ]), + ), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "name", + "-name", + "occurrences", + "-occurrences", + "first_seen", + "-first_seen", + "last_seen", + "-last_seen", + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/events/names" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface EventslistNamesOutput { + items: ReadonlyArray<{ + name: string; + label: string; + source: "system" | "user"; + occurrences: number; + first_seen: string; + last_seen: string; + }>; + pagination: { total_count: number; max_page: number }; +} +export const EventslistNamesOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + name: Schema.String, + label: Schema.String, + source: Schema.Literals(["system", "user"]), + occurrences: Schema.Number, + first_seen: Schema.String, + last_seen: Schema.String, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Event Names + * + * List event names. + * **Scopes**: `events:read` `events:write` + * + * @param organization_id - Filter by organization ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by external customer ID. + * @param source - Filter by event source. + * @param query - Query to filter event names. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const eventslistNames = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: EventslistNamesInput, + outputSchema: EventslistNamesOutput, +})); diff --git a/packages/polar/src/operations/filescreate.ts b/packages/polar/src/operations/filescreate.ts new file mode 100644 index 0000000000..135a6e9fa2 --- /dev/null +++ b/packages/polar/src/operations/filescreate.ts @@ -0,0 +1,128 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface FilescreateInput { + organization_id?: string | null; + name: string; + mime_type: string; + size: number; + checksum_sha256_base64?: string | null; + upload: { + parts: ReadonlyArray<{ + number: number; + chunk_start: number; + chunk_end: number; + checksum_sha256_base64?: string | null; + }>; + }; + service: string; + version?: string | null; +} +export const FilescreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + checksum_sha256_base64: Schema.optional(Schema.NullOr(Schema.String)), + upload: Schema.Struct({ + parts: Schema.Array( + Schema.Struct({ + number: Schema.Number, + chunk_start: Schema.Number, + chunk_end: Schema.Number, + checksum_sha256_base64: Schema.optional(Schema.NullOr(Schema.String)), + }), + ), + }), + service: Schema.String, + version: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "POST", path: "/v1/files/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface FilescreateOutput { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + upload: { + id: string; + path: string; + parts: ReadonlyArray<{ + number: number; + chunk_start: number; + chunk_end: number; + checksum_sha256_base64?: string | null; + url: string; + expires_at: string; + headers?: Record; + }>; + }; + version: string | null; + is_uploaded?: boolean; + service: + | "downloadable" + | "product_media" + | "organization_avatar" + | "support_case_attachment"; + size_readable: string; +} +export const FilescreateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + upload: Schema.Struct({ + id: Schema.String, + path: Schema.String, + parts: Schema.Array( + Schema.Struct({ + number: Schema.Number, + chunk_start: Schema.Number, + chunk_end: Schema.Number, + checksum_sha256_base64: Schema.optional(Schema.NullOr(Schema.String)), + url: Schema.String, + expires_at: Schema.String, + headers: Schema.optional(Schema.Record(Schema.String, Schema.String)), + }), + ), + }), + version: Schema.NullOr(Schema.String), + is_uploaded: Schema.optional(Schema.Boolean), + service: Schema.Literals([ + "downloadable", + "product_media", + "organization_avatar", + "support_case_attachment", + ]), + size_readable: Schema.String, +}) as unknown as Schema.Codec; + +// The operation +/** + * Create File + * + * Create a file. + * **Scopes**: `files:write` + */ +export const filescreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: FilescreateInput, + outputSchema: FilescreateOutput, +})); diff --git a/packages/polar/src/operations/filesdelete.ts b/packages/polar/src/operations/filesdelete.ts new file mode 100644 index 0000000000..5a33c3adae --- /dev/null +++ b/packages/polar/src/operations/filesdelete.ts @@ -0,0 +1,30 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface FilesdeleteInput { + id: string; +} +export const FilesdeleteInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "DELETE", path: "/v1/files/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type FilesdeleteOutput = void; +export const FilesdeleteOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete File + * + * Delete a file. + * **Scopes**: `files:write` + */ +export const filesdelete = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: FilesdeleteInput, + outputSchema: FilesdeleteOutput, +})); diff --git a/packages/polar/src/operations/fileslist.ts b/packages/polar/src/operations/fileslist.ts new file mode 100644 index 0000000000..d8e0d8d3dc --- /dev/null +++ b/packages/polar/src/operations/fileslist.ts @@ -0,0 +1,131 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface FileslistInput { + organization_id?: string | ReadonlyArray | null; + ids?: string | ReadonlyArray | null; + page?: number; + limit?: number; +} +export const FileslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + ids: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), +}).pipe( + T.Http({ method: "GET", path: "/v1/files/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface FileslistOutput { + items: ReadonlyArray< + | { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + } + | { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const FileslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Union([ + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + }), + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ]), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Files + * + * List files. + * **Scopes**: `files:read` `files:write` + * + * @param organization_id - Filter by organization ID. + * @param ids - Filter by file ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const fileslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: FileslistInput, + outputSchema: FileslistOutput, +})); diff --git a/packages/polar/src/operations/filesupdate.ts b/packages/polar/src/operations/filesupdate.ts new file mode 100644 index 0000000000..48e93b4559 --- /dev/null +++ b/packages/polar/src/operations/filesupdate.ts @@ -0,0 +1,110 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface FilesupdateInput { + id: string; + name?: string | null; + version?: string | null; +} +export const FilesupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + name: Schema.optional(Schema.NullOr(Schema.String)), + version: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/files/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type FilesupdateOutput = + | { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + } + | { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }; +export const FilesupdateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + }), + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), +]) as unknown as Schema.Codec; + +// The operation +/** + * Update File + * + * Update a file. + * **Scopes**: `files:write` + * + * @param id - The file ID. + */ +export const filesupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: FilesupdateInput, + outputSchema: FilesupdateOutput, +})); diff --git a/packages/polar/src/operations/filesuploaded.ts b/packages/polar/src/operations/filesuploaded.ts new file mode 100644 index 0000000000..76ffbecbd8 --- /dev/null +++ b/packages/polar/src/operations/filesuploaded.ts @@ -0,0 +1,120 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface FilesuploadedInput { + id: string; + path: string; + parts: ReadonlyArray<{ + number: number; + checksum_etag: string; + checksum_sha256_base64: string | null; + }>; +} +export const FilesuploadedInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + path: Schema.String, + parts: Schema.Array( + Schema.Struct({ + number: Schema.Number, + checksum_etag: Schema.String, + checksum_sha256_base64: Schema.NullOr(Schema.String), + }), + ), +}).pipe( + T.Http({ method: "POST", path: "/v1/files/{id}/uploaded" }), +) as unknown as Schema.Codec; + +// Output Schema +export type FilesuploadedOutput = + | { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + } + | { + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }; +export const FilesuploadedOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + }), + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), +]) as unknown as Schema.Codec; + +// The operation +/** + * Complete File Upload + * + * Complete a file upload. + * **Scopes**: `files:write` + * + * @param id - The file ID. + */ +export const filesuploaded = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: FilesuploadedInput, + outputSchema: FilesuploadedOutput, +})); diff --git a/packages/polar/src/operations/index.ts b/packages/polar/src/operations/index.ts new file mode 100644 index 0000000000..af7c09b06e --- /dev/null +++ b/packages/polar/src/operations/index.ts @@ -0,0 +1,185 @@ +export * from "./organizationslist.ts"; +export * from "./organizationscreate.ts"; +export * from "./organizationsget.ts"; +export * from "./organizationsupdate.ts"; +export * from "./subscriptionslist.ts"; +export * from "./subscriptionscreate.ts"; +export * from "./subscriptionsexport.ts"; +export * from "./subscriptionsget.ts"; +export * from "./subscriptionsupdate.ts"; +export * from "./subscriptionsrevoke.ts"; +export * from "./oauth2clientsoauth2createClient.ts"; +export * from "./oauth2clientsoauth2getClient.ts"; +export * from "./oauth2clientsoauth2updateClient.ts"; +export * from "./oauth2clientsoauth2deleteClient.ts"; +export * from "./oauth2authorize.ts"; +export * from "./oauth2requestToken.ts"; +export * from "./oauth2revokeToken.ts"; +export * from "./oauth2introspectToken.ts"; +export * from "./oauth2userinfo.ts"; +export * from "./benefitslist.ts"; +export * from "./benefitscreate.ts"; +export * from "./benefitsget.ts"; +export * from "./benefitsupdate.ts"; +export * from "./benefitsdelete.ts"; +export * from "./benefitsgrants.ts"; +export * from "./benefitGrantslist.ts"; +export * from "./webhookslistWebhookEndpoints.ts"; +export * from "./webhookscreateWebhookEndpoint.ts"; +export * from "./webhooksgetWebhookEndpoint.ts"; +export * from "./webhooksupdateWebhookEndpoint.ts"; +export * from "./webhooksdeleteWebhookEndpoint.ts"; +export * from "./webhooksresetWebhookEndpointSecret.ts"; +export * from "./webhookslistWebhookDeliveries.ts"; +export * from "./webhooksredeliverWebhookEvent.ts"; +export * from "./productslist.ts"; +export * from "./productscreate.ts"; +export * from "./productsget.ts"; +export * from "./productsupdate.ts"; +export * from "./productsupdateBenefits.ts"; +export * from "./orderslist.ts"; +export * from "./orderscreate.ts"; +export * from "./ordersexport.ts"; +export * from "./ordersget.ts"; +export * from "./ordersupdate.ts"; +export * from "./ordersfinalize.ts"; +export * from "./ordersinvoice.ts"; +export * from "./ordersgenerateInvoice.ts"; +export * from "./ordersreceipt.ts"; +export * from "./refundslist.ts"; +export * from "./refundscreate.ts"; +export * from "./disputeslist.ts"; +export * from "./disputesget.ts"; +export * from "./disputesaccept.ts"; +export * from "./checkoutslist.ts"; +export * from "./checkoutscreate.ts"; +export * from "./checkoutsget.ts"; +export * from "./checkoutsupdate.ts"; +export * from "./checkoutsclientGet.ts"; +export * from "./checkoutsclientUpdate.ts"; +export * from "./checkoutsclientConfirm.ts"; +export * from "./fileslist.ts"; +export * from "./filescreate.ts"; +export * from "./filesuploaded.ts"; +export * from "./filesupdate.ts"; +export * from "./filesdelete.ts"; +export * from "./metricsget.ts"; +export * from "./metricsexport.ts"; +export * from "./metricslimits.ts"; +export * from "./metricslistDashboards.ts"; +export * from "./metricscreateDashboard.ts"; +export * from "./metricsgetDashboard.ts"; +export * from "./metricsupdateDashboard.ts"; +export * from "./metricsdeleteDashboard.ts"; +export * from "./licenseKeyslist.ts"; +export * from "./licenseKeysget.ts"; +export * from "./licenseKeysupdate.ts"; +export * from "./licenseKeysgetActivation.ts"; +export * from "./licenseKeysvalidate.ts"; +export * from "./licenseKeysactivate.ts"; +export * from "./licenseKeysdeactivate.ts"; +export * from "./checkoutLinkslist.ts"; +export * from "./checkoutLinkscreate.ts"; +export * from "./checkoutLinksget.ts"; +export * from "./checkoutLinksupdate.ts"; +export * from "./checkoutLinksdelete.ts"; +export * from "./customFieldslist.ts"; +export * from "./customFieldscreate.ts"; +export * from "./customFieldsget.ts"; +export * from "./customFieldsupdate.ts"; +export * from "./customFieldsdelete.ts"; +export * from "./discountslist.ts"; +export * from "./discountscreate.ts"; +export * from "./discountsget.ts"; +export * from "./discountsupdate.ts"; +export * from "./discountsdelete.ts"; +export * from "./customerslist.ts"; +export * from "./customerscreate.ts"; +export * from "./customersexport.ts"; +export * from "./customersget.ts"; +export * from "./customersupdate.ts"; +export * from "./customersdelete.ts"; +export * from "./customersgetExternal.ts"; +export * from "./customersupdateExternal.ts"; +export * from "./customersdeleteExternal.ts"; +export * from "./customersgetState.ts"; +export * from "./customersgetStateExternal.ts"; +export * from "./customerslistPaymentMethods.ts"; +export * from "./customerslistPaymentMethodsExternal.ts"; +export * from "./memberslistMembers.ts"; +export * from "./customersmemberscreate.ts"; +export * from "./customersmemberscreateExternal.ts"; +export * from "./customersmembersget.ts"; +export * from "./customersmembersupdate.ts"; +export * from "./customersmembersdelete.ts"; +export * from "./customersmembersgetExternal.ts"; +export * from "./customersmembersupdateExternal.ts"; +export * from "./customersmembersdeleteExternal.ts"; +export * from "./customerPortalbenefitGrantslist.ts"; +export * from "./customerPortalbenefitGrantsget.ts"; +export * from "./customerPortalbenefitGrantsupdate.ts"; +export * from "./customerPortalcustomersget.ts"; +export * from "./customerPortalcustomersupdate.ts"; +export * from "./customerPortalcustomerslistPaymentMethods.ts"; +export * from "./customerPortalcustomersaddPaymentMethod.ts"; +export * from "./customerPortalcustomersconfirmPaymentMethod.ts"; +export * from "./customerPortalcustomersdeletePaymentMethod.ts"; +export * from "./customerPortalcustomersrequestEmailUpdate.ts"; +export * from "./customerPortalcustomerscheckEmailUpdate.ts"; +export * from "./customerPortalcustomersverifyEmailUpdate.ts"; +export * from "./customerPortalcustomerMeterslist.ts"; +export * from "./customerPortalcustomerMetersget.ts"; +export * from "./customerPortalseatslistSeats.ts"; +export * from "./customerPortalseatsassignSeat.ts"; +export * from "./customerPortalseatsrevokeSeat.ts"; +export * from "./customerPortalseatsresendInvitation.ts"; +export * from "./customerPortalseatslistClaimedSubscriptions.ts"; +export * from "./customerPortalcustomerSessionintrospect.ts"; +export * from "./customerPortalcustomerSessiongetAuthenticatedUser.ts"; +export * from "./customerPortaldownloadableslist.ts"; +export * from "./customerPortallicenseKeyslist.ts"; +export * from "./customerPortallicenseKeysget.ts"; +export * from "./customerPortallicenseKeysvalidate.ts"; +export * from "./customerPortallicenseKeysactivate.ts"; +export * from "./customerPortallicenseKeysdeactivate.ts"; +export * from "./customerPortalmemberslistMembers.ts"; +export * from "./customerPortalmembersaddMember.ts"; +export * from "./customerPortalmembersupdateMember.ts"; +export * from "./customerPortalmembersremoveMember.ts"; +export * from "./customerPortalorderslist.ts"; +export * from "./customerPortalordersget.ts"; +export * from "./customerPortalordersupdate.ts"; +export * from "./customerPortalordersinvoice.ts"; +export * from "./customerPortalordersgenerateInvoice.ts"; +export * from "./customerPortalordersreceipt.ts"; +export * from "./customerPortalordersgetPaymentStatus.ts"; +export * from "./customerPortalordersconfirmRetryPayment.ts"; +export * from "./customerPortalorganizationsget.ts"; +export * from "./customerPortalsubscriptionslist.ts"; +export * from "./customerPortalsubscriptionsget.ts"; +export * from "./customerPortalsubscriptionsupdate.ts"; +export * from "./customerPortalsubscriptionscancel.ts"; +export * from "./customerPortalwalletslist.ts"; +export * from "./customerPortalwalletsget.ts"; +export * from "./customerSeatslistSeats.ts"; +export * from "./customerSeatsassignSeat.ts"; +export * from "./customerSeatsrevokeSeat.ts"; +export * from "./customerSeatsresendInvitation.ts"; +export * from "./customerSeatsgetClaimInfo.ts"; +export * from "./customerSeatsclaimSeat.ts"; +export * from "./customerSessionscreate.ts"; +export * from "./eventslist.ts"; +export * from "./eventslistNames.ts"; +export * from "./eventsget.ts"; +export * from "./eventsingest.ts"; +export * from "./eventTypeslist.ts"; +export * from "./eventTypesupdate.ts"; +export * from "./meterslist.ts"; +export * from "./meterscreate.ts"; +export * from "./metersget.ts"; +export * from "./metersupdate.ts"; +export * from "./metersquantities.ts"; +export * from "./customerMeterslist.ts"; +export * from "./customerMetersget.ts"; +export * from "./paymentslist.ts"; +export * from "./paymentsget.ts"; diff --git a/packages/polar/src/operations/licenseKeysactivate.ts b/packages/polar/src/operations/licenseKeysactivate.ts new file mode 100644 index 0000000000..9a443b0894 --- /dev/null +++ b/packages/polar/src/operations/licenseKeysactivate.ts @@ -0,0 +1,658 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeysactivateInput { + key: string; + organization_id: string; + label: string; + conditions?: Record; + meta?: Record; +} +export const LicenseKeysactivateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + key: Schema.String, + organization_id: Schema.String, + label: Schema.String, + conditions: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + meta: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + }).pipe( + T.Http({ method: "POST", path: "/v1/license-keys/activate" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface LicenseKeysactivateOutput { + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + license_key: { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + }; +} +export const LicenseKeysactivateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + license_key: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Activate License Key + * + * Activate a license key instance. + * **Scopes**: `license_keys:write` + */ +export const licenseKeysactivate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: LicenseKeysactivateInput, + outputSchema: LicenseKeysactivateOutput, +})); diff --git a/packages/polar/src/operations/licenseKeysdeactivate.ts b/packages/polar/src/operations/licenseKeysdeactivate.ts new file mode 100644 index 0000000000..5fc14cf99b --- /dev/null +++ b/packages/polar/src/operations/licenseKeysdeactivate.ts @@ -0,0 +1,37 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeysdeactivateInput { + key: string; + organization_id: string; + activation_id: string; +} +export const LicenseKeysdeactivateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + key: Schema.String, + organization_id: Schema.String, + activation_id: Schema.String, + }).pipe( + T.Http({ method: "POST", path: "/v1/license-keys/deactivate" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type LicenseKeysdeactivateOutput = void; +export const LicenseKeysdeactivateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Deactivate License Key + * + * Deactivate a license key instance. + * **Scopes**: `license_keys:write` + */ +export const licenseKeysdeactivate = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: LicenseKeysdeactivateInput, + outputSchema: LicenseKeysdeactivateOutput, + }), +); diff --git a/packages/polar/src/operations/licenseKeysget.ts b/packages/polar/src/operations/licenseKeysget.ts new file mode 100644 index 0000000000..82b226e1af --- /dev/null +++ b/packages/polar/src/operations/licenseKeysget.ts @@ -0,0 +1,638 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeysgetInput { + id: string; +} +export const LicenseKeysgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/license-keys/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface LicenseKeysgetOutput { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + activations: ReadonlyArray<{ + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + }>; +} +export const LicenseKeysgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + activations: Schema.Array( + Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + }), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get License Key + * + * Get a license key. + * **Scopes**: `license_keys:read` `license_keys:write` + */ +export const licenseKeysget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: LicenseKeysgetInput, + outputSchema: LicenseKeysgetOutput, +})); diff --git a/packages/polar/src/operations/licenseKeysgetActivation.ts b/packages/polar/src/operations/licenseKeysgetActivation.ts new file mode 100644 index 0000000000..934fcd917b --- /dev/null +++ b/packages/polar/src/operations/licenseKeysgetActivation.ts @@ -0,0 +1,647 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeysgetActivationInput { + id: string; + activation_id: string; +} +export const LicenseKeysgetActivationInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + activation_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ + method: "GET", + path: "/v1/license-keys/{id}/activations/{activation_id}", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface LicenseKeysgetActivationOutput { + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + license_key: { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + }; +} +export const LicenseKeysgetActivationOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + license_key: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Activation + * + * Get a license key activation. + * **Scopes**: `license_keys:read` `license_keys:write` + */ +export const licenseKeysgetActivation = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: LicenseKeysgetActivationInput, + outputSchema: LicenseKeysgetActivationOutput, + }), +); diff --git a/packages/polar/src/operations/licenseKeyslist.ts b/packages/polar/src/operations/licenseKeyslist.ts new file mode 100644 index 0000000000..64cc0ab64d --- /dev/null +++ b/packages/polar/src/operations/licenseKeyslist.ts @@ -0,0 +1,660 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeyslistInput { + organization_id?: string | ReadonlyArray | null; + benefit_id?: string | ReadonlyArray | null; + status?: + | "granted" + | "revoked" + | "disabled" + | ReadonlyArray<"granted" | "revoked" | "disabled"> + | null; + page?: number; + limit?: number; +} +export const LicenseKeyslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + benefit_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + status: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["granted", "revoked", "disabled"]), + Schema.Array(Schema.Literals(["granted", "revoked", "disabled"])), + ]), + ), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), +}).pipe( + T.Http({ method: "GET", path: "/v1/license-keys/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface LicenseKeyslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const LicenseKeyslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List License Keys + * + * Get license keys connected to the given organization & filters. + * **Scopes**: `license_keys:read` `license_keys:write` + * + * @param organization_id - Filter by organization ID. + * @param benefit_id - Filter by benefit ID. + * @param status - Filter by license key status. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const licenseKeyslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: LicenseKeyslistInput, + outputSchema: LicenseKeyslistOutput, +})); diff --git a/packages/polar/src/operations/licenseKeysupdate.ts b/packages/polar/src/operations/licenseKeysupdate.ts new file mode 100644 index 0000000000..4136c3728c --- /dev/null +++ b/packages/polar/src/operations/licenseKeysupdate.ts @@ -0,0 +1,632 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeysupdateInput { + id: string; + status?: "granted" | "revoked" | "disabled" | null; + usage?: number; + limit_activations?: number | null; + limit_usage?: number | null; + expires_at?: string | null; +} +export const LicenseKeysupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + id: Schema.String.pipe(T.PathParam()), + status: Schema.optional( + Schema.NullOr(Schema.Literals(["granted", "revoked", "disabled"])), + ), + usage: Schema.optional(Schema.Number), + limit_activations: Schema.optional(Schema.NullOr(Schema.Number)), + limit_usage: Schema.optional(Schema.NullOr(Schema.Number)), + expires_at: Schema.optional(Schema.NullOr(Schema.String)), + }, +).pipe( + T.Http({ method: "PATCH", path: "/v1/license-keys/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface LicenseKeysupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; +} +export const LicenseKeysupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update License Key + * + * Update a license key. + * **Scopes**: `license_keys:write` + */ +export const licenseKeysupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: LicenseKeysupdateInput, + outputSchema: LicenseKeysupdateOutput, +})); diff --git a/packages/polar/src/operations/licenseKeysvalidate.ts b/packages/polar/src/operations/licenseKeysvalidate.ts new file mode 100644 index 0000000000..d3783cd1ce --- /dev/null +++ b/packages/polar/src/operations/licenseKeysvalidate.ts @@ -0,0 +1,659 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface LicenseKeysvalidateInput { + key: string; + organization_id: string; + activation_id?: string | null; + benefit_id?: string | null; + customer_id?: string | null; + increment_usage?: number | null; + conditions?: Record; +} +export const LicenseKeysvalidateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + key: Schema.String, + organization_id: Schema.String, + activation_id: Schema.optional(Schema.NullOr(Schema.String)), + benefit_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_id: Schema.optional(Schema.NullOr(Schema.String)), + increment_usage: Schema.optional(Schema.NullOr(Schema.Number)), + conditions: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + }).pipe( + T.Http({ method: "POST", path: "/v1/license-keys/validate" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface LicenseKeysvalidateOutput { + id: string; + created_at: string; + modified_at: string | null; + organization_id: string; + customer_id: string; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + benefit_id: string; + key: string; + display_key: string; + status: "granted" | "revoked" | "disabled"; + limit_activations: number | null; + usage: number; + limit_usage: number | null; + validations: number; + last_validated_at: string | null; + expires_at: string | null; + activation?: { + id: string; + license_key_id: string; + label: string; + meta: Record; + created_at: string; + modified_at: string | null; + } | null; +} +export const LicenseKeysvalidateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + organization_id: Schema.String, + customer_id: Schema.String, + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + benefit_id: Schema.String, + key: Schema.String, + display_key: Schema.String, + status: Schema.Literals(["granted", "revoked", "disabled"]), + limit_activations: Schema.NullOr(Schema.Number), + usage: Schema.Number, + limit_usage: Schema.NullOr(Schema.Number), + validations: Schema.Number, + last_validated_at: Schema.NullOr(Schema.String), + expires_at: Schema.NullOr(Schema.String), + activation: Schema.optional( + Schema.NullOr( + Schema.Struct({ + id: Schema.String, + license_key_id: Schema.String, + label: Schema.String, + meta: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + }), + ), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Validate License Key + * + * Validate a license key. + * **Scopes**: `license_keys:write` + */ +export const licenseKeysvalidate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: LicenseKeysvalidateInput, + outputSchema: LicenseKeysvalidateOutput, +})); diff --git a/packages/polar/src/operations/memberslistMembers.ts b/packages/polar/src/operations/memberslistMembers.ts new file mode 100644 index 0000000000..cd53fa357c --- /dev/null +++ b/packages/polar/src/operations/memberslistMembers.ts @@ -0,0 +1,83 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MemberslistMembersInput { + customer_id?: string | null; + external_customer_id?: string | null; + role?: "owner" | "billing_manager" | "member" | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray<"created_at" | "-created_at"> | null; +} +export const MemberslistMembersInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + customer_id: Schema.optional(Schema.NullOr(Schema.String)), + external_customer_id: Schema.optional(Schema.NullOr(Schema.String)), + role: Schema.optional( + Schema.NullOr(Schema.Literals(["owner", "billing_manager", "member"])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array(Schema.Literals(["created_at", "-created_at"])), + ), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/members/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface MemberslistMembersOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + customer_id: string; + email: string; + name: string | null; + external_id: string | null; + role: "owner" | "billing_manager" | "member"; + }>; + pagination: { total_count: number; max_page: number }; +} +export const MemberslistMembersOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + email: Schema.String, + name: Schema.NullOr(Schema.String), + external_id: Schema.NullOr(Schema.String), + role: Schema.Literals(["owner", "billing_manager", "member"]), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Members + * + * List members with optional customer ID filter. + * **Scopes**: `members:read` `members:write` + * + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by customer external ID. + * @param role - Filter by member role. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const memberslistMembers = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MemberslistMembersInput, + outputSchema: MemberslistMembersOutput, +})); diff --git a/packages/polar/src/operations/meterscreate.ts b/packages/polar/src/operations/meterscreate.ts new file mode 100644 index 0000000000..4fdbaa7e24 --- /dev/null +++ b/packages/polar/src/operations/meterscreate.ts @@ -0,0 +1,185 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MeterscreateInput { + metadata?: Record; + name: string; + unit?: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id?: string | null; +} +export const MeterscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + name: Schema.String, + unit: Schema.optional(Schema.Literals(["scalar", "token", "custom"])), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "POST", path: "/v1/meters/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MeterscreateOutput { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; +} +export const MeterscreateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), +}) as unknown as Schema.Codec; + +// The operation +/** + * Create Meter + * + * Create a meter. + * **Scopes**: `meters:write` + */ +export const meterscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MeterscreateInput, + outputSchema: MeterscreateOutput, +})); diff --git a/packages/polar/src/operations/metersget.ts b/packages/polar/src/operations/metersget.ts new file mode 100644 index 0000000000..8ff27d09a9 --- /dev/null +++ b/packages/polar/src/operations/metersget.ts @@ -0,0 +1,114 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetersgetInput { + id: string; +} +export const MetersgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/meters/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MetersgetOutput { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; +} +export const MetersgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Meter + * + * Get a meter by ID. + * **Scopes**: `meters:read` `meters:write` + * + * @param id - The meter ID. + */ +export const metersget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetersgetInput, + outputSchema: MetersgetOutput, +})); diff --git a/packages/polar/src/operations/meterslist.ts b/packages/polar/src/operations/meterslist.ts new file mode 100644 index 0000000000..ca3207336c --- /dev/null +++ b/packages/polar/src/operations/meterslist.ts @@ -0,0 +1,179 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MeterslistInput { + organization_id?: string | ReadonlyArray | null; + query?: string | null; + is_archived?: boolean | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + "created_at" | "-created_at" | "name" | "-name" + > | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const MeterslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + is_archived: Schema.optional(Schema.NullOr(Schema.Boolean)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals(["created_at", "-created_at", "name", "-name"]), + ), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/meters/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MeterslistOutput { + items: ReadonlyArray<{ + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const MeterslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Meters + * + * List meters. + * **Scopes**: `meters:read` `meters:write` + * + * @param organization_id - Filter by organization ID. + * @param query - Filter by name. + * @param is_archived - Filter on archived meters. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const meterslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MeterslistInput, + outputSchema: MeterslistOutput, +})); diff --git a/packages/polar/src/operations/metersquantities.ts b/packages/polar/src/operations/metersquantities.ts new file mode 100644 index 0000000000..1036ed89ec --- /dev/null +++ b/packages/polar/src/operations/metersquantities.ts @@ -0,0 +1,1306 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetersquantitiesInput { + id: string; + start_timestamp: string; + end_timestamp: string; + interval: "year" | "month" | "week" | "day" | "hour"; + timezone?: + | "Africa/Abidjan" + | "Africa/Accra" + | "Africa/Addis_Ababa" + | "Africa/Algiers" + | "Africa/Asmara" + | "Africa/Asmera" + | "Africa/Bamako" + | "Africa/Bangui" + | "Africa/Banjul" + | "Africa/Bissau" + | "Africa/Blantyre" + | "Africa/Brazzaville" + | "Africa/Bujumbura" + | "Africa/Cairo" + | "Africa/Casablanca" + | "Africa/Ceuta" + | "Africa/Conakry" + | "Africa/Dakar" + | "Africa/Dar_es_Salaam" + | "Africa/Djibouti" + | "Africa/Douala" + | "Africa/El_Aaiun" + | "Africa/Freetown" + | "Africa/Gaborone" + | "Africa/Harare" + | "Africa/Johannesburg" + | "Africa/Juba" + | "Africa/Kampala" + | "Africa/Khartoum" + | "Africa/Kigali" + | "Africa/Kinshasa" + | "Africa/Lagos" + | "Africa/Libreville" + | "Africa/Lome" + | "Africa/Luanda" + | "Africa/Lubumbashi" + | "Africa/Lusaka" + | "Africa/Malabo" + | "Africa/Maputo" + | "Africa/Maseru" + | "Africa/Mbabane" + | "Africa/Mogadishu" + | "Africa/Monrovia" + | "Africa/Nairobi" + | "Africa/Ndjamena" + | "Africa/Niamey" + | "Africa/Nouakchott" + | "Africa/Ouagadougou" + | "Africa/Porto-Novo" + | "Africa/Sao_Tome" + | "Africa/Timbuktu" + | "Africa/Tripoli" + | "Africa/Tunis" + | "Africa/Windhoek" + | "America/Adak" + | "America/Anchorage" + | "America/Anguilla" + | "America/Antigua" + | "America/Araguaina" + | "America/Argentina/Buenos_Aires" + | "America/Argentina/Catamarca" + | "America/Argentina/ComodRivadavia" + | "America/Argentina/Cordoba" + | "America/Argentina/Jujuy" + | "America/Argentina/La_Rioja" + | "America/Argentina/Mendoza" + | "America/Argentina/Rio_Gallegos" + | "America/Argentina/Salta" + | "America/Argentina/San_Juan" + | "America/Argentina/San_Luis" + | "America/Argentina/Tucuman" + | "America/Argentina/Ushuaia" + | "America/Aruba" + | "America/Asuncion" + | "America/Atikokan" + | "America/Atka" + | "America/Bahia" + | "America/Bahia_Banderas" + | "America/Barbados" + | "America/Belem" + | "America/Belize" + | "America/Blanc-Sablon" + | "America/Boa_Vista" + | "America/Bogota" + | "America/Boise" + | "America/Buenos_Aires" + | "America/Cambridge_Bay" + | "America/Campo_Grande" + | "America/Cancun" + | "America/Caracas" + | "America/Catamarca" + | "America/Cayenne" + | "America/Cayman" + | "America/Chicago" + | "America/Chihuahua" + | "America/Ciudad_Juarez" + | "America/Coral_Harbour" + | "America/Cordoba" + | "America/Costa_Rica" + | "America/Coyhaique" + | "America/Creston" + | "America/Cuiaba" + | "America/Curacao" + | "America/Danmarkshavn" + | "America/Dawson" + | "America/Dawson_Creek" + | "America/Denver" + | "America/Detroit" + | "America/Dominica" + | "America/Edmonton" + | "America/Eirunepe" + | "America/El_Salvador" + | "America/Ensenada" + | "America/Fort_Nelson" + | "America/Fort_Wayne" + | "America/Fortaleza" + | "America/Glace_Bay" + | "America/Godthab" + | "America/Goose_Bay" + | "America/Grand_Turk" + | "America/Grenada" + | "America/Guadeloupe" + | "America/Guatemala" + | "America/Guayaquil" + | "America/Guyana" + | "America/Halifax" + | "America/Havana" + | "America/Hermosillo" + | "America/Indiana/Indianapolis" + | "America/Indiana/Knox" + | "America/Indiana/Marengo" + | "America/Indiana/Petersburg" + | "America/Indiana/Tell_City" + | "America/Indiana/Vevay" + | "America/Indiana/Vincennes" + | "America/Indiana/Winamac" + | "America/Indianapolis" + | "America/Inuvik" + | "America/Iqaluit" + | "America/Jamaica" + | "America/Jujuy" + | "America/Juneau" + | "America/Kentucky/Louisville" + | "America/Kentucky/Monticello" + | "America/Knox_IN" + | "America/Kralendijk" + | "America/La_Paz" + | "America/Lima" + | "America/Los_Angeles" + | "America/Louisville" + | "America/Lower_Princes" + | "America/Maceio" + | "America/Managua" + | "America/Manaus" + | "America/Marigot" + | "America/Martinique" + | "America/Matamoros" + | "America/Mazatlan" + | "America/Mendoza" + | "America/Menominee" + | "America/Merida" + | "America/Metlakatla" + | "America/Mexico_City" + | "America/Miquelon" + | "America/Moncton" + | "America/Monterrey" + | "America/Montevideo" + | "America/Montreal" + | "America/Montserrat" + | "America/Nassau" + | "America/New_York" + | "America/Nipigon" + | "America/Nome" + | "America/Noronha" + | "America/North_Dakota/Beulah" + | "America/North_Dakota/Center" + | "America/North_Dakota/New_Salem" + | "America/Nuuk" + | "America/Ojinaga" + | "America/Panama" + | "America/Pangnirtung" + | "America/Paramaribo" + | "America/Phoenix" + | "America/Port-au-Prince" + | "America/Port_of_Spain" + | "America/Porto_Acre" + | "America/Porto_Velho" + | "America/Puerto_Rico" + | "America/Punta_Arenas" + | "America/Rainy_River" + | "America/Rankin_Inlet" + | "America/Recife" + | "America/Regina" + | "America/Resolute" + | "America/Rio_Branco" + | "America/Rosario" + | "America/Santa_Isabel" + | "America/Santarem" + | "America/Santiago" + | "America/Santo_Domingo" + | "America/Sao_Paulo" + | "America/Scoresbysund" + | "America/Shiprock" + | "America/Sitka" + | "America/St_Barthelemy" + | "America/St_Johns" + | "America/St_Kitts" + | "America/St_Lucia" + | "America/St_Thomas" + | "America/St_Vincent" + | "America/Swift_Current" + | "America/Tegucigalpa" + | "America/Thule" + | "America/Thunder_Bay" + | "America/Tijuana" + | "America/Toronto" + | "America/Tortola" + | "America/Vancouver" + | "America/Virgin" + | "America/Whitehorse" + | "America/Winnipeg" + | "America/Yakutat" + | "America/Yellowknife" + | "Antarctica/Casey" + | "Antarctica/Davis" + | "Antarctica/DumontDUrville" + | "Antarctica/Macquarie" + | "Antarctica/Mawson" + | "Antarctica/McMurdo" + | "Antarctica/Palmer" + | "Antarctica/Rothera" + | "Antarctica/South_Pole" + | "Antarctica/Syowa" + | "Antarctica/Troll" + | "Antarctica/Vostok" + | "Arctic/Longyearbyen" + | "Asia/Aden" + | "Asia/Almaty" + | "Asia/Amman" + | "Asia/Anadyr" + | "Asia/Aqtau" + | "Asia/Aqtobe" + | "Asia/Ashgabat" + | "Asia/Ashkhabad" + | "Asia/Atyrau" + | "Asia/Baghdad" + | "Asia/Bahrain" + | "Asia/Baku" + | "Asia/Bangkok" + | "Asia/Barnaul" + | "Asia/Beirut" + | "Asia/Bishkek" + | "Asia/Brunei" + | "Asia/Calcutta" + | "Asia/Chita" + | "Asia/Choibalsan" + | "Asia/Chongqing" + | "Asia/Chungking" + | "Asia/Colombo" + | "Asia/Dacca" + | "Asia/Damascus" + | "Asia/Dhaka" + | "Asia/Dili" + | "Asia/Dubai" + | "Asia/Dushanbe" + | "Asia/Famagusta" + | "Asia/Gaza" + | "Asia/Harbin" + | "Asia/Hebron" + | "Asia/Ho_Chi_Minh" + | "Asia/Hong_Kong" + | "Asia/Hovd" + | "Asia/Irkutsk" + | "Asia/Istanbul" + | "Asia/Jakarta" + | "Asia/Jayapura" + | "Asia/Jerusalem" + | "Asia/Kabul" + | "Asia/Kamchatka" + | "Asia/Karachi" + | "Asia/Kashgar" + | "Asia/Kathmandu" + | "Asia/Katmandu" + | "Asia/Khandyga" + | "Asia/Kolkata" + | "Asia/Krasnoyarsk" + | "Asia/Kuala_Lumpur" + | "Asia/Kuching" + | "Asia/Kuwait" + | "Asia/Macao" + | "Asia/Macau" + | "Asia/Magadan" + | "Asia/Makassar" + | "Asia/Manila" + | "Asia/Muscat" + | "Asia/Nicosia" + | "Asia/Novokuznetsk" + | "Asia/Novosibirsk" + | "Asia/Omsk" + | "Asia/Oral" + | "Asia/Phnom_Penh" + | "Asia/Pontianak" + | "Asia/Pyongyang" + | "Asia/Qatar" + | "Asia/Qostanay" + | "Asia/Qyzylorda" + | "Asia/Rangoon" + | "Asia/Riyadh" + | "Asia/Saigon" + | "Asia/Sakhalin" + | "Asia/Samarkand" + | "Asia/Seoul" + | "Asia/Shanghai" + | "Asia/Singapore" + | "Asia/Srednekolymsk" + | "Asia/Taipei" + | "Asia/Tashkent" + | "Asia/Tbilisi" + | "Asia/Tehran" + | "Asia/Tel_Aviv" + | "Asia/Thimbu" + | "Asia/Thimphu" + | "Asia/Tokyo" + | "Asia/Tomsk" + | "Asia/Ujung_Pandang" + | "Asia/Ulaanbaatar" + | "Asia/Ulan_Bator" + | "Asia/Urumqi" + | "Asia/Ust-Nera" + | "Asia/Vientiane" + | "Asia/Vladivostok" + | "Asia/Yakutsk" + | "Asia/Yangon" + | "Asia/Yekaterinburg" + | "Asia/Yerevan" + | "Atlantic/Azores" + | "Atlantic/Bermuda" + | "Atlantic/Canary" + | "Atlantic/Cape_Verde" + | "Atlantic/Faeroe" + | "Atlantic/Faroe" + | "Atlantic/Jan_Mayen" + | "Atlantic/Madeira" + | "Atlantic/Reykjavik" + | "Atlantic/South_Georgia" + | "Atlantic/St_Helena" + | "Atlantic/Stanley" + | "Australia/ACT" + | "Australia/Adelaide" + | "Australia/Brisbane" + | "Australia/Broken_Hill" + | "Australia/Canberra" + | "Australia/Currie" + | "Australia/Darwin" + | "Australia/Eucla" + | "Australia/Hobart" + | "Australia/LHI" + | "Australia/Lindeman" + | "Australia/Lord_Howe" + | "Australia/Melbourne" + | "Australia/NSW" + | "Australia/North" + | "Australia/Perth" + | "Australia/Queensland" + | "Australia/South" + | "Australia/Sydney" + | "Australia/Tasmania" + | "Australia/Victoria" + | "Australia/West" + | "Australia/Yancowinna" + | "Brazil/Acre" + | "Brazil/DeNoronha" + | "Brazil/East" + | "Brazil/West" + | "CET" + | "CST6CDT" + | "Canada/Atlantic" + | "Canada/Central" + | "Canada/Eastern" + | "Canada/Mountain" + | "Canada/Newfoundland" + | "Canada/Pacific" + | "Canada/Saskatchewan" + | "Canada/Yukon" + | "Chile/Continental" + | "Chile/EasterIsland" + | "Cuba" + | "EET" + | "EST" + | "EST5EDT" + | "Egypt" + | "Eire" + | "Etc/GMT" + | "Etc/GMT+0" + | "Etc/GMT+1" + | "Etc/GMT+10" + | "Etc/GMT+11" + | "Etc/GMT+12" + | "Etc/GMT+2" + | "Etc/GMT+3" + | "Etc/GMT+4" + | "Etc/GMT+5" + | "Etc/GMT+6" + | "Etc/GMT+7" + | "Etc/GMT+8" + | "Etc/GMT+9" + | "Etc/GMT-0" + | "Etc/GMT-1" + | "Etc/GMT-10" + | "Etc/GMT-11" + | "Etc/GMT-12" + | "Etc/GMT-13" + | "Etc/GMT-14" + | "Etc/GMT-2" + | "Etc/GMT-3" + | "Etc/GMT-4" + | "Etc/GMT-5" + | "Etc/GMT-6" + | "Etc/GMT-7" + | "Etc/GMT-8" + | "Etc/GMT-9" + | "Etc/GMT0" + | "Etc/Greenwich" + | "Etc/UCT" + | "Etc/UTC" + | "Etc/Universal" + | "Etc/Zulu" + | "Europe/Amsterdam" + | "Europe/Andorra" + | "Europe/Astrakhan" + | "Europe/Athens" + | "Europe/Belfast" + | "Europe/Belgrade" + | "Europe/Berlin" + | "Europe/Bratislava" + | "Europe/Brussels" + | "Europe/Bucharest" + | "Europe/Budapest" + | "Europe/Busingen" + | "Europe/Chisinau" + | "Europe/Copenhagen" + | "Europe/Dublin" + | "Europe/Gibraltar" + | "Europe/Guernsey" + | "Europe/Helsinki" + | "Europe/Isle_of_Man" + | "Europe/Istanbul" + | "Europe/Jersey" + | "Europe/Kaliningrad" + | "Europe/Kiev" + | "Europe/Kirov" + | "Europe/Kyiv" + | "Europe/Lisbon" + | "Europe/Ljubljana" + | "Europe/London" + | "Europe/Luxembourg" + | "Europe/Madrid" + | "Europe/Malta" + | "Europe/Mariehamn" + | "Europe/Minsk" + | "Europe/Monaco" + | "Europe/Moscow" + | "Europe/Nicosia" + | "Europe/Oslo" + | "Europe/Paris" + | "Europe/Podgorica" + | "Europe/Prague" + | "Europe/Riga" + | "Europe/Rome" + | "Europe/Samara" + | "Europe/San_Marino" + | "Europe/Sarajevo" + | "Europe/Saratov" + | "Europe/Simferopol" + | "Europe/Skopje" + | "Europe/Sofia" + | "Europe/Stockholm" + | "Europe/Tallinn" + | "Europe/Tirane" + | "Europe/Tiraspol" + | "Europe/Ulyanovsk" + | "Europe/Uzhgorod" + | "Europe/Vaduz" + | "Europe/Vatican" + | "Europe/Vienna" + | "Europe/Vilnius" + | "Europe/Volgograd" + | "Europe/Warsaw" + | "Europe/Zagreb" + | "Europe/Zaporozhye" + | "Europe/Zurich" + | "Factory" + | "GB" + | "GB-Eire" + | "GMT" + | "GMT+0" + | "GMT-0" + | "GMT0" + | "Greenwich" + | "HST" + | "Hongkong" + | "Iceland" + | "Indian/Antananarivo" + | "Indian/Chagos" + | "Indian/Christmas" + | "Indian/Cocos" + | "Indian/Comoro" + | "Indian/Kerguelen" + | "Indian/Mahe" + | "Indian/Maldives" + | "Indian/Mauritius" + | "Indian/Mayotte" + | "Indian/Reunion" + | "Iran" + | "Israel" + | "Jamaica" + | "Japan" + | "Kwajalein" + | "Libya" + | "MET" + | "MST" + | "MST7MDT" + | "Mexico/BajaNorte" + | "Mexico/BajaSur" + | "Mexico/General" + | "NZ" + | "NZ-CHAT" + | "Navajo" + | "PRC" + | "PST8PDT" + | "Pacific/Apia" + | "Pacific/Auckland" + | "Pacific/Bougainville" + | "Pacific/Chatham" + | "Pacific/Chuuk" + | "Pacific/Easter" + | "Pacific/Efate" + | "Pacific/Enderbury" + | "Pacific/Fakaofo" + | "Pacific/Fiji" + | "Pacific/Funafuti" + | "Pacific/Galapagos" + | "Pacific/Gambier" + | "Pacific/Guadalcanal" + | "Pacific/Guam" + | "Pacific/Honolulu" + | "Pacific/Johnston" + | "Pacific/Kanton" + | "Pacific/Kiritimati" + | "Pacific/Kosrae" + | "Pacific/Kwajalein" + | "Pacific/Majuro" + | "Pacific/Marquesas" + | "Pacific/Midway" + | "Pacific/Nauru" + | "Pacific/Niue" + | "Pacific/Norfolk" + | "Pacific/Noumea" + | "Pacific/Pago_Pago" + | "Pacific/Palau" + | "Pacific/Pitcairn" + | "Pacific/Pohnpei" + | "Pacific/Ponape" + | "Pacific/Port_Moresby" + | "Pacific/Rarotonga" + | "Pacific/Saipan" + | "Pacific/Samoa" + | "Pacific/Tahiti" + | "Pacific/Tarawa" + | "Pacific/Tongatapu" + | "Pacific/Truk" + | "Pacific/Wake" + | "Pacific/Wallis" + | "Pacific/Yap" + | "Poland" + | "Portugal" + | "ROC" + | "ROK" + | "Singapore" + | "Turkey" + | "UCT" + | "US/Alaska" + | "US/Aleutian" + | "US/Arizona" + | "US/Central" + | "US/East-Indiana" + | "US/Eastern" + | "US/Hawaii" + | "US/Indiana-Starke" + | "US/Michigan" + | "US/Mountain" + | "US/Pacific" + | "US/Samoa" + | "UTC" + | "Universal" + | "W-SU" + | "WET" + | "Zulu" + | "localtime"; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + customer_aggregation_function?: + | "count" + | "sum" + | "max" + | "min" + | "avg" + | "unique" + | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const MetersquantitiesInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + start_timestamp: Schema.String, + end_timestamp: Schema.String, + interval: Schema.Literals(["year", "month", "week", "day", "hour"]), + timezone: Schema.optional( + Schema.Literals([ + "Africa/Abidjan", + "Africa/Accra", + "Africa/Addis_Ababa", + "Africa/Algiers", + "Africa/Asmara", + "Africa/Asmera", + "Africa/Bamako", + "Africa/Bangui", + "Africa/Banjul", + "Africa/Bissau", + "Africa/Blantyre", + "Africa/Brazzaville", + "Africa/Bujumbura", + "Africa/Cairo", + "Africa/Casablanca", + "Africa/Ceuta", + "Africa/Conakry", + "Africa/Dakar", + "Africa/Dar_es_Salaam", + "Africa/Djibouti", + "Africa/Douala", + "Africa/El_Aaiun", + "Africa/Freetown", + "Africa/Gaborone", + "Africa/Harare", + "Africa/Johannesburg", + "Africa/Juba", + "Africa/Kampala", + "Africa/Khartoum", + "Africa/Kigali", + "Africa/Kinshasa", + "Africa/Lagos", + "Africa/Libreville", + "Africa/Lome", + "Africa/Luanda", + "Africa/Lubumbashi", + "Africa/Lusaka", + "Africa/Malabo", + "Africa/Maputo", + "Africa/Maseru", + "Africa/Mbabane", + "Africa/Mogadishu", + "Africa/Monrovia", + "Africa/Nairobi", + "Africa/Ndjamena", + "Africa/Niamey", + "Africa/Nouakchott", + "Africa/Ouagadougou", + "Africa/Porto-Novo", + "Africa/Sao_Tome", + "Africa/Timbuktu", + "Africa/Tripoli", + "Africa/Tunis", + "Africa/Windhoek", + "America/Adak", + "America/Anchorage", + "America/Anguilla", + "America/Antigua", + "America/Araguaina", + "America/Argentina/Buenos_Aires", + "America/Argentina/Catamarca", + "America/Argentina/ComodRivadavia", + "America/Argentina/Cordoba", + "America/Argentina/Jujuy", + "America/Argentina/La_Rioja", + "America/Argentina/Mendoza", + "America/Argentina/Rio_Gallegos", + "America/Argentina/Salta", + "America/Argentina/San_Juan", + "America/Argentina/San_Luis", + "America/Argentina/Tucuman", + "America/Argentina/Ushuaia", + "America/Aruba", + "America/Asuncion", + "America/Atikokan", + "America/Atka", + "America/Bahia", + "America/Bahia_Banderas", + "America/Barbados", + "America/Belem", + "America/Belize", + "America/Blanc-Sablon", + "America/Boa_Vista", + "America/Bogota", + "America/Boise", + "America/Buenos_Aires", + "America/Cambridge_Bay", + "America/Campo_Grande", + "America/Cancun", + "America/Caracas", + "America/Catamarca", + "America/Cayenne", + "America/Cayman", + "America/Chicago", + "America/Chihuahua", + "America/Ciudad_Juarez", + "America/Coral_Harbour", + "America/Cordoba", + "America/Costa_Rica", + "America/Coyhaique", + "America/Creston", + "America/Cuiaba", + "America/Curacao", + "America/Danmarkshavn", + "America/Dawson", + "America/Dawson_Creek", + "America/Denver", + "America/Detroit", + "America/Dominica", + "America/Edmonton", + "America/Eirunepe", + "America/El_Salvador", + "America/Ensenada", + "America/Fort_Nelson", + "America/Fort_Wayne", + "America/Fortaleza", + "America/Glace_Bay", + "America/Godthab", + "America/Goose_Bay", + "America/Grand_Turk", + "America/Grenada", + "America/Guadeloupe", + "America/Guatemala", + "America/Guayaquil", + "America/Guyana", + "America/Halifax", + "America/Havana", + "America/Hermosillo", + "America/Indiana/Indianapolis", + "America/Indiana/Knox", + "America/Indiana/Marengo", + "America/Indiana/Petersburg", + "America/Indiana/Tell_City", + "America/Indiana/Vevay", + "America/Indiana/Vincennes", + "America/Indiana/Winamac", + "America/Indianapolis", + "America/Inuvik", + "America/Iqaluit", + "America/Jamaica", + "America/Jujuy", + "America/Juneau", + "America/Kentucky/Louisville", + "America/Kentucky/Monticello", + "America/Knox_IN", + "America/Kralendijk", + "America/La_Paz", + "America/Lima", + "America/Los_Angeles", + "America/Louisville", + "America/Lower_Princes", + "America/Maceio", + "America/Managua", + "America/Manaus", + "America/Marigot", + "America/Martinique", + "America/Matamoros", + "America/Mazatlan", + "America/Mendoza", + "America/Menominee", + "America/Merida", + "America/Metlakatla", + "America/Mexico_City", + "America/Miquelon", + "America/Moncton", + "America/Monterrey", + "America/Montevideo", + "America/Montreal", + "America/Montserrat", + "America/Nassau", + "America/New_York", + "America/Nipigon", + "America/Nome", + "America/Noronha", + "America/North_Dakota/Beulah", + "America/North_Dakota/Center", + "America/North_Dakota/New_Salem", + "America/Nuuk", + "America/Ojinaga", + "America/Panama", + "America/Pangnirtung", + "America/Paramaribo", + "America/Phoenix", + "America/Port-au-Prince", + "America/Port_of_Spain", + "America/Porto_Acre", + "America/Porto_Velho", + "America/Puerto_Rico", + "America/Punta_Arenas", + "America/Rainy_River", + "America/Rankin_Inlet", + "America/Recife", + "America/Regina", + "America/Resolute", + "America/Rio_Branco", + "America/Rosario", + "America/Santa_Isabel", + "America/Santarem", + "America/Santiago", + "America/Santo_Domingo", + "America/Sao_Paulo", + "America/Scoresbysund", + "America/Shiprock", + "America/Sitka", + "America/St_Barthelemy", + "America/St_Johns", + "America/St_Kitts", + "America/St_Lucia", + "America/St_Thomas", + "America/St_Vincent", + "America/Swift_Current", + "America/Tegucigalpa", + "America/Thule", + "America/Thunder_Bay", + "America/Tijuana", + "America/Toronto", + "America/Tortola", + "America/Vancouver", + "America/Virgin", + "America/Whitehorse", + "America/Winnipeg", + "America/Yakutat", + "America/Yellowknife", + "Antarctica/Casey", + "Antarctica/Davis", + "Antarctica/DumontDUrville", + "Antarctica/Macquarie", + "Antarctica/Mawson", + "Antarctica/McMurdo", + "Antarctica/Palmer", + "Antarctica/Rothera", + "Antarctica/South_Pole", + "Antarctica/Syowa", + "Antarctica/Troll", + "Antarctica/Vostok", + "Arctic/Longyearbyen", + "Asia/Aden", + "Asia/Almaty", + "Asia/Amman", + "Asia/Anadyr", + "Asia/Aqtau", + "Asia/Aqtobe", + "Asia/Ashgabat", + "Asia/Ashkhabad", + "Asia/Atyrau", + "Asia/Baghdad", + "Asia/Bahrain", + "Asia/Baku", + "Asia/Bangkok", + "Asia/Barnaul", + "Asia/Beirut", + "Asia/Bishkek", + "Asia/Brunei", + "Asia/Calcutta", + "Asia/Chita", + "Asia/Choibalsan", + "Asia/Chongqing", + "Asia/Chungking", + "Asia/Colombo", + "Asia/Dacca", + "Asia/Damascus", + "Asia/Dhaka", + "Asia/Dili", + "Asia/Dubai", + "Asia/Dushanbe", + "Asia/Famagusta", + "Asia/Gaza", + "Asia/Harbin", + "Asia/Hebron", + "Asia/Ho_Chi_Minh", + "Asia/Hong_Kong", + "Asia/Hovd", + "Asia/Irkutsk", + "Asia/Istanbul", + "Asia/Jakarta", + "Asia/Jayapura", + "Asia/Jerusalem", + "Asia/Kabul", + "Asia/Kamchatka", + "Asia/Karachi", + "Asia/Kashgar", + "Asia/Kathmandu", + "Asia/Katmandu", + "Asia/Khandyga", + "Asia/Kolkata", + "Asia/Krasnoyarsk", + "Asia/Kuala_Lumpur", + "Asia/Kuching", + "Asia/Kuwait", + "Asia/Macao", + "Asia/Macau", + "Asia/Magadan", + "Asia/Makassar", + "Asia/Manila", + "Asia/Muscat", + "Asia/Nicosia", + "Asia/Novokuznetsk", + "Asia/Novosibirsk", + "Asia/Omsk", + "Asia/Oral", + "Asia/Phnom_Penh", + "Asia/Pontianak", + "Asia/Pyongyang", + "Asia/Qatar", + "Asia/Qostanay", + "Asia/Qyzylorda", + "Asia/Rangoon", + "Asia/Riyadh", + "Asia/Saigon", + "Asia/Sakhalin", + "Asia/Samarkand", + "Asia/Seoul", + "Asia/Shanghai", + "Asia/Singapore", + "Asia/Srednekolymsk", + "Asia/Taipei", + "Asia/Tashkent", + "Asia/Tbilisi", + "Asia/Tehran", + "Asia/Tel_Aviv", + "Asia/Thimbu", + "Asia/Thimphu", + "Asia/Tokyo", + "Asia/Tomsk", + "Asia/Ujung_Pandang", + "Asia/Ulaanbaatar", + "Asia/Ulan_Bator", + "Asia/Urumqi", + "Asia/Ust-Nera", + "Asia/Vientiane", + "Asia/Vladivostok", + "Asia/Yakutsk", + "Asia/Yangon", + "Asia/Yekaterinburg", + "Asia/Yerevan", + "Atlantic/Azores", + "Atlantic/Bermuda", + "Atlantic/Canary", + "Atlantic/Cape_Verde", + "Atlantic/Faeroe", + "Atlantic/Faroe", + "Atlantic/Jan_Mayen", + "Atlantic/Madeira", + "Atlantic/Reykjavik", + "Atlantic/South_Georgia", + "Atlantic/St_Helena", + "Atlantic/Stanley", + "Australia/ACT", + "Australia/Adelaide", + "Australia/Brisbane", + "Australia/Broken_Hill", + "Australia/Canberra", + "Australia/Currie", + "Australia/Darwin", + "Australia/Eucla", + "Australia/Hobart", + "Australia/LHI", + "Australia/Lindeman", + "Australia/Lord_Howe", + "Australia/Melbourne", + "Australia/NSW", + "Australia/North", + "Australia/Perth", + "Australia/Queensland", + "Australia/South", + "Australia/Sydney", + "Australia/Tasmania", + "Australia/Victoria", + "Australia/West", + "Australia/Yancowinna", + "Brazil/Acre", + "Brazil/DeNoronha", + "Brazil/East", + "Brazil/West", + "CET", + "CST6CDT", + "Canada/Atlantic", + "Canada/Central", + "Canada/Eastern", + "Canada/Mountain", + "Canada/Newfoundland", + "Canada/Pacific", + "Canada/Saskatchewan", + "Canada/Yukon", + "Chile/Continental", + "Chile/EasterIsland", + "Cuba", + "EET", + "EST", + "EST5EDT", + "Egypt", + "Eire", + "Etc/GMT", + "Etc/GMT+0", + "Etc/GMT+1", + "Etc/GMT+10", + "Etc/GMT+11", + "Etc/GMT+12", + "Etc/GMT+2", + "Etc/GMT+3", + "Etc/GMT+4", + "Etc/GMT+5", + "Etc/GMT+6", + "Etc/GMT+7", + "Etc/GMT+8", + "Etc/GMT+9", + "Etc/GMT-0", + "Etc/GMT-1", + "Etc/GMT-10", + "Etc/GMT-11", + "Etc/GMT-12", + "Etc/GMT-13", + "Etc/GMT-14", + "Etc/GMT-2", + "Etc/GMT-3", + "Etc/GMT-4", + "Etc/GMT-5", + "Etc/GMT-6", + "Etc/GMT-7", + "Etc/GMT-8", + "Etc/GMT-9", + "Etc/GMT0", + "Etc/Greenwich", + "Etc/UCT", + "Etc/UTC", + "Etc/Universal", + "Etc/Zulu", + "Europe/Amsterdam", + "Europe/Andorra", + "Europe/Astrakhan", + "Europe/Athens", + "Europe/Belfast", + "Europe/Belgrade", + "Europe/Berlin", + "Europe/Bratislava", + "Europe/Brussels", + "Europe/Bucharest", + "Europe/Budapest", + "Europe/Busingen", + "Europe/Chisinau", + "Europe/Copenhagen", + "Europe/Dublin", + "Europe/Gibraltar", + "Europe/Guernsey", + "Europe/Helsinki", + "Europe/Isle_of_Man", + "Europe/Istanbul", + "Europe/Jersey", + "Europe/Kaliningrad", + "Europe/Kiev", + "Europe/Kirov", + "Europe/Kyiv", + "Europe/Lisbon", + "Europe/Ljubljana", + "Europe/London", + "Europe/Luxembourg", + "Europe/Madrid", + "Europe/Malta", + "Europe/Mariehamn", + "Europe/Minsk", + "Europe/Monaco", + "Europe/Moscow", + "Europe/Nicosia", + "Europe/Oslo", + "Europe/Paris", + "Europe/Podgorica", + "Europe/Prague", + "Europe/Riga", + "Europe/Rome", + "Europe/Samara", + "Europe/San_Marino", + "Europe/Sarajevo", + "Europe/Saratov", + "Europe/Simferopol", + "Europe/Skopje", + "Europe/Sofia", + "Europe/Stockholm", + "Europe/Tallinn", + "Europe/Tirane", + "Europe/Tiraspol", + "Europe/Ulyanovsk", + "Europe/Uzhgorod", + "Europe/Vaduz", + "Europe/Vatican", + "Europe/Vienna", + "Europe/Vilnius", + "Europe/Volgograd", + "Europe/Warsaw", + "Europe/Zagreb", + "Europe/Zaporozhye", + "Europe/Zurich", + "Factory", + "GB", + "GB-Eire", + "GMT", + "GMT+0", + "GMT-0", + "GMT0", + "Greenwich", + "HST", + "Hongkong", + "Iceland", + "Indian/Antananarivo", + "Indian/Chagos", + "Indian/Christmas", + "Indian/Cocos", + "Indian/Comoro", + "Indian/Kerguelen", + "Indian/Mahe", + "Indian/Maldives", + "Indian/Mauritius", + "Indian/Mayotte", + "Indian/Reunion", + "Iran", + "Israel", + "Jamaica", + "Japan", + "Kwajalein", + "Libya", + "MET", + "MST", + "MST7MDT", + "Mexico/BajaNorte", + "Mexico/BajaSur", + "Mexico/General", + "NZ", + "NZ-CHAT", + "Navajo", + "PRC", + "PST8PDT", + "Pacific/Apia", + "Pacific/Auckland", + "Pacific/Bougainville", + "Pacific/Chatham", + "Pacific/Chuuk", + "Pacific/Easter", + "Pacific/Efate", + "Pacific/Enderbury", + "Pacific/Fakaofo", + "Pacific/Fiji", + "Pacific/Funafuti", + "Pacific/Galapagos", + "Pacific/Gambier", + "Pacific/Guadalcanal", + "Pacific/Guam", + "Pacific/Honolulu", + "Pacific/Johnston", + "Pacific/Kanton", + "Pacific/Kiritimati", + "Pacific/Kosrae", + "Pacific/Kwajalein", + "Pacific/Majuro", + "Pacific/Marquesas", + "Pacific/Midway", + "Pacific/Nauru", + "Pacific/Niue", + "Pacific/Norfolk", + "Pacific/Noumea", + "Pacific/Pago_Pago", + "Pacific/Palau", + "Pacific/Pitcairn", + "Pacific/Pohnpei", + "Pacific/Ponape", + "Pacific/Port_Moresby", + "Pacific/Rarotonga", + "Pacific/Saipan", + "Pacific/Samoa", + "Pacific/Tahiti", + "Pacific/Tarawa", + "Pacific/Tongatapu", + "Pacific/Truk", + "Pacific/Wake", + "Pacific/Wallis", + "Pacific/Yap", + "Poland", + "Portugal", + "ROC", + "ROK", + "Singapore", + "Turkey", + "UCT", + "US/Alaska", + "US/Aleutian", + "US/Arizona", + "US/Central", + "US/East-Indiana", + "US/Eastern", + "US/Hawaii", + "US/Indiana-Starke", + "US/Michigan", + "US/Mountain", + "US/Pacific", + "US/Samoa", + "UTC", + "Universal", + "W-SU", + "WET", + "Zulu", + "localtime", + ]), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_aggregation_function: Schema.optional( + Schema.NullOr( + Schema.Literals(["count", "sum", "max", "min", "avg", "unique"]), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/meters/{id}/quantities" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MetersquantitiesOutput { + quantities: ReadonlyArray<{ timestamp: string; quantity: number }>; + total: number; +} +export const MetersquantitiesOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + quantities: Schema.Array( + Schema.Struct({ + timestamp: Schema.String, + quantity: Schema.Number, + }), + ), + total: Schema.Number, + }, +) as unknown as Schema.Codec; + +// The operation +/** + * Get Meter Quantities + * + * Get quantities of a meter over a time period. + * **Scopes**: `meters:read` `meters:write` + * + * @param id - The meter ID. + * @param start_timestamp - Start timestamp. + * @param end_timestamp - End timestamp. + * @param interval - Interval between two timestamps. + * @param timezone - Timezone to use for the timestamps. Default is UTC. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by external customer ID. + * @param customer_aggregation_function - If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const metersquantities = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetersquantitiesInput, + outputSchema: MetersquantitiesOutput, +})); diff --git a/packages/polar/src/operations/metersupdate.ts b/packages/polar/src/operations/metersupdate.ts new file mode 100644 index 0000000000..907b5275c7 --- /dev/null +++ b/packages/polar/src/operations/metersupdate.ts @@ -0,0 +1,204 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetersupdateInput { + id: string; + metadata?: Record; + name?: string | null; + unit?: "scalar" | "token" | "custom" | null; + custom_label?: string | null; + custom_multiplier?: number | null; + filter?: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + } | null; + aggregation?: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string } + | null; + is_archived?: boolean | null; +} +export const MetersupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + name: Schema.optional(Schema.NullOr(Schema.String)), + unit: Schema.optional( + Schema.NullOr(Schema.Literals(["scalar", "token", "custom"])), + ), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.optional( + Schema.NullOr( + Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + ), + ), + aggregation: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + ), + ), + is_archived: Schema.optional(Schema.NullOr(Schema.Boolean)), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/meters/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MetersupdateOutput { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; +} +export const MetersupdateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), +}) as unknown as Schema.Codec; + +// The operation +/** + * Update Meter + * + * Update a meter. + * **Scopes**: `meters:write` + * + * @param id - The meter ID. + */ +export const metersupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetersupdateInput, + outputSchema: MetersupdateOutput, +})); diff --git a/packages/polar/src/operations/metricscreateDashboard.ts b/packages/polar/src/operations/metricscreateDashboard.ts new file mode 100644 index 0000000000..af9ec632eb --- /dev/null +++ b/packages/polar/src/operations/metricscreateDashboard.ts @@ -0,0 +1,51 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricscreateDashboardInput { + name: string; + metrics?: ReadonlyArray; + organization_id?: string | null; +} +export const MetricscreateDashboardInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + name: Schema.String, + metrics: Schema.optional(Schema.Array(Schema.String)), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "POST", path: "/v1/metrics/dashboards" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface MetricscreateDashboardOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + metrics: ReadonlyArray; + organization_id: string; +} +export const MetricscreateDashboardOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + metrics: Schema.Array(Schema.String), + organization_id: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Metric Dashboard + * + * Create a user-defined metric dashboard. + * **Scopes**: `metrics:write` + */ +export const metricscreateDashboard = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: MetricscreateDashboardInput, + outputSchema: MetricscreateDashboardOutput, + }), +); diff --git a/packages/polar/src/operations/metricsdeleteDashboard.ts b/packages/polar/src/operations/metricsdeleteDashboard.ts new file mode 100644 index 0000000000..4521cbead0 --- /dev/null +++ b/packages/polar/src/operations/metricsdeleteDashboard.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricsdeleteDashboardInput { + id: string; +} +export const MetricsdeleteDashboardInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/metrics/dashboards/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type MetricsdeleteDashboardOutput = void; +export const MetricsdeleteDashboardOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Metric Dashboard + * + * Delete a user-defined metric dashboard. + * **Scopes**: `metrics:write` + * + * @param id - The metric dashboard ID. + */ +export const metricsdeleteDashboard = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: MetricsdeleteDashboardInput, + outputSchema: MetricsdeleteDashboardOutput, + }), +); diff --git a/packages/polar/src/operations/metricsexport.ts b/packages/polar/src/operations/metricsexport.ts new file mode 100644 index 0000000000..84894bd163 --- /dev/null +++ b/packages/polar/src/operations/metricsexport.ts @@ -0,0 +1,1274 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricsexportInput { + start_date: string; + end_date: string; + timezone?: + | "Africa/Abidjan" + | "Africa/Accra" + | "Africa/Addis_Ababa" + | "Africa/Algiers" + | "Africa/Asmara" + | "Africa/Asmera" + | "Africa/Bamako" + | "Africa/Bangui" + | "Africa/Banjul" + | "Africa/Bissau" + | "Africa/Blantyre" + | "Africa/Brazzaville" + | "Africa/Bujumbura" + | "Africa/Cairo" + | "Africa/Casablanca" + | "Africa/Ceuta" + | "Africa/Conakry" + | "Africa/Dakar" + | "Africa/Dar_es_Salaam" + | "Africa/Djibouti" + | "Africa/Douala" + | "Africa/El_Aaiun" + | "Africa/Freetown" + | "Africa/Gaborone" + | "Africa/Harare" + | "Africa/Johannesburg" + | "Africa/Juba" + | "Africa/Kampala" + | "Africa/Khartoum" + | "Africa/Kigali" + | "Africa/Kinshasa" + | "Africa/Lagos" + | "Africa/Libreville" + | "Africa/Lome" + | "Africa/Luanda" + | "Africa/Lubumbashi" + | "Africa/Lusaka" + | "Africa/Malabo" + | "Africa/Maputo" + | "Africa/Maseru" + | "Africa/Mbabane" + | "Africa/Mogadishu" + | "Africa/Monrovia" + | "Africa/Nairobi" + | "Africa/Ndjamena" + | "Africa/Niamey" + | "Africa/Nouakchott" + | "Africa/Ouagadougou" + | "Africa/Porto-Novo" + | "Africa/Sao_Tome" + | "Africa/Timbuktu" + | "Africa/Tripoli" + | "Africa/Tunis" + | "Africa/Windhoek" + | "America/Adak" + | "America/Anchorage" + | "America/Anguilla" + | "America/Antigua" + | "America/Araguaina" + | "America/Argentina/Buenos_Aires" + | "America/Argentina/Catamarca" + | "America/Argentina/ComodRivadavia" + | "America/Argentina/Cordoba" + | "America/Argentina/Jujuy" + | "America/Argentina/La_Rioja" + | "America/Argentina/Mendoza" + | "America/Argentina/Rio_Gallegos" + | "America/Argentina/Salta" + | "America/Argentina/San_Juan" + | "America/Argentina/San_Luis" + | "America/Argentina/Tucuman" + | "America/Argentina/Ushuaia" + | "America/Aruba" + | "America/Asuncion" + | "America/Atikokan" + | "America/Atka" + | "America/Bahia" + | "America/Bahia_Banderas" + | "America/Barbados" + | "America/Belem" + | "America/Belize" + | "America/Blanc-Sablon" + | "America/Boa_Vista" + | "America/Bogota" + | "America/Boise" + | "America/Buenos_Aires" + | "America/Cambridge_Bay" + | "America/Campo_Grande" + | "America/Cancun" + | "America/Caracas" + | "America/Catamarca" + | "America/Cayenne" + | "America/Cayman" + | "America/Chicago" + | "America/Chihuahua" + | "America/Ciudad_Juarez" + | "America/Coral_Harbour" + | "America/Cordoba" + | "America/Costa_Rica" + | "America/Coyhaique" + | "America/Creston" + | "America/Cuiaba" + | "America/Curacao" + | "America/Danmarkshavn" + | "America/Dawson" + | "America/Dawson_Creek" + | "America/Denver" + | "America/Detroit" + | "America/Dominica" + | "America/Edmonton" + | "America/Eirunepe" + | "America/El_Salvador" + | "America/Ensenada" + | "America/Fort_Nelson" + | "America/Fort_Wayne" + | "America/Fortaleza" + | "America/Glace_Bay" + | "America/Godthab" + | "America/Goose_Bay" + | "America/Grand_Turk" + | "America/Grenada" + | "America/Guadeloupe" + | "America/Guatemala" + | "America/Guayaquil" + | "America/Guyana" + | "America/Halifax" + | "America/Havana" + | "America/Hermosillo" + | "America/Indiana/Indianapolis" + | "America/Indiana/Knox" + | "America/Indiana/Marengo" + | "America/Indiana/Petersburg" + | "America/Indiana/Tell_City" + | "America/Indiana/Vevay" + | "America/Indiana/Vincennes" + | "America/Indiana/Winamac" + | "America/Indianapolis" + | "America/Inuvik" + | "America/Iqaluit" + | "America/Jamaica" + | "America/Jujuy" + | "America/Juneau" + | "America/Kentucky/Louisville" + | "America/Kentucky/Monticello" + | "America/Knox_IN" + | "America/Kralendijk" + | "America/La_Paz" + | "America/Lima" + | "America/Los_Angeles" + | "America/Louisville" + | "America/Lower_Princes" + | "America/Maceio" + | "America/Managua" + | "America/Manaus" + | "America/Marigot" + | "America/Martinique" + | "America/Matamoros" + | "America/Mazatlan" + | "America/Mendoza" + | "America/Menominee" + | "America/Merida" + | "America/Metlakatla" + | "America/Mexico_City" + | "America/Miquelon" + | "America/Moncton" + | "America/Monterrey" + | "America/Montevideo" + | "America/Montreal" + | "America/Montserrat" + | "America/Nassau" + | "America/New_York" + | "America/Nipigon" + | "America/Nome" + | "America/Noronha" + | "America/North_Dakota/Beulah" + | "America/North_Dakota/Center" + | "America/North_Dakota/New_Salem" + | "America/Nuuk" + | "America/Ojinaga" + | "America/Panama" + | "America/Pangnirtung" + | "America/Paramaribo" + | "America/Phoenix" + | "America/Port-au-Prince" + | "America/Port_of_Spain" + | "America/Porto_Acre" + | "America/Porto_Velho" + | "America/Puerto_Rico" + | "America/Punta_Arenas" + | "America/Rainy_River" + | "America/Rankin_Inlet" + | "America/Recife" + | "America/Regina" + | "America/Resolute" + | "America/Rio_Branco" + | "America/Rosario" + | "America/Santa_Isabel" + | "America/Santarem" + | "America/Santiago" + | "America/Santo_Domingo" + | "America/Sao_Paulo" + | "America/Scoresbysund" + | "America/Shiprock" + | "America/Sitka" + | "America/St_Barthelemy" + | "America/St_Johns" + | "America/St_Kitts" + | "America/St_Lucia" + | "America/St_Thomas" + | "America/St_Vincent" + | "America/Swift_Current" + | "America/Tegucigalpa" + | "America/Thule" + | "America/Thunder_Bay" + | "America/Tijuana" + | "America/Toronto" + | "America/Tortola" + | "America/Vancouver" + | "America/Virgin" + | "America/Whitehorse" + | "America/Winnipeg" + | "America/Yakutat" + | "America/Yellowknife" + | "Antarctica/Casey" + | "Antarctica/Davis" + | "Antarctica/DumontDUrville" + | "Antarctica/Macquarie" + | "Antarctica/Mawson" + | "Antarctica/McMurdo" + | "Antarctica/Palmer" + | "Antarctica/Rothera" + | "Antarctica/South_Pole" + | "Antarctica/Syowa" + | "Antarctica/Troll" + | "Antarctica/Vostok" + | "Arctic/Longyearbyen" + | "Asia/Aden" + | "Asia/Almaty" + | "Asia/Amman" + | "Asia/Anadyr" + | "Asia/Aqtau" + | "Asia/Aqtobe" + | "Asia/Ashgabat" + | "Asia/Ashkhabad" + | "Asia/Atyrau" + | "Asia/Baghdad" + | "Asia/Bahrain" + | "Asia/Baku" + | "Asia/Bangkok" + | "Asia/Barnaul" + | "Asia/Beirut" + | "Asia/Bishkek" + | "Asia/Brunei" + | "Asia/Calcutta" + | "Asia/Chita" + | "Asia/Choibalsan" + | "Asia/Chongqing" + | "Asia/Chungking" + | "Asia/Colombo" + | "Asia/Dacca" + | "Asia/Damascus" + | "Asia/Dhaka" + | "Asia/Dili" + | "Asia/Dubai" + | "Asia/Dushanbe" + | "Asia/Famagusta" + | "Asia/Gaza" + | "Asia/Harbin" + | "Asia/Hebron" + | "Asia/Ho_Chi_Minh" + | "Asia/Hong_Kong" + | "Asia/Hovd" + | "Asia/Irkutsk" + | "Asia/Istanbul" + | "Asia/Jakarta" + | "Asia/Jayapura" + | "Asia/Jerusalem" + | "Asia/Kabul" + | "Asia/Kamchatka" + | "Asia/Karachi" + | "Asia/Kashgar" + | "Asia/Kathmandu" + | "Asia/Katmandu" + | "Asia/Khandyga" + | "Asia/Kolkata" + | "Asia/Krasnoyarsk" + | "Asia/Kuala_Lumpur" + | "Asia/Kuching" + | "Asia/Kuwait" + | "Asia/Macao" + | "Asia/Macau" + | "Asia/Magadan" + | "Asia/Makassar" + | "Asia/Manila" + | "Asia/Muscat" + | "Asia/Nicosia" + | "Asia/Novokuznetsk" + | "Asia/Novosibirsk" + | "Asia/Omsk" + | "Asia/Oral" + | "Asia/Phnom_Penh" + | "Asia/Pontianak" + | "Asia/Pyongyang" + | "Asia/Qatar" + | "Asia/Qostanay" + | "Asia/Qyzylorda" + | "Asia/Rangoon" + | "Asia/Riyadh" + | "Asia/Saigon" + | "Asia/Sakhalin" + | "Asia/Samarkand" + | "Asia/Seoul" + | "Asia/Shanghai" + | "Asia/Singapore" + | "Asia/Srednekolymsk" + | "Asia/Taipei" + | "Asia/Tashkent" + | "Asia/Tbilisi" + | "Asia/Tehran" + | "Asia/Tel_Aviv" + | "Asia/Thimbu" + | "Asia/Thimphu" + | "Asia/Tokyo" + | "Asia/Tomsk" + | "Asia/Ujung_Pandang" + | "Asia/Ulaanbaatar" + | "Asia/Ulan_Bator" + | "Asia/Urumqi" + | "Asia/Ust-Nera" + | "Asia/Vientiane" + | "Asia/Vladivostok" + | "Asia/Yakutsk" + | "Asia/Yangon" + | "Asia/Yekaterinburg" + | "Asia/Yerevan" + | "Atlantic/Azores" + | "Atlantic/Bermuda" + | "Atlantic/Canary" + | "Atlantic/Cape_Verde" + | "Atlantic/Faeroe" + | "Atlantic/Faroe" + | "Atlantic/Jan_Mayen" + | "Atlantic/Madeira" + | "Atlantic/Reykjavik" + | "Atlantic/South_Georgia" + | "Atlantic/St_Helena" + | "Atlantic/Stanley" + | "Australia/ACT" + | "Australia/Adelaide" + | "Australia/Brisbane" + | "Australia/Broken_Hill" + | "Australia/Canberra" + | "Australia/Currie" + | "Australia/Darwin" + | "Australia/Eucla" + | "Australia/Hobart" + | "Australia/LHI" + | "Australia/Lindeman" + | "Australia/Lord_Howe" + | "Australia/Melbourne" + | "Australia/NSW" + | "Australia/North" + | "Australia/Perth" + | "Australia/Queensland" + | "Australia/South" + | "Australia/Sydney" + | "Australia/Tasmania" + | "Australia/Victoria" + | "Australia/West" + | "Australia/Yancowinna" + | "Brazil/Acre" + | "Brazil/DeNoronha" + | "Brazil/East" + | "Brazil/West" + | "CET" + | "CST6CDT" + | "Canada/Atlantic" + | "Canada/Central" + | "Canada/Eastern" + | "Canada/Mountain" + | "Canada/Newfoundland" + | "Canada/Pacific" + | "Canada/Saskatchewan" + | "Canada/Yukon" + | "Chile/Continental" + | "Chile/EasterIsland" + | "Cuba" + | "EET" + | "EST" + | "EST5EDT" + | "Egypt" + | "Eire" + | "Etc/GMT" + | "Etc/GMT+0" + | "Etc/GMT+1" + | "Etc/GMT+10" + | "Etc/GMT+11" + | "Etc/GMT+12" + | "Etc/GMT+2" + | "Etc/GMT+3" + | "Etc/GMT+4" + | "Etc/GMT+5" + | "Etc/GMT+6" + | "Etc/GMT+7" + | "Etc/GMT+8" + | "Etc/GMT+9" + | "Etc/GMT-0" + | "Etc/GMT-1" + | "Etc/GMT-10" + | "Etc/GMT-11" + | "Etc/GMT-12" + | "Etc/GMT-13" + | "Etc/GMT-14" + | "Etc/GMT-2" + | "Etc/GMT-3" + | "Etc/GMT-4" + | "Etc/GMT-5" + | "Etc/GMT-6" + | "Etc/GMT-7" + | "Etc/GMT-8" + | "Etc/GMT-9" + | "Etc/GMT0" + | "Etc/Greenwich" + | "Etc/UCT" + | "Etc/UTC" + | "Etc/Universal" + | "Etc/Zulu" + | "Europe/Amsterdam" + | "Europe/Andorra" + | "Europe/Astrakhan" + | "Europe/Athens" + | "Europe/Belfast" + | "Europe/Belgrade" + | "Europe/Berlin" + | "Europe/Bratislava" + | "Europe/Brussels" + | "Europe/Bucharest" + | "Europe/Budapest" + | "Europe/Busingen" + | "Europe/Chisinau" + | "Europe/Copenhagen" + | "Europe/Dublin" + | "Europe/Gibraltar" + | "Europe/Guernsey" + | "Europe/Helsinki" + | "Europe/Isle_of_Man" + | "Europe/Istanbul" + | "Europe/Jersey" + | "Europe/Kaliningrad" + | "Europe/Kiev" + | "Europe/Kirov" + | "Europe/Kyiv" + | "Europe/Lisbon" + | "Europe/Ljubljana" + | "Europe/London" + | "Europe/Luxembourg" + | "Europe/Madrid" + | "Europe/Malta" + | "Europe/Mariehamn" + | "Europe/Minsk" + | "Europe/Monaco" + | "Europe/Moscow" + | "Europe/Nicosia" + | "Europe/Oslo" + | "Europe/Paris" + | "Europe/Podgorica" + | "Europe/Prague" + | "Europe/Riga" + | "Europe/Rome" + | "Europe/Samara" + | "Europe/San_Marino" + | "Europe/Sarajevo" + | "Europe/Saratov" + | "Europe/Simferopol" + | "Europe/Skopje" + | "Europe/Sofia" + | "Europe/Stockholm" + | "Europe/Tallinn" + | "Europe/Tirane" + | "Europe/Tiraspol" + | "Europe/Ulyanovsk" + | "Europe/Uzhgorod" + | "Europe/Vaduz" + | "Europe/Vatican" + | "Europe/Vienna" + | "Europe/Vilnius" + | "Europe/Volgograd" + | "Europe/Warsaw" + | "Europe/Zagreb" + | "Europe/Zaporozhye" + | "Europe/Zurich" + | "Factory" + | "GB" + | "GB-Eire" + | "GMT" + | "GMT+0" + | "GMT-0" + | "GMT0" + | "Greenwich" + | "HST" + | "Hongkong" + | "Iceland" + | "Indian/Antananarivo" + | "Indian/Chagos" + | "Indian/Christmas" + | "Indian/Cocos" + | "Indian/Comoro" + | "Indian/Kerguelen" + | "Indian/Mahe" + | "Indian/Maldives" + | "Indian/Mauritius" + | "Indian/Mayotte" + | "Indian/Reunion" + | "Iran" + | "Israel" + | "Jamaica" + | "Japan" + | "Kwajalein" + | "Libya" + | "MET" + | "MST" + | "MST7MDT" + | "Mexico/BajaNorte" + | "Mexico/BajaSur" + | "Mexico/General" + | "NZ" + | "NZ-CHAT" + | "Navajo" + | "PRC" + | "PST8PDT" + | "Pacific/Apia" + | "Pacific/Auckland" + | "Pacific/Bougainville" + | "Pacific/Chatham" + | "Pacific/Chuuk" + | "Pacific/Easter" + | "Pacific/Efate" + | "Pacific/Enderbury" + | "Pacific/Fakaofo" + | "Pacific/Fiji" + | "Pacific/Funafuti" + | "Pacific/Galapagos" + | "Pacific/Gambier" + | "Pacific/Guadalcanal" + | "Pacific/Guam" + | "Pacific/Honolulu" + | "Pacific/Johnston" + | "Pacific/Kanton" + | "Pacific/Kiritimati" + | "Pacific/Kosrae" + | "Pacific/Kwajalein" + | "Pacific/Majuro" + | "Pacific/Marquesas" + | "Pacific/Midway" + | "Pacific/Nauru" + | "Pacific/Niue" + | "Pacific/Norfolk" + | "Pacific/Noumea" + | "Pacific/Pago_Pago" + | "Pacific/Palau" + | "Pacific/Pitcairn" + | "Pacific/Pohnpei" + | "Pacific/Ponape" + | "Pacific/Port_Moresby" + | "Pacific/Rarotonga" + | "Pacific/Saipan" + | "Pacific/Samoa" + | "Pacific/Tahiti" + | "Pacific/Tarawa" + | "Pacific/Tongatapu" + | "Pacific/Truk" + | "Pacific/Wake" + | "Pacific/Wallis" + | "Pacific/Yap" + | "Poland" + | "Portugal" + | "ROC" + | "ROK" + | "Singapore" + | "Turkey" + | "UCT" + | "US/Alaska" + | "US/Aleutian" + | "US/Arizona" + | "US/Central" + | "US/East-Indiana" + | "US/Eastern" + | "US/Hawaii" + | "US/Indiana-Starke" + | "US/Michigan" + | "US/Mountain" + | "US/Pacific" + | "US/Samoa" + | "UTC" + | "Universal" + | "W-SU" + | "WET" + | "Zulu" + | "localtime"; + interval: "year" | "month" | "week" | "day" | "hour"; + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; + billing_type?: + | "one_time" + | "recurring" + | ReadonlyArray<"one_time" | "recurring"> + | null; + customer_id?: string | ReadonlyArray | null; + metrics?: ReadonlyArray | null; +} +export const MetricsexportInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + start_date: Schema.String, + end_date: Schema.String, + timezone: Schema.optional( + Schema.Literals([ + "Africa/Abidjan", + "Africa/Accra", + "Africa/Addis_Ababa", + "Africa/Algiers", + "Africa/Asmara", + "Africa/Asmera", + "Africa/Bamako", + "Africa/Bangui", + "Africa/Banjul", + "Africa/Bissau", + "Africa/Blantyre", + "Africa/Brazzaville", + "Africa/Bujumbura", + "Africa/Cairo", + "Africa/Casablanca", + "Africa/Ceuta", + "Africa/Conakry", + "Africa/Dakar", + "Africa/Dar_es_Salaam", + "Africa/Djibouti", + "Africa/Douala", + "Africa/El_Aaiun", + "Africa/Freetown", + "Africa/Gaborone", + "Africa/Harare", + "Africa/Johannesburg", + "Africa/Juba", + "Africa/Kampala", + "Africa/Khartoum", + "Africa/Kigali", + "Africa/Kinshasa", + "Africa/Lagos", + "Africa/Libreville", + "Africa/Lome", + "Africa/Luanda", + "Africa/Lubumbashi", + "Africa/Lusaka", + "Africa/Malabo", + "Africa/Maputo", + "Africa/Maseru", + "Africa/Mbabane", + "Africa/Mogadishu", + "Africa/Monrovia", + "Africa/Nairobi", + "Africa/Ndjamena", + "Africa/Niamey", + "Africa/Nouakchott", + "Africa/Ouagadougou", + "Africa/Porto-Novo", + "Africa/Sao_Tome", + "Africa/Timbuktu", + "Africa/Tripoli", + "Africa/Tunis", + "Africa/Windhoek", + "America/Adak", + "America/Anchorage", + "America/Anguilla", + "America/Antigua", + "America/Araguaina", + "America/Argentina/Buenos_Aires", + "America/Argentina/Catamarca", + "America/Argentina/ComodRivadavia", + "America/Argentina/Cordoba", + "America/Argentina/Jujuy", + "America/Argentina/La_Rioja", + "America/Argentina/Mendoza", + "America/Argentina/Rio_Gallegos", + "America/Argentina/Salta", + "America/Argentina/San_Juan", + "America/Argentina/San_Luis", + "America/Argentina/Tucuman", + "America/Argentina/Ushuaia", + "America/Aruba", + "America/Asuncion", + "America/Atikokan", + "America/Atka", + "America/Bahia", + "America/Bahia_Banderas", + "America/Barbados", + "America/Belem", + "America/Belize", + "America/Blanc-Sablon", + "America/Boa_Vista", + "America/Bogota", + "America/Boise", + "America/Buenos_Aires", + "America/Cambridge_Bay", + "America/Campo_Grande", + "America/Cancun", + "America/Caracas", + "America/Catamarca", + "America/Cayenne", + "America/Cayman", + "America/Chicago", + "America/Chihuahua", + "America/Ciudad_Juarez", + "America/Coral_Harbour", + "America/Cordoba", + "America/Costa_Rica", + "America/Coyhaique", + "America/Creston", + "America/Cuiaba", + "America/Curacao", + "America/Danmarkshavn", + "America/Dawson", + "America/Dawson_Creek", + "America/Denver", + "America/Detroit", + "America/Dominica", + "America/Edmonton", + "America/Eirunepe", + "America/El_Salvador", + "America/Ensenada", + "America/Fort_Nelson", + "America/Fort_Wayne", + "America/Fortaleza", + "America/Glace_Bay", + "America/Godthab", + "America/Goose_Bay", + "America/Grand_Turk", + "America/Grenada", + "America/Guadeloupe", + "America/Guatemala", + "America/Guayaquil", + "America/Guyana", + "America/Halifax", + "America/Havana", + "America/Hermosillo", + "America/Indiana/Indianapolis", + "America/Indiana/Knox", + "America/Indiana/Marengo", + "America/Indiana/Petersburg", + "America/Indiana/Tell_City", + "America/Indiana/Vevay", + "America/Indiana/Vincennes", + "America/Indiana/Winamac", + "America/Indianapolis", + "America/Inuvik", + "America/Iqaluit", + "America/Jamaica", + "America/Jujuy", + "America/Juneau", + "America/Kentucky/Louisville", + "America/Kentucky/Monticello", + "America/Knox_IN", + "America/Kralendijk", + "America/La_Paz", + "America/Lima", + "America/Los_Angeles", + "America/Louisville", + "America/Lower_Princes", + "America/Maceio", + "America/Managua", + "America/Manaus", + "America/Marigot", + "America/Martinique", + "America/Matamoros", + "America/Mazatlan", + "America/Mendoza", + "America/Menominee", + "America/Merida", + "America/Metlakatla", + "America/Mexico_City", + "America/Miquelon", + "America/Moncton", + "America/Monterrey", + "America/Montevideo", + "America/Montreal", + "America/Montserrat", + "America/Nassau", + "America/New_York", + "America/Nipigon", + "America/Nome", + "America/Noronha", + "America/North_Dakota/Beulah", + "America/North_Dakota/Center", + "America/North_Dakota/New_Salem", + "America/Nuuk", + "America/Ojinaga", + "America/Panama", + "America/Pangnirtung", + "America/Paramaribo", + "America/Phoenix", + "America/Port-au-Prince", + "America/Port_of_Spain", + "America/Porto_Acre", + "America/Porto_Velho", + "America/Puerto_Rico", + "America/Punta_Arenas", + "America/Rainy_River", + "America/Rankin_Inlet", + "America/Recife", + "America/Regina", + "America/Resolute", + "America/Rio_Branco", + "America/Rosario", + "America/Santa_Isabel", + "America/Santarem", + "America/Santiago", + "America/Santo_Domingo", + "America/Sao_Paulo", + "America/Scoresbysund", + "America/Shiprock", + "America/Sitka", + "America/St_Barthelemy", + "America/St_Johns", + "America/St_Kitts", + "America/St_Lucia", + "America/St_Thomas", + "America/St_Vincent", + "America/Swift_Current", + "America/Tegucigalpa", + "America/Thule", + "America/Thunder_Bay", + "America/Tijuana", + "America/Toronto", + "America/Tortola", + "America/Vancouver", + "America/Virgin", + "America/Whitehorse", + "America/Winnipeg", + "America/Yakutat", + "America/Yellowknife", + "Antarctica/Casey", + "Antarctica/Davis", + "Antarctica/DumontDUrville", + "Antarctica/Macquarie", + "Antarctica/Mawson", + "Antarctica/McMurdo", + "Antarctica/Palmer", + "Antarctica/Rothera", + "Antarctica/South_Pole", + "Antarctica/Syowa", + "Antarctica/Troll", + "Antarctica/Vostok", + "Arctic/Longyearbyen", + "Asia/Aden", + "Asia/Almaty", + "Asia/Amman", + "Asia/Anadyr", + "Asia/Aqtau", + "Asia/Aqtobe", + "Asia/Ashgabat", + "Asia/Ashkhabad", + "Asia/Atyrau", + "Asia/Baghdad", + "Asia/Bahrain", + "Asia/Baku", + "Asia/Bangkok", + "Asia/Barnaul", + "Asia/Beirut", + "Asia/Bishkek", + "Asia/Brunei", + "Asia/Calcutta", + "Asia/Chita", + "Asia/Choibalsan", + "Asia/Chongqing", + "Asia/Chungking", + "Asia/Colombo", + "Asia/Dacca", + "Asia/Damascus", + "Asia/Dhaka", + "Asia/Dili", + "Asia/Dubai", + "Asia/Dushanbe", + "Asia/Famagusta", + "Asia/Gaza", + "Asia/Harbin", + "Asia/Hebron", + "Asia/Ho_Chi_Minh", + "Asia/Hong_Kong", + "Asia/Hovd", + "Asia/Irkutsk", + "Asia/Istanbul", + "Asia/Jakarta", + "Asia/Jayapura", + "Asia/Jerusalem", + "Asia/Kabul", + "Asia/Kamchatka", + "Asia/Karachi", + "Asia/Kashgar", + "Asia/Kathmandu", + "Asia/Katmandu", + "Asia/Khandyga", + "Asia/Kolkata", + "Asia/Krasnoyarsk", + "Asia/Kuala_Lumpur", + "Asia/Kuching", + "Asia/Kuwait", + "Asia/Macao", + "Asia/Macau", + "Asia/Magadan", + "Asia/Makassar", + "Asia/Manila", + "Asia/Muscat", + "Asia/Nicosia", + "Asia/Novokuznetsk", + "Asia/Novosibirsk", + "Asia/Omsk", + "Asia/Oral", + "Asia/Phnom_Penh", + "Asia/Pontianak", + "Asia/Pyongyang", + "Asia/Qatar", + "Asia/Qostanay", + "Asia/Qyzylorda", + "Asia/Rangoon", + "Asia/Riyadh", + "Asia/Saigon", + "Asia/Sakhalin", + "Asia/Samarkand", + "Asia/Seoul", + "Asia/Shanghai", + "Asia/Singapore", + "Asia/Srednekolymsk", + "Asia/Taipei", + "Asia/Tashkent", + "Asia/Tbilisi", + "Asia/Tehran", + "Asia/Tel_Aviv", + "Asia/Thimbu", + "Asia/Thimphu", + "Asia/Tokyo", + "Asia/Tomsk", + "Asia/Ujung_Pandang", + "Asia/Ulaanbaatar", + "Asia/Ulan_Bator", + "Asia/Urumqi", + "Asia/Ust-Nera", + "Asia/Vientiane", + "Asia/Vladivostok", + "Asia/Yakutsk", + "Asia/Yangon", + "Asia/Yekaterinburg", + "Asia/Yerevan", + "Atlantic/Azores", + "Atlantic/Bermuda", + "Atlantic/Canary", + "Atlantic/Cape_Verde", + "Atlantic/Faeroe", + "Atlantic/Faroe", + "Atlantic/Jan_Mayen", + "Atlantic/Madeira", + "Atlantic/Reykjavik", + "Atlantic/South_Georgia", + "Atlantic/St_Helena", + "Atlantic/Stanley", + "Australia/ACT", + "Australia/Adelaide", + "Australia/Brisbane", + "Australia/Broken_Hill", + "Australia/Canberra", + "Australia/Currie", + "Australia/Darwin", + "Australia/Eucla", + "Australia/Hobart", + "Australia/LHI", + "Australia/Lindeman", + "Australia/Lord_Howe", + "Australia/Melbourne", + "Australia/NSW", + "Australia/North", + "Australia/Perth", + "Australia/Queensland", + "Australia/South", + "Australia/Sydney", + "Australia/Tasmania", + "Australia/Victoria", + "Australia/West", + "Australia/Yancowinna", + "Brazil/Acre", + "Brazil/DeNoronha", + "Brazil/East", + "Brazil/West", + "CET", + "CST6CDT", + "Canada/Atlantic", + "Canada/Central", + "Canada/Eastern", + "Canada/Mountain", + "Canada/Newfoundland", + "Canada/Pacific", + "Canada/Saskatchewan", + "Canada/Yukon", + "Chile/Continental", + "Chile/EasterIsland", + "Cuba", + "EET", + "EST", + "EST5EDT", + "Egypt", + "Eire", + "Etc/GMT", + "Etc/GMT+0", + "Etc/GMT+1", + "Etc/GMT+10", + "Etc/GMT+11", + "Etc/GMT+12", + "Etc/GMT+2", + "Etc/GMT+3", + "Etc/GMT+4", + "Etc/GMT+5", + "Etc/GMT+6", + "Etc/GMT+7", + "Etc/GMT+8", + "Etc/GMT+9", + "Etc/GMT-0", + "Etc/GMT-1", + "Etc/GMT-10", + "Etc/GMT-11", + "Etc/GMT-12", + "Etc/GMT-13", + "Etc/GMT-14", + "Etc/GMT-2", + "Etc/GMT-3", + "Etc/GMT-4", + "Etc/GMT-5", + "Etc/GMT-6", + "Etc/GMT-7", + "Etc/GMT-8", + "Etc/GMT-9", + "Etc/GMT0", + "Etc/Greenwich", + "Etc/UCT", + "Etc/UTC", + "Etc/Universal", + "Etc/Zulu", + "Europe/Amsterdam", + "Europe/Andorra", + "Europe/Astrakhan", + "Europe/Athens", + "Europe/Belfast", + "Europe/Belgrade", + "Europe/Berlin", + "Europe/Bratislava", + "Europe/Brussels", + "Europe/Bucharest", + "Europe/Budapest", + "Europe/Busingen", + "Europe/Chisinau", + "Europe/Copenhagen", + "Europe/Dublin", + "Europe/Gibraltar", + "Europe/Guernsey", + "Europe/Helsinki", + "Europe/Isle_of_Man", + "Europe/Istanbul", + "Europe/Jersey", + "Europe/Kaliningrad", + "Europe/Kiev", + "Europe/Kirov", + "Europe/Kyiv", + "Europe/Lisbon", + "Europe/Ljubljana", + "Europe/London", + "Europe/Luxembourg", + "Europe/Madrid", + "Europe/Malta", + "Europe/Mariehamn", + "Europe/Minsk", + "Europe/Monaco", + "Europe/Moscow", + "Europe/Nicosia", + "Europe/Oslo", + "Europe/Paris", + "Europe/Podgorica", + "Europe/Prague", + "Europe/Riga", + "Europe/Rome", + "Europe/Samara", + "Europe/San_Marino", + "Europe/Sarajevo", + "Europe/Saratov", + "Europe/Simferopol", + "Europe/Skopje", + "Europe/Sofia", + "Europe/Stockholm", + "Europe/Tallinn", + "Europe/Tirane", + "Europe/Tiraspol", + "Europe/Ulyanovsk", + "Europe/Uzhgorod", + "Europe/Vaduz", + "Europe/Vatican", + "Europe/Vienna", + "Europe/Vilnius", + "Europe/Volgograd", + "Europe/Warsaw", + "Europe/Zagreb", + "Europe/Zaporozhye", + "Europe/Zurich", + "Factory", + "GB", + "GB-Eire", + "GMT", + "GMT+0", + "GMT-0", + "GMT0", + "Greenwich", + "HST", + "Hongkong", + "Iceland", + "Indian/Antananarivo", + "Indian/Chagos", + "Indian/Christmas", + "Indian/Cocos", + "Indian/Comoro", + "Indian/Kerguelen", + "Indian/Mahe", + "Indian/Maldives", + "Indian/Mauritius", + "Indian/Mayotte", + "Indian/Reunion", + "Iran", + "Israel", + "Jamaica", + "Japan", + "Kwajalein", + "Libya", + "MET", + "MST", + "MST7MDT", + "Mexico/BajaNorte", + "Mexico/BajaSur", + "Mexico/General", + "NZ", + "NZ-CHAT", + "Navajo", + "PRC", + "PST8PDT", + "Pacific/Apia", + "Pacific/Auckland", + "Pacific/Bougainville", + "Pacific/Chatham", + "Pacific/Chuuk", + "Pacific/Easter", + "Pacific/Efate", + "Pacific/Enderbury", + "Pacific/Fakaofo", + "Pacific/Fiji", + "Pacific/Funafuti", + "Pacific/Galapagos", + "Pacific/Gambier", + "Pacific/Guadalcanal", + "Pacific/Guam", + "Pacific/Honolulu", + "Pacific/Johnston", + "Pacific/Kanton", + "Pacific/Kiritimati", + "Pacific/Kosrae", + "Pacific/Kwajalein", + "Pacific/Majuro", + "Pacific/Marquesas", + "Pacific/Midway", + "Pacific/Nauru", + "Pacific/Niue", + "Pacific/Norfolk", + "Pacific/Noumea", + "Pacific/Pago_Pago", + "Pacific/Palau", + "Pacific/Pitcairn", + "Pacific/Pohnpei", + "Pacific/Ponape", + "Pacific/Port_Moresby", + "Pacific/Rarotonga", + "Pacific/Saipan", + "Pacific/Samoa", + "Pacific/Tahiti", + "Pacific/Tarawa", + "Pacific/Tongatapu", + "Pacific/Truk", + "Pacific/Wake", + "Pacific/Wallis", + "Pacific/Yap", + "Poland", + "Portugal", + "ROC", + "ROK", + "Singapore", + "Turkey", + "UCT", + "US/Alaska", + "US/Aleutian", + "US/Arizona", + "US/Central", + "US/East-Indiana", + "US/Eastern", + "US/Hawaii", + "US/Indiana-Starke", + "US/Michigan", + "US/Mountain", + "US/Pacific", + "US/Samoa", + "UTC", + "Universal", + "W-SU", + "WET", + "Zulu", + "localtime", + ]), + ), + interval: Schema.Literals(["year", "month", "week", "day", "hour"]), + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + billing_type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["one_time", "recurring"]), + Schema.Array(Schema.Literals(["one_time", "recurring"])), + ]), + ), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + metrics: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), +}).pipe( + T.Http({ method: "GET", path: "/v1/metrics/export" }), +) as unknown as Schema.Codec; + +// Output Schema +export type MetricsexportOutput = void; +export const MetricsexportOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Export Metrics + * + * Export metrics as a CSV file. + * **Scopes**: `metrics:read` + * + * @param start_date - Start date. + * @param end_date - End date. + * @param timezone - Timezone to use for the timestamps. Default is UTC. + * @param interval - Interval between two timestamps. + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + * @param billing_type - Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. + * @param customer_id - Filter by customer ID. + * @param metrics - List of metric slugs to include in the export. If not provided, all metrics are exported. + */ +export const metricsexport = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetricsexportInput, + outputSchema: MetricsexportOutput, +})); diff --git a/packages/polar/src/operations/metricsget.ts b/packages/polar/src/operations/metricsget.ts new file mode 100644 index 0000000000..1f55b22fee --- /dev/null +++ b/packages/polar/src/operations/metricsget.ts @@ -0,0 +1,2619 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricsgetInput { + start_date: string; + end_date: string; + timezone?: + | "Africa/Abidjan" + | "Africa/Accra" + | "Africa/Addis_Ababa" + | "Africa/Algiers" + | "Africa/Asmara" + | "Africa/Asmera" + | "Africa/Bamako" + | "Africa/Bangui" + | "Africa/Banjul" + | "Africa/Bissau" + | "Africa/Blantyre" + | "Africa/Brazzaville" + | "Africa/Bujumbura" + | "Africa/Cairo" + | "Africa/Casablanca" + | "Africa/Ceuta" + | "Africa/Conakry" + | "Africa/Dakar" + | "Africa/Dar_es_Salaam" + | "Africa/Djibouti" + | "Africa/Douala" + | "Africa/El_Aaiun" + | "Africa/Freetown" + | "Africa/Gaborone" + | "Africa/Harare" + | "Africa/Johannesburg" + | "Africa/Juba" + | "Africa/Kampala" + | "Africa/Khartoum" + | "Africa/Kigali" + | "Africa/Kinshasa" + | "Africa/Lagos" + | "Africa/Libreville" + | "Africa/Lome" + | "Africa/Luanda" + | "Africa/Lubumbashi" + | "Africa/Lusaka" + | "Africa/Malabo" + | "Africa/Maputo" + | "Africa/Maseru" + | "Africa/Mbabane" + | "Africa/Mogadishu" + | "Africa/Monrovia" + | "Africa/Nairobi" + | "Africa/Ndjamena" + | "Africa/Niamey" + | "Africa/Nouakchott" + | "Africa/Ouagadougou" + | "Africa/Porto-Novo" + | "Africa/Sao_Tome" + | "Africa/Timbuktu" + | "Africa/Tripoli" + | "Africa/Tunis" + | "Africa/Windhoek" + | "America/Adak" + | "America/Anchorage" + | "America/Anguilla" + | "America/Antigua" + | "America/Araguaina" + | "America/Argentina/Buenos_Aires" + | "America/Argentina/Catamarca" + | "America/Argentina/ComodRivadavia" + | "America/Argentina/Cordoba" + | "America/Argentina/Jujuy" + | "America/Argentina/La_Rioja" + | "America/Argentina/Mendoza" + | "America/Argentina/Rio_Gallegos" + | "America/Argentina/Salta" + | "America/Argentina/San_Juan" + | "America/Argentina/San_Luis" + | "America/Argentina/Tucuman" + | "America/Argentina/Ushuaia" + | "America/Aruba" + | "America/Asuncion" + | "America/Atikokan" + | "America/Atka" + | "America/Bahia" + | "America/Bahia_Banderas" + | "America/Barbados" + | "America/Belem" + | "America/Belize" + | "America/Blanc-Sablon" + | "America/Boa_Vista" + | "America/Bogota" + | "America/Boise" + | "America/Buenos_Aires" + | "America/Cambridge_Bay" + | "America/Campo_Grande" + | "America/Cancun" + | "America/Caracas" + | "America/Catamarca" + | "America/Cayenne" + | "America/Cayman" + | "America/Chicago" + | "America/Chihuahua" + | "America/Ciudad_Juarez" + | "America/Coral_Harbour" + | "America/Cordoba" + | "America/Costa_Rica" + | "America/Coyhaique" + | "America/Creston" + | "America/Cuiaba" + | "America/Curacao" + | "America/Danmarkshavn" + | "America/Dawson" + | "America/Dawson_Creek" + | "America/Denver" + | "America/Detroit" + | "America/Dominica" + | "America/Edmonton" + | "America/Eirunepe" + | "America/El_Salvador" + | "America/Ensenada" + | "America/Fort_Nelson" + | "America/Fort_Wayne" + | "America/Fortaleza" + | "America/Glace_Bay" + | "America/Godthab" + | "America/Goose_Bay" + | "America/Grand_Turk" + | "America/Grenada" + | "America/Guadeloupe" + | "America/Guatemala" + | "America/Guayaquil" + | "America/Guyana" + | "America/Halifax" + | "America/Havana" + | "America/Hermosillo" + | "America/Indiana/Indianapolis" + | "America/Indiana/Knox" + | "America/Indiana/Marengo" + | "America/Indiana/Petersburg" + | "America/Indiana/Tell_City" + | "America/Indiana/Vevay" + | "America/Indiana/Vincennes" + | "America/Indiana/Winamac" + | "America/Indianapolis" + | "America/Inuvik" + | "America/Iqaluit" + | "America/Jamaica" + | "America/Jujuy" + | "America/Juneau" + | "America/Kentucky/Louisville" + | "America/Kentucky/Monticello" + | "America/Knox_IN" + | "America/Kralendijk" + | "America/La_Paz" + | "America/Lima" + | "America/Los_Angeles" + | "America/Louisville" + | "America/Lower_Princes" + | "America/Maceio" + | "America/Managua" + | "America/Manaus" + | "America/Marigot" + | "America/Martinique" + | "America/Matamoros" + | "America/Mazatlan" + | "America/Mendoza" + | "America/Menominee" + | "America/Merida" + | "America/Metlakatla" + | "America/Mexico_City" + | "America/Miquelon" + | "America/Moncton" + | "America/Monterrey" + | "America/Montevideo" + | "America/Montreal" + | "America/Montserrat" + | "America/Nassau" + | "America/New_York" + | "America/Nipigon" + | "America/Nome" + | "America/Noronha" + | "America/North_Dakota/Beulah" + | "America/North_Dakota/Center" + | "America/North_Dakota/New_Salem" + | "America/Nuuk" + | "America/Ojinaga" + | "America/Panama" + | "America/Pangnirtung" + | "America/Paramaribo" + | "America/Phoenix" + | "America/Port-au-Prince" + | "America/Port_of_Spain" + | "America/Porto_Acre" + | "America/Porto_Velho" + | "America/Puerto_Rico" + | "America/Punta_Arenas" + | "America/Rainy_River" + | "America/Rankin_Inlet" + | "America/Recife" + | "America/Regina" + | "America/Resolute" + | "America/Rio_Branco" + | "America/Rosario" + | "America/Santa_Isabel" + | "America/Santarem" + | "America/Santiago" + | "America/Santo_Domingo" + | "America/Sao_Paulo" + | "America/Scoresbysund" + | "America/Shiprock" + | "America/Sitka" + | "America/St_Barthelemy" + | "America/St_Johns" + | "America/St_Kitts" + | "America/St_Lucia" + | "America/St_Thomas" + | "America/St_Vincent" + | "America/Swift_Current" + | "America/Tegucigalpa" + | "America/Thule" + | "America/Thunder_Bay" + | "America/Tijuana" + | "America/Toronto" + | "America/Tortola" + | "America/Vancouver" + | "America/Virgin" + | "America/Whitehorse" + | "America/Winnipeg" + | "America/Yakutat" + | "America/Yellowknife" + | "Antarctica/Casey" + | "Antarctica/Davis" + | "Antarctica/DumontDUrville" + | "Antarctica/Macquarie" + | "Antarctica/Mawson" + | "Antarctica/McMurdo" + | "Antarctica/Palmer" + | "Antarctica/Rothera" + | "Antarctica/South_Pole" + | "Antarctica/Syowa" + | "Antarctica/Troll" + | "Antarctica/Vostok" + | "Arctic/Longyearbyen" + | "Asia/Aden" + | "Asia/Almaty" + | "Asia/Amman" + | "Asia/Anadyr" + | "Asia/Aqtau" + | "Asia/Aqtobe" + | "Asia/Ashgabat" + | "Asia/Ashkhabad" + | "Asia/Atyrau" + | "Asia/Baghdad" + | "Asia/Bahrain" + | "Asia/Baku" + | "Asia/Bangkok" + | "Asia/Barnaul" + | "Asia/Beirut" + | "Asia/Bishkek" + | "Asia/Brunei" + | "Asia/Calcutta" + | "Asia/Chita" + | "Asia/Choibalsan" + | "Asia/Chongqing" + | "Asia/Chungking" + | "Asia/Colombo" + | "Asia/Dacca" + | "Asia/Damascus" + | "Asia/Dhaka" + | "Asia/Dili" + | "Asia/Dubai" + | "Asia/Dushanbe" + | "Asia/Famagusta" + | "Asia/Gaza" + | "Asia/Harbin" + | "Asia/Hebron" + | "Asia/Ho_Chi_Minh" + | "Asia/Hong_Kong" + | "Asia/Hovd" + | "Asia/Irkutsk" + | "Asia/Istanbul" + | "Asia/Jakarta" + | "Asia/Jayapura" + | "Asia/Jerusalem" + | "Asia/Kabul" + | "Asia/Kamchatka" + | "Asia/Karachi" + | "Asia/Kashgar" + | "Asia/Kathmandu" + | "Asia/Katmandu" + | "Asia/Khandyga" + | "Asia/Kolkata" + | "Asia/Krasnoyarsk" + | "Asia/Kuala_Lumpur" + | "Asia/Kuching" + | "Asia/Kuwait" + | "Asia/Macao" + | "Asia/Macau" + | "Asia/Magadan" + | "Asia/Makassar" + | "Asia/Manila" + | "Asia/Muscat" + | "Asia/Nicosia" + | "Asia/Novokuznetsk" + | "Asia/Novosibirsk" + | "Asia/Omsk" + | "Asia/Oral" + | "Asia/Phnom_Penh" + | "Asia/Pontianak" + | "Asia/Pyongyang" + | "Asia/Qatar" + | "Asia/Qostanay" + | "Asia/Qyzylorda" + | "Asia/Rangoon" + | "Asia/Riyadh" + | "Asia/Saigon" + | "Asia/Sakhalin" + | "Asia/Samarkand" + | "Asia/Seoul" + | "Asia/Shanghai" + | "Asia/Singapore" + | "Asia/Srednekolymsk" + | "Asia/Taipei" + | "Asia/Tashkent" + | "Asia/Tbilisi" + | "Asia/Tehran" + | "Asia/Tel_Aviv" + | "Asia/Thimbu" + | "Asia/Thimphu" + | "Asia/Tokyo" + | "Asia/Tomsk" + | "Asia/Ujung_Pandang" + | "Asia/Ulaanbaatar" + | "Asia/Ulan_Bator" + | "Asia/Urumqi" + | "Asia/Ust-Nera" + | "Asia/Vientiane" + | "Asia/Vladivostok" + | "Asia/Yakutsk" + | "Asia/Yangon" + | "Asia/Yekaterinburg" + | "Asia/Yerevan" + | "Atlantic/Azores" + | "Atlantic/Bermuda" + | "Atlantic/Canary" + | "Atlantic/Cape_Verde" + | "Atlantic/Faeroe" + | "Atlantic/Faroe" + | "Atlantic/Jan_Mayen" + | "Atlantic/Madeira" + | "Atlantic/Reykjavik" + | "Atlantic/South_Georgia" + | "Atlantic/St_Helena" + | "Atlantic/Stanley" + | "Australia/ACT" + | "Australia/Adelaide" + | "Australia/Brisbane" + | "Australia/Broken_Hill" + | "Australia/Canberra" + | "Australia/Currie" + | "Australia/Darwin" + | "Australia/Eucla" + | "Australia/Hobart" + | "Australia/LHI" + | "Australia/Lindeman" + | "Australia/Lord_Howe" + | "Australia/Melbourne" + | "Australia/NSW" + | "Australia/North" + | "Australia/Perth" + | "Australia/Queensland" + | "Australia/South" + | "Australia/Sydney" + | "Australia/Tasmania" + | "Australia/Victoria" + | "Australia/West" + | "Australia/Yancowinna" + | "Brazil/Acre" + | "Brazil/DeNoronha" + | "Brazil/East" + | "Brazil/West" + | "CET" + | "CST6CDT" + | "Canada/Atlantic" + | "Canada/Central" + | "Canada/Eastern" + | "Canada/Mountain" + | "Canada/Newfoundland" + | "Canada/Pacific" + | "Canada/Saskatchewan" + | "Canada/Yukon" + | "Chile/Continental" + | "Chile/EasterIsland" + | "Cuba" + | "EET" + | "EST" + | "EST5EDT" + | "Egypt" + | "Eire" + | "Etc/GMT" + | "Etc/GMT+0" + | "Etc/GMT+1" + | "Etc/GMT+10" + | "Etc/GMT+11" + | "Etc/GMT+12" + | "Etc/GMT+2" + | "Etc/GMT+3" + | "Etc/GMT+4" + | "Etc/GMT+5" + | "Etc/GMT+6" + | "Etc/GMT+7" + | "Etc/GMT+8" + | "Etc/GMT+9" + | "Etc/GMT-0" + | "Etc/GMT-1" + | "Etc/GMT-10" + | "Etc/GMT-11" + | "Etc/GMT-12" + | "Etc/GMT-13" + | "Etc/GMT-14" + | "Etc/GMT-2" + | "Etc/GMT-3" + | "Etc/GMT-4" + | "Etc/GMT-5" + | "Etc/GMT-6" + | "Etc/GMT-7" + | "Etc/GMT-8" + | "Etc/GMT-9" + | "Etc/GMT0" + | "Etc/Greenwich" + | "Etc/UCT" + | "Etc/UTC" + | "Etc/Universal" + | "Etc/Zulu" + | "Europe/Amsterdam" + | "Europe/Andorra" + | "Europe/Astrakhan" + | "Europe/Athens" + | "Europe/Belfast" + | "Europe/Belgrade" + | "Europe/Berlin" + | "Europe/Bratislava" + | "Europe/Brussels" + | "Europe/Bucharest" + | "Europe/Budapest" + | "Europe/Busingen" + | "Europe/Chisinau" + | "Europe/Copenhagen" + | "Europe/Dublin" + | "Europe/Gibraltar" + | "Europe/Guernsey" + | "Europe/Helsinki" + | "Europe/Isle_of_Man" + | "Europe/Istanbul" + | "Europe/Jersey" + | "Europe/Kaliningrad" + | "Europe/Kiev" + | "Europe/Kirov" + | "Europe/Kyiv" + | "Europe/Lisbon" + | "Europe/Ljubljana" + | "Europe/London" + | "Europe/Luxembourg" + | "Europe/Madrid" + | "Europe/Malta" + | "Europe/Mariehamn" + | "Europe/Minsk" + | "Europe/Monaco" + | "Europe/Moscow" + | "Europe/Nicosia" + | "Europe/Oslo" + | "Europe/Paris" + | "Europe/Podgorica" + | "Europe/Prague" + | "Europe/Riga" + | "Europe/Rome" + | "Europe/Samara" + | "Europe/San_Marino" + | "Europe/Sarajevo" + | "Europe/Saratov" + | "Europe/Simferopol" + | "Europe/Skopje" + | "Europe/Sofia" + | "Europe/Stockholm" + | "Europe/Tallinn" + | "Europe/Tirane" + | "Europe/Tiraspol" + | "Europe/Ulyanovsk" + | "Europe/Uzhgorod" + | "Europe/Vaduz" + | "Europe/Vatican" + | "Europe/Vienna" + | "Europe/Vilnius" + | "Europe/Volgograd" + | "Europe/Warsaw" + | "Europe/Zagreb" + | "Europe/Zaporozhye" + | "Europe/Zurich" + | "Factory" + | "GB" + | "GB-Eire" + | "GMT" + | "GMT+0" + | "GMT-0" + | "GMT0" + | "Greenwich" + | "HST" + | "Hongkong" + | "Iceland" + | "Indian/Antananarivo" + | "Indian/Chagos" + | "Indian/Christmas" + | "Indian/Cocos" + | "Indian/Comoro" + | "Indian/Kerguelen" + | "Indian/Mahe" + | "Indian/Maldives" + | "Indian/Mauritius" + | "Indian/Mayotte" + | "Indian/Reunion" + | "Iran" + | "Israel" + | "Jamaica" + | "Japan" + | "Kwajalein" + | "Libya" + | "MET" + | "MST" + | "MST7MDT" + | "Mexico/BajaNorte" + | "Mexico/BajaSur" + | "Mexico/General" + | "NZ" + | "NZ-CHAT" + | "Navajo" + | "PRC" + | "PST8PDT" + | "Pacific/Apia" + | "Pacific/Auckland" + | "Pacific/Bougainville" + | "Pacific/Chatham" + | "Pacific/Chuuk" + | "Pacific/Easter" + | "Pacific/Efate" + | "Pacific/Enderbury" + | "Pacific/Fakaofo" + | "Pacific/Fiji" + | "Pacific/Funafuti" + | "Pacific/Galapagos" + | "Pacific/Gambier" + | "Pacific/Guadalcanal" + | "Pacific/Guam" + | "Pacific/Honolulu" + | "Pacific/Johnston" + | "Pacific/Kanton" + | "Pacific/Kiritimati" + | "Pacific/Kosrae" + | "Pacific/Kwajalein" + | "Pacific/Majuro" + | "Pacific/Marquesas" + | "Pacific/Midway" + | "Pacific/Nauru" + | "Pacific/Niue" + | "Pacific/Norfolk" + | "Pacific/Noumea" + | "Pacific/Pago_Pago" + | "Pacific/Palau" + | "Pacific/Pitcairn" + | "Pacific/Pohnpei" + | "Pacific/Ponape" + | "Pacific/Port_Moresby" + | "Pacific/Rarotonga" + | "Pacific/Saipan" + | "Pacific/Samoa" + | "Pacific/Tahiti" + | "Pacific/Tarawa" + | "Pacific/Tongatapu" + | "Pacific/Truk" + | "Pacific/Wake" + | "Pacific/Wallis" + | "Pacific/Yap" + | "Poland" + | "Portugal" + | "ROC" + | "ROK" + | "Singapore" + | "Turkey" + | "UCT" + | "US/Alaska" + | "US/Aleutian" + | "US/Arizona" + | "US/Central" + | "US/East-Indiana" + | "US/Eastern" + | "US/Hawaii" + | "US/Indiana-Starke" + | "US/Michigan" + | "US/Mountain" + | "US/Pacific" + | "US/Samoa" + | "UTC" + | "Universal" + | "W-SU" + | "WET" + | "Zulu" + | "localtime"; + interval: "year" | "month" | "week" | "day" | "hour"; + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; + billing_type?: + | "one_time" + | "recurring" + | ReadonlyArray<"one_time" | "recurring"> + | null; + customer_id?: string | ReadonlyArray | null; + metrics?: ReadonlyArray | null; +} +export const MetricsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + start_date: Schema.String, + end_date: Schema.String, + timezone: Schema.optional( + Schema.Literals([ + "Africa/Abidjan", + "Africa/Accra", + "Africa/Addis_Ababa", + "Africa/Algiers", + "Africa/Asmara", + "Africa/Asmera", + "Africa/Bamako", + "Africa/Bangui", + "Africa/Banjul", + "Africa/Bissau", + "Africa/Blantyre", + "Africa/Brazzaville", + "Africa/Bujumbura", + "Africa/Cairo", + "Africa/Casablanca", + "Africa/Ceuta", + "Africa/Conakry", + "Africa/Dakar", + "Africa/Dar_es_Salaam", + "Africa/Djibouti", + "Africa/Douala", + "Africa/El_Aaiun", + "Africa/Freetown", + "Africa/Gaborone", + "Africa/Harare", + "Africa/Johannesburg", + "Africa/Juba", + "Africa/Kampala", + "Africa/Khartoum", + "Africa/Kigali", + "Africa/Kinshasa", + "Africa/Lagos", + "Africa/Libreville", + "Africa/Lome", + "Africa/Luanda", + "Africa/Lubumbashi", + "Africa/Lusaka", + "Africa/Malabo", + "Africa/Maputo", + "Africa/Maseru", + "Africa/Mbabane", + "Africa/Mogadishu", + "Africa/Monrovia", + "Africa/Nairobi", + "Africa/Ndjamena", + "Africa/Niamey", + "Africa/Nouakchott", + "Africa/Ouagadougou", + "Africa/Porto-Novo", + "Africa/Sao_Tome", + "Africa/Timbuktu", + "Africa/Tripoli", + "Africa/Tunis", + "Africa/Windhoek", + "America/Adak", + "America/Anchorage", + "America/Anguilla", + "America/Antigua", + "America/Araguaina", + "America/Argentina/Buenos_Aires", + "America/Argentina/Catamarca", + "America/Argentina/ComodRivadavia", + "America/Argentina/Cordoba", + "America/Argentina/Jujuy", + "America/Argentina/La_Rioja", + "America/Argentina/Mendoza", + "America/Argentina/Rio_Gallegos", + "America/Argentina/Salta", + "America/Argentina/San_Juan", + "America/Argentina/San_Luis", + "America/Argentina/Tucuman", + "America/Argentina/Ushuaia", + "America/Aruba", + "America/Asuncion", + "America/Atikokan", + "America/Atka", + "America/Bahia", + "America/Bahia_Banderas", + "America/Barbados", + "America/Belem", + "America/Belize", + "America/Blanc-Sablon", + "America/Boa_Vista", + "America/Bogota", + "America/Boise", + "America/Buenos_Aires", + "America/Cambridge_Bay", + "America/Campo_Grande", + "America/Cancun", + "America/Caracas", + "America/Catamarca", + "America/Cayenne", + "America/Cayman", + "America/Chicago", + "America/Chihuahua", + "America/Ciudad_Juarez", + "America/Coral_Harbour", + "America/Cordoba", + "America/Costa_Rica", + "America/Coyhaique", + "America/Creston", + "America/Cuiaba", + "America/Curacao", + "America/Danmarkshavn", + "America/Dawson", + "America/Dawson_Creek", + "America/Denver", + "America/Detroit", + "America/Dominica", + "America/Edmonton", + "America/Eirunepe", + "America/El_Salvador", + "America/Ensenada", + "America/Fort_Nelson", + "America/Fort_Wayne", + "America/Fortaleza", + "America/Glace_Bay", + "America/Godthab", + "America/Goose_Bay", + "America/Grand_Turk", + "America/Grenada", + "America/Guadeloupe", + "America/Guatemala", + "America/Guayaquil", + "America/Guyana", + "America/Halifax", + "America/Havana", + "America/Hermosillo", + "America/Indiana/Indianapolis", + "America/Indiana/Knox", + "America/Indiana/Marengo", + "America/Indiana/Petersburg", + "America/Indiana/Tell_City", + "America/Indiana/Vevay", + "America/Indiana/Vincennes", + "America/Indiana/Winamac", + "America/Indianapolis", + "America/Inuvik", + "America/Iqaluit", + "America/Jamaica", + "America/Jujuy", + "America/Juneau", + "America/Kentucky/Louisville", + "America/Kentucky/Monticello", + "America/Knox_IN", + "America/Kralendijk", + "America/La_Paz", + "America/Lima", + "America/Los_Angeles", + "America/Louisville", + "America/Lower_Princes", + "America/Maceio", + "America/Managua", + "America/Manaus", + "America/Marigot", + "America/Martinique", + "America/Matamoros", + "America/Mazatlan", + "America/Mendoza", + "America/Menominee", + "America/Merida", + "America/Metlakatla", + "America/Mexico_City", + "America/Miquelon", + "America/Moncton", + "America/Monterrey", + "America/Montevideo", + "America/Montreal", + "America/Montserrat", + "America/Nassau", + "America/New_York", + "America/Nipigon", + "America/Nome", + "America/Noronha", + "America/North_Dakota/Beulah", + "America/North_Dakota/Center", + "America/North_Dakota/New_Salem", + "America/Nuuk", + "America/Ojinaga", + "America/Panama", + "America/Pangnirtung", + "America/Paramaribo", + "America/Phoenix", + "America/Port-au-Prince", + "America/Port_of_Spain", + "America/Porto_Acre", + "America/Porto_Velho", + "America/Puerto_Rico", + "America/Punta_Arenas", + "America/Rainy_River", + "America/Rankin_Inlet", + "America/Recife", + "America/Regina", + "America/Resolute", + "America/Rio_Branco", + "America/Rosario", + "America/Santa_Isabel", + "America/Santarem", + "America/Santiago", + "America/Santo_Domingo", + "America/Sao_Paulo", + "America/Scoresbysund", + "America/Shiprock", + "America/Sitka", + "America/St_Barthelemy", + "America/St_Johns", + "America/St_Kitts", + "America/St_Lucia", + "America/St_Thomas", + "America/St_Vincent", + "America/Swift_Current", + "America/Tegucigalpa", + "America/Thule", + "America/Thunder_Bay", + "America/Tijuana", + "America/Toronto", + "America/Tortola", + "America/Vancouver", + "America/Virgin", + "America/Whitehorse", + "America/Winnipeg", + "America/Yakutat", + "America/Yellowknife", + "Antarctica/Casey", + "Antarctica/Davis", + "Antarctica/DumontDUrville", + "Antarctica/Macquarie", + "Antarctica/Mawson", + "Antarctica/McMurdo", + "Antarctica/Palmer", + "Antarctica/Rothera", + "Antarctica/South_Pole", + "Antarctica/Syowa", + "Antarctica/Troll", + "Antarctica/Vostok", + "Arctic/Longyearbyen", + "Asia/Aden", + "Asia/Almaty", + "Asia/Amman", + "Asia/Anadyr", + "Asia/Aqtau", + "Asia/Aqtobe", + "Asia/Ashgabat", + "Asia/Ashkhabad", + "Asia/Atyrau", + "Asia/Baghdad", + "Asia/Bahrain", + "Asia/Baku", + "Asia/Bangkok", + "Asia/Barnaul", + "Asia/Beirut", + "Asia/Bishkek", + "Asia/Brunei", + "Asia/Calcutta", + "Asia/Chita", + "Asia/Choibalsan", + "Asia/Chongqing", + "Asia/Chungking", + "Asia/Colombo", + "Asia/Dacca", + "Asia/Damascus", + "Asia/Dhaka", + "Asia/Dili", + "Asia/Dubai", + "Asia/Dushanbe", + "Asia/Famagusta", + "Asia/Gaza", + "Asia/Harbin", + "Asia/Hebron", + "Asia/Ho_Chi_Minh", + "Asia/Hong_Kong", + "Asia/Hovd", + "Asia/Irkutsk", + "Asia/Istanbul", + "Asia/Jakarta", + "Asia/Jayapura", + "Asia/Jerusalem", + "Asia/Kabul", + "Asia/Kamchatka", + "Asia/Karachi", + "Asia/Kashgar", + "Asia/Kathmandu", + "Asia/Katmandu", + "Asia/Khandyga", + "Asia/Kolkata", + "Asia/Krasnoyarsk", + "Asia/Kuala_Lumpur", + "Asia/Kuching", + "Asia/Kuwait", + "Asia/Macao", + "Asia/Macau", + "Asia/Magadan", + "Asia/Makassar", + "Asia/Manila", + "Asia/Muscat", + "Asia/Nicosia", + "Asia/Novokuznetsk", + "Asia/Novosibirsk", + "Asia/Omsk", + "Asia/Oral", + "Asia/Phnom_Penh", + "Asia/Pontianak", + "Asia/Pyongyang", + "Asia/Qatar", + "Asia/Qostanay", + "Asia/Qyzylorda", + "Asia/Rangoon", + "Asia/Riyadh", + "Asia/Saigon", + "Asia/Sakhalin", + "Asia/Samarkand", + "Asia/Seoul", + "Asia/Shanghai", + "Asia/Singapore", + "Asia/Srednekolymsk", + "Asia/Taipei", + "Asia/Tashkent", + "Asia/Tbilisi", + "Asia/Tehran", + "Asia/Tel_Aviv", + "Asia/Thimbu", + "Asia/Thimphu", + "Asia/Tokyo", + "Asia/Tomsk", + "Asia/Ujung_Pandang", + "Asia/Ulaanbaatar", + "Asia/Ulan_Bator", + "Asia/Urumqi", + "Asia/Ust-Nera", + "Asia/Vientiane", + "Asia/Vladivostok", + "Asia/Yakutsk", + "Asia/Yangon", + "Asia/Yekaterinburg", + "Asia/Yerevan", + "Atlantic/Azores", + "Atlantic/Bermuda", + "Atlantic/Canary", + "Atlantic/Cape_Verde", + "Atlantic/Faeroe", + "Atlantic/Faroe", + "Atlantic/Jan_Mayen", + "Atlantic/Madeira", + "Atlantic/Reykjavik", + "Atlantic/South_Georgia", + "Atlantic/St_Helena", + "Atlantic/Stanley", + "Australia/ACT", + "Australia/Adelaide", + "Australia/Brisbane", + "Australia/Broken_Hill", + "Australia/Canberra", + "Australia/Currie", + "Australia/Darwin", + "Australia/Eucla", + "Australia/Hobart", + "Australia/LHI", + "Australia/Lindeman", + "Australia/Lord_Howe", + "Australia/Melbourne", + "Australia/NSW", + "Australia/North", + "Australia/Perth", + "Australia/Queensland", + "Australia/South", + "Australia/Sydney", + "Australia/Tasmania", + "Australia/Victoria", + "Australia/West", + "Australia/Yancowinna", + "Brazil/Acre", + "Brazil/DeNoronha", + "Brazil/East", + "Brazil/West", + "CET", + "CST6CDT", + "Canada/Atlantic", + "Canada/Central", + "Canada/Eastern", + "Canada/Mountain", + "Canada/Newfoundland", + "Canada/Pacific", + "Canada/Saskatchewan", + "Canada/Yukon", + "Chile/Continental", + "Chile/EasterIsland", + "Cuba", + "EET", + "EST", + "EST5EDT", + "Egypt", + "Eire", + "Etc/GMT", + "Etc/GMT+0", + "Etc/GMT+1", + "Etc/GMT+10", + "Etc/GMT+11", + "Etc/GMT+12", + "Etc/GMT+2", + "Etc/GMT+3", + "Etc/GMT+4", + "Etc/GMT+5", + "Etc/GMT+6", + "Etc/GMT+7", + "Etc/GMT+8", + "Etc/GMT+9", + "Etc/GMT-0", + "Etc/GMT-1", + "Etc/GMT-10", + "Etc/GMT-11", + "Etc/GMT-12", + "Etc/GMT-13", + "Etc/GMT-14", + "Etc/GMT-2", + "Etc/GMT-3", + "Etc/GMT-4", + "Etc/GMT-5", + "Etc/GMT-6", + "Etc/GMT-7", + "Etc/GMT-8", + "Etc/GMT-9", + "Etc/GMT0", + "Etc/Greenwich", + "Etc/UCT", + "Etc/UTC", + "Etc/Universal", + "Etc/Zulu", + "Europe/Amsterdam", + "Europe/Andorra", + "Europe/Astrakhan", + "Europe/Athens", + "Europe/Belfast", + "Europe/Belgrade", + "Europe/Berlin", + "Europe/Bratislava", + "Europe/Brussels", + "Europe/Bucharest", + "Europe/Budapest", + "Europe/Busingen", + "Europe/Chisinau", + "Europe/Copenhagen", + "Europe/Dublin", + "Europe/Gibraltar", + "Europe/Guernsey", + "Europe/Helsinki", + "Europe/Isle_of_Man", + "Europe/Istanbul", + "Europe/Jersey", + "Europe/Kaliningrad", + "Europe/Kiev", + "Europe/Kirov", + "Europe/Kyiv", + "Europe/Lisbon", + "Europe/Ljubljana", + "Europe/London", + "Europe/Luxembourg", + "Europe/Madrid", + "Europe/Malta", + "Europe/Mariehamn", + "Europe/Minsk", + "Europe/Monaco", + "Europe/Moscow", + "Europe/Nicosia", + "Europe/Oslo", + "Europe/Paris", + "Europe/Podgorica", + "Europe/Prague", + "Europe/Riga", + "Europe/Rome", + "Europe/Samara", + "Europe/San_Marino", + "Europe/Sarajevo", + "Europe/Saratov", + "Europe/Simferopol", + "Europe/Skopje", + "Europe/Sofia", + "Europe/Stockholm", + "Europe/Tallinn", + "Europe/Tirane", + "Europe/Tiraspol", + "Europe/Ulyanovsk", + "Europe/Uzhgorod", + "Europe/Vaduz", + "Europe/Vatican", + "Europe/Vienna", + "Europe/Vilnius", + "Europe/Volgograd", + "Europe/Warsaw", + "Europe/Zagreb", + "Europe/Zaporozhye", + "Europe/Zurich", + "Factory", + "GB", + "GB-Eire", + "GMT", + "GMT+0", + "GMT-0", + "GMT0", + "Greenwich", + "HST", + "Hongkong", + "Iceland", + "Indian/Antananarivo", + "Indian/Chagos", + "Indian/Christmas", + "Indian/Cocos", + "Indian/Comoro", + "Indian/Kerguelen", + "Indian/Mahe", + "Indian/Maldives", + "Indian/Mauritius", + "Indian/Mayotte", + "Indian/Reunion", + "Iran", + "Israel", + "Jamaica", + "Japan", + "Kwajalein", + "Libya", + "MET", + "MST", + "MST7MDT", + "Mexico/BajaNorte", + "Mexico/BajaSur", + "Mexico/General", + "NZ", + "NZ-CHAT", + "Navajo", + "PRC", + "PST8PDT", + "Pacific/Apia", + "Pacific/Auckland", + "Pacific/Bougainville", + "Pacific/Chatham", + "Pacific/Chuuk", + "Pacific/Easter", + "Pacific/Efate", + "Pacific/Enderbury", + "Pacific/Fakaofo", + "Pacific/Fiji", + "Pacific/Funafuti", + "Pacific/Galapagos", + "Pacific/Gambier", + "Pacific/Guadalcanal", + "Pacific/Guam", + "Pacific/Honolulu", + "Pacific/Johnston", + "Pacific/Kanton", + "Pacific/Kiritimati", + "Pacific/Kosrae", + "Pacific/Kwajalein", + "Pacific/Majuro", + "Pacific/Marquesas", + "Pacific/Midway", + "Pacific/Nauru", + "Pacific/Niue", + "Pacific/Norfolk", + "Pacific/Noumea", + "Pacific/Pago_Pago", + "Pacific/Palau", + "Pacific/Pitcairn", + "Pacific/Pohnpei", + "Pacific/Ponape", + "Pacific/Port_Moresby", + "Pacific/Rarotonga", + "Pacific/Saipan", + "Pacific/Samoa", + "Pacific/Tahiti", + "Pacific/Tarawa", + "Pacific/Tongatapu", + "Pacific/Truk", + "Pacific/Wake", + "Pacific/Wallis", + "Pacific/Yap", + "Poland", + "Portugal", + "ROC", + "ROK", + "Singapore", + "Turkey", + "UCT", + "US/Alaska", + "US/Aleutian", + "US/Arizona", + "US/Central", + "US/East-Indiana", + "US/Eastern", + "US/Hawaii", + "US/Indiana-Starke", + "US/Michigan", + "US/Mountain", + "US/Pacific", + "US/Samoa", + "UTC", + "Universal", + "W-SU", + "WET", + "Zulu", + "localtime", + ]), + ), + interval: Schema.Literals(["year", "month", "week", "day", "hour"]), + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + billing_type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["one_time", "recurring"]), + Schema.Array(Schema.Literals(["one_time", "recurring"])), + ]), + ), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + metrics: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), +}).pipe( + T.Http({ method: "GET", path: "/v1/metrics/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MetricsgetOutput { + periods: ReadonlyArray<{ + timestamp: string; + active_subscriptions?: number | null; + committed_subscriptions?: number | null; + monthly_recurring_revenue?: number | null; + trial_monthly_recurring_revenue?: number | null; + committed_monthly_recurring_revenue?: number | null; + trial_committed_monthly_recurring_revenue?: number | null; + average_revenue_per_user?: number | null; + checkouts?: number | null; + succeeded_checkouts?: number | null; + churned_subscriptions?: number | null; + churn_rate?: number | null; + seats_total?: number | null; + seats_claimed?: number | null; + seats_pending?: number | null; + seat_customers?: number | null; + new_seat_customers?: number | null; + churned_seat_customers?: number | null; + orders?: number | null; + revenue?: number | null; + net_revenue?: number | null; + cumulative_revenue?: number | null; + net_cumulative_revenue?: number | null; + costs?: number | null; + cumulative_costs?: number | null; + average_order_value?: number | null; + net_average_order_value?: number | null; + cost_per_user?: number | null; + active_user_by_event?: number | null; + one_time_products?: number | null; + one_time_products_revenue?: number | null; + one_time_products_net_revenue?: number | null; + new_subscriptions?: number | null; + new_subscriptions_revenue?: number | null; + new_subscriptions_net_revenue?: number | null; + renewed_subscriptions?: number | null; + renewed_subscriptions_revenue?: number | null; + renewed_subscriptions_net_revenue?: number | null; + canceled_subscriptions?: number | null; + canceled_subscriptions_customer_service?: number | null; + canceled_subscriptions_low_quality?: number | null; + canceled_subscriptions_missing_features?: number | null; + canceled_subscriptions_switched_service?: number | null; + canceled_subscriptions_too_complex?: number | null; + canceled_subscriptions_too_expensive?: number | null; + canceled_subscriptions_unused?: number | null; + canceled_subscriptions_other?: number | null; + annual_recurring_revenue?: number | null; + committed_annual_recurring_revenue?: number | null; + checkouts_conversion?: number | null; + ltv?: number | null; + gross_margin?: number | null; + gross_margin_percentage?: number | null; + cashflow?: number | null; + average_seats_per_customer?: number | null; + seat_utilization_rate?: number | null; + }>; + totals: { + active_subscriptions?: number | null; + committed_subscriptions?: number | null; + monthly_recurring_revenue?: number | null; + trial_monthly_recurring_revenue?: number | null; + committed_monthly_recurring_revenue?: number | null; + trial_committed_monthly_recurring_revenue?: number | null; + average_revenue_per_user?: number | null; + checkouts?: number | null; + succeeded_checkouts?: number | null; + churned_subscriptions?: number | null; + churn_rate?: number | null; + seats_total?: number | null; + seats_claimed?: number | null; + seats_pending?: number | null; + seat_customers?: number | null; + new_seat_customers?: number | null; + churned_seat_customers?: number | null; + orders?: number | null; + revenue?: number | null; + net_revenue?: number | null; + cumulative_revenue?: number | null; + net_cumulative_revenue?: number | null; + costs?: number | null; + cumulative_costs?: number | null; + average_order_value?: number | null; + net_average_order_value?: number | null; + cost_per_user?: number | null; + active_user_by_event?: number | null; + one_time_products?: number | null; + one_time_products_revenue?: number | null; + one_time_products_net_revenue?: number | null; + new_subscriptions?: number | null; + new_subscriptions_revenue?: number | null; + new_subscriptions_net_revenue?: number | null; + renewed_subscriptions?: number | null; + renewed_subscriptions_revenue?: number | null; + renewed_subscriptions_net_revenue?: number | null; + canceled_subscriptions?: number | null; + canceled_subscriptions_customer_service?: number | null; + canceled_subscriptions_low_quality?: number | null; + canceled_subscriptions_missing_features?: number | null; + canceled_subscriptions_switched_service?: number | null; + canceled_subscriptions_too_complex?: number | null; + canceled_subscriptions_too_expensive?: number | null; + canceled_subscriptions_unused?: number | null; + canceled_subscriptions_other?: number | null; + annual_recurring_revenue?: number | null; + committed_annual_recurring_revenue?: number | null; + checkouts_conversion?: number | null; + ltv?: number | null; + gross_margin?: number | null; + gross_margin_percentage?: number | null; + cashflow?: number | null; + average_seats_per_customer?: number | null; + seat_utilization_rate?: number | null; + }; + metrics: { + active_subscriptions?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + committed_subscriptions?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + monthly_recurring_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + trial_monthly_recurring_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + committed_monthly_recurring_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + trial_committed_monthly_recurring_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + average_revenue_per_user?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + checkouts?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + succeeded_checkouts?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + churned_subscriptions?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + churn_rate?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + seats_total?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + seats_claimed?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + seats_pending?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + seat_customers?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + new_seat_customers?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + churned_seat_customers?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + orders?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + net_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + cumulative_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + net_cumulative_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + costs?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + cumulative_costs?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + average_order_value?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + net_average_order_value?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + cost_per_user?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + active_user_by_event?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + one_time_products?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + one_time_products_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + one_time_products_net_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + new_subscriptions?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + new_subscriptions_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + new_subscriptions_net_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + renewed_subscriptions?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + renewed_subscriptions_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + renewed_subscriptions_net_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_customer_service?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_low_quality?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_missing_features?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_switched_service?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_too_complex?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_too_expensive?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_unused?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + canceled_subscriptions_other?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + annual_recurring_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + committed_annual_recurring_revenue?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + checkouts_conversion?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + ltv?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + gross_margin?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + gross_margin_percentage?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + cashflow?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + average_seats_per_customer?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + seat_utilization_rate?: { + slug: string; + display_name: string; + type: "scalar" | "currency" | "currency_sub_cent" | "percentage"; + } | null; + }; +} +export const MetricsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + periods: Schema.Array( + Schema.Struct({ + timestamp: Schema.String, + active_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + committed_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + monthly_recurring_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + trial_monthly_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + committed_monthly_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + trial_committed_monthly_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + average_revenue_per_user: Schema.optional(Schema.NullOr(Schema.Number)), + checkouts: Schema.optional(Schema.NullOr(Schema.Number)), + succeeded_checkouts: Schema.optional(Schema.NullOr(Schema.Number)), + churned_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + churn_rate: Schema.optional(Schema.NullOr(Schema.Number)), + seats_total: Schema.optional(Schema.NullOr(Schema.Number)), + seats_claimed: Schema.optional(Schema.NullOr(Schema.Number)), + seats_pending: Schema.optional(Schema.NullOr(Schema.Number)), + seat_customers: Schema.optional(Schema.NullOr(Schema.Number)), + new_seat_customers: Schema.optional(Schema.NullOr(Schema.Number)), + churned_seat_customers: Schema.optional(Schema.NullOr(Schema.Number)), + orders: Schema.optional(Schema.NullOr(Schema.Number)), + revenue: Schema.optional(Schema.NullOr(Schema.Number)), + net_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + cumulative_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + net_cumulative_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + costs: Schema.optional(Schema.NullOr(Schema.Number)), + cumulative_costs: Schema.optional(Schema.NullOr(Schema.Number)), + average_order_value: Schema.optional(Schema.NullOr(Schema.Number)), + net_average_order_value: Schema.optional(Schema.NullOr(Schema.Number)), + cost_per_user: Schema.optional(Schema.NullOr(Schema.Number)), + active_user_by_event: Schema.optional(Schema.NullOr(Schema.Number)), + one_time_products: Schema.optional(Schema.NullOr(Schema.Number)), + one_time_products_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + one_time_products_net_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + new_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + new_subscriptions_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + new_subscriptions_net_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + renewed_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + renewed_subscriptions_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + renewed_subscriptions_net_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + canceled_subscriptions_customer_service: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_low_quality: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_missing_features: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_switched_service: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_too_complex: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_too_expensive: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_unused: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_other: Schema.optional( + Schema.NullOr(Schema.Number), + ), + annual_recurring_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + committed_annual_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + checkouts_conversion: Schema.optional(Schema.NullOr(Schema.Number)), + ltv: Schema.optional(Schema.NullOr(Schema.Number)), + gross_margin: Schema.optional(Schema.NullOr(Schema.Number)), + gross_margin_percentage: Schema.optional(Schema.NullOr(Schema.Number)), + cashflow: Schema.optional(Schema.NullOr(Schema.Number)), + average_seats_per_customer: Schema.optional(Schema.NullOr(Schema.Number)), + seat_utilization_rate: Schema.optional(Schema.NullOr(Schema.Number)), + }), + ), + totals: Schema.Struct({ + active_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + committed_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + monthly_recurring_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + trial_monthly_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + committed_monthly_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + trial_committed_monthly_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + average_revenue_per_user: Schema.optional(Schema.NullOr(Schema.Number)), + checkouts: Schema.optional(Schema.NullOr(Schema.Number)), + succeeded_checkouts: Schema.optional(Schema.NullOr(Schema.Number)), + churned_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + churn_rate: Schema.optional(Schema.NullOr(Schema.Number)), + seats_total: Schema.optional(Schema.NullOr(Schema.Number)), + seats_claimed: Schema.optional(Schema.NullOr(Schema.Number)), + seats_pending: Schema.optional(Schema.NullOr(Schema.Number)), + seat_customers: Schema.optional(Schema.NullOr(Schema.Number)), + new_seat_customers: Schema.optional(Schema.NullOr(Schema.Number)), + churned_seat_customers: Schema.optional(Schema.NullOr(Schema.Number)), + orders: Schema.optional(Schema.NullOr(Schema.Number)), + revenue: Schema.optional(Schema.NullOr(Schema.Number)), + net_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + cumulative_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + net_cumulative_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + costs: Schema.optional(Schema.NullOr(Schema.Number)), + cumulative_costs: Schema.optional(Schema.NullOr(Schema.Number)), + average_order_value: Schema.optional(Schema.NullOr(Schema.Number)), + net_average_order_value: Schema.optional(Schema.NullOr(Schema.Number)), + cost_per_user: Schema.optional(Schema.NullOr(Schema.Number)), + active_user_by_event: Schema.optional(Schema.NullOr(Schema.Number)), + one_time_products: Schema.optional(Schema.NullOr(Schema.Number)), + one_time_products_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + one_time_products_net_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + new_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + new_subscriptions_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + new_subscriptions_net_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + renewed_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + renewed_subscriptions_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + renewed_subscriptions_net_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions: Schema.optional(Schema.NullOr(Schema.Number)), + canceled_subscriptions_customer_service: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_low_quality: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_missing_features: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_switched_service: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_too_complex: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_too_expensive: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_unused: Schema.optional( + Schema.NullOr(Schema.Number), + ), + canceled_subscriptions_other: Schema.optional(Schema.NullOr(Schema.Number)), + annual_recurring_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + committed_annual_recurring_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + checkouts_conversion: Schema.optional(Schema.NullOr(Schema.Number)), + ltv: Schema.optional(Schema.NullOr(Schema.Number)), + gross_margin: Schema.optional(Schema.NullOr(Schema.Number)), + gross_margin_percentage: Schema.optional(Schema.NullOr(Schema.Number)), + cashflow: Schema.optional(Schema.NullOr(Schema.Number)), + average_seats_per_customer: Schema.optional(Schema.NullOr(Schema.Number)), + seat_utilization_rate: Schema.optional(Schema.NullOr(Schema.Number)), + }), + metrics: Schema.Struct({ + active_subscriptions: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + committed_subscriptions: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + monthly_recurring_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + trial_monthly_recurring_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + committed_monthly_recurring_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + trial_committed_monthly_recurring_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + average_revenue_per_user: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + checkouts: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + succeeded_checkouts: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + churned_subscriptions: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + churn_rate: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + seats_total: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + seats_claimed: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + seats_pending: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + seat_customers: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + new_seat_customers: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + churned_seat_customers: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + orders: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + net_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + cumulative_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + net_cumulative_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + costs: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + cumulative_costs: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + average_order_value: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + net_average_order_value: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + cost_per_user: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + active_user_by_event: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + one_time_products: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + one_time_products_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + one_time_products_net_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + new_subscriptions: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + new_subscriptions_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + new_subscriptions_net_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + renewed_subscriptions: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + renewed_subscriptions_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + renewed_subscriptions_net_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_customer_service: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_low_quality: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_missing_features: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_switched_service: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_too_complex: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_too_expensive: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_unused: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + canceled_subscriptions_other: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + annual_recurring_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + committed_annual_recurring_revenue: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + checkouts_conversion: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + ltv: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + gross_margin: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + gross_margin_percentage: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + cashflow: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + average_seats_per_customer: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + seat_utilization_rate: Schema.optional( + Schema.NullOr( + Schema.Struct({ + slug: Schema.String, + display_name: Schema.String, + type: Schema.Literals([ + "scalar", + "currency", + "currency_sub_cent", + "percentage", + ]), + }), + ), + ), + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Metrics + * + * Get metrics about your orders and subscriptions. + * Currency values are output in cents. + * **Scopes**: `metrics:read` + * + * @param start_date - Start date. + * @param end_date - End date. + * @param timezone - Timezone to use for the timestamps. Default is UTC. + * @param interval - Interval between two timestamps. + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + * @param billing_type - Filter by billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. + * @param customer_id - Filter by customer ID. + * @param metrics - List of metric slugs to focus on. When provided, only the queries needed for these metrics will be executed, improving performance. If not provided, all metrics are returned. + */ +export const metricsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetricsgetInput, + outputSchema: MetricsgetOutput, +})); diff --git a/packages/polar/src/operations/metricsgetDashboard.ts b/packages/polar/src/operations/metricsgetDashboard.ts new file mode 100644 index 0000000000..dc0001e070 --- /dev/null +++ b/packages/polar/src/operations/metricsgetDashboard.ts @@ -0,0 +1,47 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricsgetDashboardInput { + id: string; +} +export const MetricsgetDashboardInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/metrics/dashboards/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface MetricsgetDashboardOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + metrics: ReadonlyArray; + organization_id: string; +} +export const MetricsgetDashboardOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + metrics: Schema.Array(Schema.String), + organization_id: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Metric Dashboard + * + * Get a user-defined metric dashboard by ID. + * **Scopes**: `metrics:read` + * + * @param id - The metric dashboard ID. + */ +export const metricsgetDashboard = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetricsgetDashboardInput, + outputSchema: MetricsgetDashboardOutput, +})); diff --git a/packages/polar/src/operations/metricslimits.ts b/packages/polar/src/operations/metricslimits.ts new file mode 100644 index 0000000000..8222d7e04f --- /dev/null +++ b/packages/polar/src/operations/metricslimits.ts @@ -0,0 +1,60 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricslimitsInput {} +export const MetricslimitsInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + {}, +).pipe( + T.Http({ method: "GET", path: "/v1/metrics/limits" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface MetricslimitsOutput { + min_date: string; + intervals: { + hour: { min_days: number; max_days: number }; + day: { min_days: number; max_days: number }; + week: { min_days: number; max_days: number }; + month: { min_days: number; max_days: number }; + year: { min_days: number; max_days: number }; + }; +} +export const MetricslimitsOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + min_date: Schema.String, + intervals: Schema.Struct({ + hour: Schema.Struct({ + min_days: Schema.Number, + max_days: Schema.Number, + }), + day: Schema.Struct({ + min_days: Schema.Number, + max_days: Schema.Number, + }), + week: Schema.Struct({ + min_days: Schema.Number, + max_days: Schema.Number, + }), + month: Schema.Struct({ + min_days: Schema.Number, + max_days: Schema.Number, + }), + year: Schema.Struct({ + min_days: Schema.Number, + max_days: Schema.Number, + }), + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Metrics Limits + * + * Get the interval limits for the metrics endpoint. + * **Scopes**: `metrics:read` + */ +export const metricslimits = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: MetricslimitsInput, + outputSchema: MetricslimitsOutput, +})); diff --git a/packages/polar/src/operations/metricslistDashboards.ts b/packages/polar/src/operations/metricslistDashboards.ts new file mode 100644 index 0000000000..630712dbe2 --- /dev/null +++ b/packages/polar/src/operations/metricslistDashboards.ts @@ -0,0 +1,53 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricslistDashboardsInput { + organization_id?: string | ReadonlyArray | null; +} +export const MetricslistDashboardsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/metrics/dashboards" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type MetricslistDashboardsOutput = ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + name: string; + metrics: ReadonlyArray; + organization_id: string; +}>; +export const MetricslistDashboardsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + metrics: Schema.Array(Schema.String), + organization_id: Schema.String, + }), + ) as unknown as Schema.Codec; + +// The operation +/** + * List Metric Dashboards + * + * List user-defined metric dashboards. + * **Scopes**: `metrics:read` + * + * @param organization_id - Filter by organization ID. + */ +export const metricslistDashboards = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: MetricslistDashboardsInput, + outputSchema: MetricslistDashboardsOutput, + }), +); diff --git a/packages/polar/src/operations/metricsupdateDashboard.ts b/packages/polar/src/operations/metricsupdateDashboard.ts new file mode 100644 index 0000000000..b635918cfb --- /dev/null +++ b/packages/polar/src/operations/metricsupdateDashboard.ts @@ -0,0 +1,53 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface MetricsupdateDashboardInput { + id: string; + name?: string | null; + metrics?: ReadonlyArray | null; +} +export const MetricsupdateDashboardInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + name: Schema.optional(Schema.NullOr(Schema.String)), + metrics: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/metrics/dashboards/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface MetricsupdateDashboardOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + metrics: ReadonlyArray; + organization_id: string; +} +export const MetricsupdateDashboardOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + metrics: Schema.Array(Schema.String), + organization_id: Schema.String, + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Metric Dashboard + * + * Update a user-defined metric dashboard. + * **Scopes**: `metrics:write` + * + * @param id - The metric dashboard ID. + */ +export const metricsupdateDashboard = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: MetricsupdateDashboardInput, + outputSchema: MetricsupdateDashboardOutput, + }), +); diff --git a/packages/polar/src/operations/oauth2authorize.ts b/packages/polar/src/operations/oauth2authorize.ts new file mode 100644 index 0000000000..9fb93b0c81 --- /dev/null +++ b/packages/polar/src/operations/oauth2authorize.ts @@ -0,0 +1,197 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface Oauth2authorizeInput {} +export const Oauth2authorizeInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + {}, +).pipe( + T.Http({ method: "GET", path: "/v1/oauth2/authorize" }), +) as unknown as Schema.Codec; + +// Output Schema +export type Oauth2authorizeOutput = + | { + client: { + created_at: string; + modified_at: string | null; + client_id: string; + client_name: string | null; + client_uri: string | null; + logo_uri: string | null; + tos_uri: string | null; + policy_uri: string | null; + }; + sub_type: string; + sub: { id: string; email: string; avatar_url: string | null } | null; + scopes: ReadonlyArray< + | "openid" + | "profile" + | "email" + | "user:read" + | "user:write" + | "organizations:read" + | "organizations:write" + | "custom_fields:read" + | "custom_fields:write" + | "discounts:read" + | "discounts:write" + | "checkout_links:read" + | "checkout_links:write" + | "checkouts:read" + | "checkouts:write" + | "transactions:read" + | "transactions:write" + | "payouts:read" + | "payouts:write" + | "products:read" + | "products:write" + | "benefits:read" + | "benefits:write" + | "events:read" + | "events:write" + | "meters:read" + | "meters:write" + | "files:read" + | "files:write" + | "subscriptions:read" + | "subscriptions:write" + | "customers:read" + | "customers:write" + | "members:read" + | "members:write" + | "wallets:read" + | "wallets:write" + | "disputes:read" + | "disputes:write" + | "customer_meters:read" + | "customer_sessions:write" + | "member_sessions:write" + | "customer_seats:read" + | "customer_seats:write" + | "orders:read" + | "orders:write" + | "refunds:read" + | "refunds:write" + | "payments:read" + | "metrics:read" + | "metrics:write" + | "webhooks:read" + | "webhooks:write" + | "license_keys:read" + | "license_keys:write" + | "customer_portal:read" + | "customer_portal:write" + | "notifications:read" + | "notifications:write" + | "notification_recipients:read" + | "notification_recipients:write" + | "organization_access_tokens:read" + | "organization_access_tokens:write" + >; + organizations: ReadonlyArray<{ + id: string; + slug: string; + avatar_url: string | null; + }>; + requires_single_organization?: boolean; + scope_display_names?: Record; + } + | { + client: { + created_at: string; + modified_at: string | null; + client_id: string; + client_name: string | null; + client_uri: string | null; + logo_uri: string | null; + tos_uri: string | null; + policy_uri: string | null; + }; + sub_type: string; + sub: { id: string; slug: string; avatar_url: string | null } | null; + scopes: ReadonlyArray< + | "openid" + | "profile" + | "email" + | "user:read" + | "user:write" + | "organizations:read" + | "organizations:write" + | "custom_fields:read" + | "custom_fields:write" + | "discounts:read" + | "discounts:write" + | "checkout_links:read" + | "checkout_links:write" + | "checkouts:read" + | "checkouts:write" + | "transactions:read" + | "transactions:write" + | "payouts:read" + | "payouts:write" + | "products:read" + | "products:write" + | "benefits:read" + | "benefits:write" + | "events:read" + | "events:write" + | "meters:read" + | "meters:write" + | "files:read" + | "files:write" + | "subscriptions:read" + | "subscriptions:write" + | "customers:read" + | "customers:write" + | "members:read" + | "members:write" + | "wallets:read" + | "wallets:write" + | "disputes:read" + | "disputes:write" + | "customer_meters:read" + | "customer_sessions:write" + | "member_sessions:write" + | "customer_seats:read" + | "customer_seats:write" + | "orders:read" + | "orders:write" + | "refunds:read" + | "refunds:write" + | "payments:read" + | "metrics:read" + | "metrics:write" + | "webhooks:read" + | "webhooks:write" + | "license_keys:read" + | "license_keys:write" + | "customer_portal:read" + | "customer_portal:write" + | "notifications:read" + | "notifications:write" + | "notification_recipients:read" + | "notification_recipients:write" + | "organization_access_tokens:read" + | "organization_access_tokens:write" + >; + organizations: ReadonlyArray<{ + id: string; + slug: string; + avatar_url: string | null; + }>; + requires_single_organization?: boolean; + scope_display_names?: Record; + }; +export const Oauth2authorizeOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Authorize + */ +export const oauth2authorize = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2authorizeInput, + outputSchema: Oauth2authorizeOutput, +})); diff --git a/packages/polar/src/operations/oauth2clientsoauth2createClient.ts b/packages/polar/src/operations/oauth2clientsoauth2createClient.ts new file mode 100644 index 0000000000..16fb2a5803 --- /dev/null +++ b/packages/polar/src/operations/oauth2clientsoauth2createClient.ts @@ -0,0 +1,60 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface Oauth2clientsoauth2createClientInput { + redirect_uris: ReadonlyArray; + token_endpoint_auth_method?: + | "client_secret_basic" + | "client_secret_post" + | "none"; + grant_types?: ReadonlyArray<"authorization_code" | "refresh_token">; + response_types?: ReadonlyArray; + scope?: string; + client_name: string; + client_uri?: string | null; + logo_uri?: string | null; + tos_uri?: string | null; + policy_uri?: string | null; + default_sub_type?: "user" | "organization"; +} +export const Oauth2clientsoauth2createClientInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + redirect_uris: Schema.Array(Schema.String), + token_endpoint_auth_method: Schema.optional( + Schema.Literals(["client_secret_basic", "client_secret_post", "none"]), + ), + grant_types: Schema.optional( + Schema.Array(Schema.Literals(["authorization_code", "refresh_token"])), + ), + response_types: Schema.optional(Schema.Array(Schema.String)), + scope: Schema.optional(Schema.String), + client_name: Schema.String, + client_uri: Schema.optional(Schema.NullOr(Schema.String)), + logo_uri: Schema.optional(Schema.NullOr(Schema.String)), + tos_uri: Schema.optional(Schema.NullOr(Schema.String)), + policy_uri: Schema.optional(Schema.NullOr(Schema.String)), + default_sub_type: Schema.optional( + Schema.Literals(["user", "organization"]), + ), + }).pipe( + T.Http({ method: "POST", path: "/v1/oauth2/register" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type Oauth2clientsoauth2createClientOutput = unknown; +export const Oauth2clientsoauth2createClientOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Create Client + * + * Create an OAuth2 client. + */ +export const oauth2clientsoauth2createClient = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2clientsoauth2createClientInput, + outputSchema: Oauth2clientsoauth2createClientOutput, + })); diff --git a/packages/polar/src/operations/oauth2clientsoauth2deleteClient.ts b/packages/polar/src/operations/oauth2clientsoauth2deleteClient.ts new file mode 100644 index 0000000000..9f14310575 --- /dev/null +++ b/packages/polar/src/operations/oauth2clientsoauth2deleteClient.ts @@ -0,0 +1,31 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface Oauth2clientsoauth2deleteClientInput { + client_id: string; +} +export const Oauth2clientsoauth2deleteClientInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + client_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/oauth2/register/{client_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type Oauth2clientsoauth2deleteClientOutput = unknown; +export const Oauth2clientsoauth2deleteClientOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Delete Client + * + * Delete an OAuth2 client. + */ +export const oauth2clientsoauth2deleteClient = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2clientsoauth2deleteClientInput, + outputSchema: Oauth2clientsoauth2deleteClientOutput, + })); diff --git a/packages/polar/src/operations/oauth2clientsoauth2getClient.ts b/packages/polar/src/operations/oauth2clientsoauth2getClient.ts new file mode 100644 index 0000000000..a8b6ac57bd --- /dev/null +++ b/packages/polar/src/operations/oauth2clientsoauth2getClient.ts @@ -0,0 +1,31 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface Oauth2clientsoauth2getClientInput { + client_id: string; +} +export const Oauth2clientsoauth2getClientInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + client_id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/oauth2/register/{client_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type Oauth2clientsoauth2getClientOutput = unknown; +export const Oauth2clientsoauth2getClientOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Get Client + * + * Get an OAuth2 client by Client ID. + */ +export const oauth2clientsoauth2getClient = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2clientsoauth2getClientInput, + outputSchema: Oauth2clientsoauth2getClientOutput, + })); diff --git a/packages/polar/src/operations/oauth2clientsoauth2updateClient.ts b/packages/polar/src/operations/oauth2clientsoauth2updateClient.ts new file mode 100644 index 0000000000..30e9a7c9b4 --- /dev/null +++ b/packages/polar/src/operations/oauth2clientsoauth2updateClient.ts @@ -0,0 +1,62 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface Oauth2clientsoauth2updateClientInput { + client_id: string; + redirect_uris: ReadonlyArray; + token_endpoint_auth_method?: + | "client_secret_basic" + | "client_secret_post" + | "none"; + grant_types?: ReadonlyArray<"authorization_code" | "refresh_token">; + response_types?: ReadonlyArray; + scope?: string; + client_name: string; + client_uri?: string | null; + logo_uri?: string | null; + tos_uri?: string | null; + policy_uri?: string | null; + default_sub_type?: "user" | "organization"; +} +export const Oauth2clientsoauth2updateClientInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + client_id: Schema.String.pipe(T.PathParam()), + redirect_uris: Schema.Array(Schema.String), + token_endpoint_auth_method: Schema.optional( + Schema.Literals(["client_secret_basic", "client_secret_post", "none"]), + ), + grant_types: Schema.optional( + Schema.Array(Schema.Literals(["authorization_code", "refresh_token"])), + ), + response_types: Schema.optional(Schema.Array(Schema.String)), + scope: Schema.optional(Schema.String), + client_name: Schema.String, + client_uri: Schema.optional(Schema.NullOr(Schema.String)), + logo_uri: Schema.optional(Schema.NullOr(Schema.String)), + tos_uri: Schema.optional(Schema.NullOr(Schema.String)), + policy_uri: Schema.optional(Schema.NullOr(Schema.String)), + default_sub_type: Schema.optional( + Schema.Literals(["user", "organization"]), + ), + }).pipe( + T.Http({ method: "PUT", path: "/v1/oauth2/register/{client_id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type Oauth2clientsoauth2updateClientOutput = unknown; +export const Oauth2clientsoauth2updateClientOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Unknown as unknown as Schema.Codec; + +// The operation +/** + * Update Client + * + * Update an OAuth2 client. + */ +export const oauth2clientsoauth2updateClient = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2clientsoauth2updateClientInput, + outputSchema: Oauth2clientsoauth2updateClientOutput, + })); diff --git a/packages/polar/src/operations/oauth2introspectToken.ts b/packages/polar/src/operations/oauth2introspectToken.ts new file mode 100644 index 0000000000..e21632e5d5 --- /dev/null +++ b/packages/polar/src/operations/oauth2introspectToken.ts @@ -0,0 +1,70 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface Oauth2introspectTokenInput { + token: string; + token_type_hint?: "access_token" | "refresh_token" | null; + client_id: string; + client_secret: string | Redacted.Redacted; +} +export const Oauth2introspectTokenInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + token: Schema.String, + token_type_hint: Schema.optional( + Schema.NullOr(Schema.Literals(["access_token", "refresh_token"])), + ), + client_id: Schema.String, + client_secret: SensitiveString, + }).pipe( + T.Http({ + method: "POST", + path: "/v1/oauth2/introspect", + contentType: "form-urlencoded", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface Oauth2introspectTokenOutput { + active: boolean; + client_id: string; + token_type: "access_token" | "refresh_token"; + scope: string; + sub_type: "user" | "organization"; + sub: string; + organizations: ReadonlyArray; + aud: string; + iss: string; + exp: number; + iat: number; +} +export const Oauth2introspectTokenOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + active: Schema.Boolean, + client_id: Schema.String, + token_type: Schema.Literals(["access_token", "refresh_token"]), + scope: Schema.String, + sub_type: Schema.Literals(["user", "organization"]), + sub: Schema.String, + organizations: Schema.Array(Schema.String), + aud: Schema.String, + iss: Schema.String, + exp: Schema.Number, + iat: Schema.Number, + }) as unknown as Schema.Codec; + +// The operation +/** + * Introspect Token + * + * Get information about an access token. + */ +export const oauth2introspectToken = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: Oauth2introspectTokenInput, + outputSchema: Oauth2introspectTokenOutput, + }), +); diff --git a/packages/polar/src/operations/oauth2requestToken.ts b/packages/polar/src/operations/oauth2requestToken.ts new file mode 100644 index 0000000000..db3debcfed --- /dev/null +++ b/packages/polar/src/operations/oauth2requestToken.ts @@ -0,0 +1,68 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveString, SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface Oauth2requestTokenInput { + grant_type: string; + client_id: string; + client_secret: string | Redacted.Redacted; + code?: string; + redirect_uri?: string; + refresh_token?: string | Redacted.Redacted; + session_token?: string | Redacted.Redacted; + sub_type?: "user" | "organization"; + sub?: string | null; + scope?: string | null; +} +export const Oauth2requestTokenInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + grant_type: Schema.String, + client_id: Schema.String, + client_secret: SensitiveString, + code: Schema.optional(Schema.String), + redirect_uri: Schema.optional(Schema.String), + refresh_token: Schema.optional(SensitiveString), + session_token: Schema.optional(SensitiveString), + sub_type: Schema.optional(Schema.Literals(["user", "organization"])), + sub: Schema.optional(Schema.NullOr(Schema.String)), + scope: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ + method: "POST", + path: "/v1/oauth2/token", + contentType: "form-urlencoded", + }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface Oauth2requestTokenOutput { + access_token: Redacted.Redacted; + token_type: string; + expires_in: number; + refresh_token?: string | null; + scope: string; + id_token?: string | null; +} +export const Oauth2requestTokenOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + access_token: SensitiveOutputString, + token_type: Schema.String, + expires_in: Schema.Number, + refresh_token: Schema.optional(Schema.NullOr(Schema.String)), + scope: Schema.String, + id_token: Schema.optional(Schema.NullOr(Schema.String)), + }) as unknown as Schema.Codec; + +// The operation +/** + * Request Token + * + * Request an access token using a valid grant. + */ +export const oauth2requestToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2requestTokenInput, + outputSchema: Oauth2requestTokenOutput, +})); diff --git a/packages/polar/src/operations/oauth2revokeToken.ts b/packages/polar/src/operations/oauth2revokeToken.ts new file mode 100644 index 0000000000..5f486376ed --- /dev/null +++ b/packages/polar/src/operations/oauth2revokeToken.ts @@ -0,0 +1,47 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface Oauth2revokeTokenInput { + token: string; + token_type_hint?: "access_token" | "refresh_token" | null; + client_id: string; + client_secret: string | Redacted.Redacted; +} +export const Oauth2revokeTokenInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + token: Schema.String, + token_type_hint: Schema.optional( + Schema.NullOr(Schema.Literals(["access_token", "refresh_token"])), + ), + client_id: Schema.String, + client_secret: SensitiveString, + }, +).pipe( + T.Http({ + method: "POST", + path: "/v1/oauth2/revoke", + contentType: "form-urlencoded", + }), +) as unknown as Schema.Codec; + +// Output Schema +export interface Oauth2revokeTokenOutput {} +export const Oauth2revokeTokenOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + {}, + ) as unknown as Schema.Codec; + +// The operation +/** + * Revoke Token + * + * Revoke an access token or a refresh token. + */ +export const oauth2revokeToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2revokeTokenInput, + outputSchema: Oauth2revokeTokenOutput, +})); diff --git a/packages/polar/src/operations/oauth2userinfo.ts b/packages/polar/src/operations/oauth2userinfo.ts new file mode 100644 index 0000000000..d3f11f00c5 --- /dev/null +++ b/packages/polar/src/operations/oauth2userinfo.ts @@ -0,0 +1,44 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface Oauth2userinfoInput {} +export const Oauth2userinfoInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + {}, +).pipe( + T.Http({ method: "GET", path: "/v1/oauth2/userinfo" }), +) as unknown as Schema.Codec; + +// Output Schema +export type Oauth2userinfoOutput = + | { + sub: string; + name?: string | null; + email?: string | null; + email_verified?: boolean | null; + } + | { sub: string; name?: string | null }; +export const Oauth2userinfoOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + sub: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.optional(Schema.NullOr(Schema.Boolean)), + }), + Schema.Struct({ + sub: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + }), +]) as unknown as Schema.Codec; + +// The operation +/** + * Get User Info + * + * Get information about the authenticated user. + */ +export const oauth2userinfo = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: Oauth2userinfoInput, + outputSchema: Oauth2userinfoOutput, +})); diff --git a/packages/polar/src/operations/orderscreate.ts b/packages/polar/src/operations/orderscreate.ts new file mode 100644 index 0000000000..959a3587d2 --- /dev/null +++ b/packages/polar/src/operations/orderscreate.ts @@ -0,0 +1,1568 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrderscreateInput { + custom_field_data?: Record; + metadata?: Record; + organization_id?: string | null; + customer_id: string; + product_id: string; + currency?: string | null; + amount?: number | null; + description?: string | null; +} +export const OrderscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + customer_id: Schema.String, + product_id: Schema.String, + currency: Schema.optional(Schema.NullOr(Schema.String)), + amount: Schema.optional(Schema.NullOr(Schema.Number)), + description: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "POST", path: "/v1/orders/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrderscreateOutput { + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + metadata: Record; + custom_field_data?: Record; + platform_fee_amount: number; + platform_fee_currency: string | null; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + } | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + subscription: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; +} +export const OrderscreateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + platform_fee_amount: Schema.Number, + platform_fee_currency: Schema.NullOr(Schema.String), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + subscription: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, +}) as unknown as Schema.Codec; + +// The operation +/** + * Create Order + * + * Create a draft order for an off-session charge against a saved payment + * method. The order is created with `status=draft` and no invoice number; + * call `POST /v1/orders/{id}/finalize` to attempt the charge. + * The organization must have the `off_session_charges_enabled` feature flag. + * **Scopes**: `orders:write` + */ +export const orderscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrderscreateInput, + outputSchema: OrderscreateOutput, +})); diff --git a/packages/polar/src/operations/ordersexport.ts b/packages/polar/src/operations/ordersexport.ts new file mode 100644 index 0000000000..fb74a9f740 --- /dev/null +++ b/packages/polar/src/operations/ordersexport.ts @@ -0,0 +1,39 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersexportInput { + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; +} +export const OrdersexportInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/orders/export" }), +) as unknown as Schema.Codec; + +// Output Schema +export type OrdersexportOutput = void; +export const OrdersexportOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Export Orders + * + * Export orders as a CSV file. + * **Scopes**: `orders:read` + * + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + */ +export const ordersexport = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrdersexportInput, + outputSchema: OrdersexportOutput, +})); diff --git a/packages/polar/src/operations/ordersfinalize.ts b/packages/polar/src/operations/ordersfinalize.ts new file mode 100644 index 0000000000..843d938431 --- /dev/null +++ b/packages/polar/src/operations/ordersfinalize.ts @@ -0,0 +1,1547 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersfinalizeInput { + id: string; + payment_method_id?: string | null; +} +export const OrdersfinalizeInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), +}).pipe( + T.Http({ method: "POST", path: "/v1/orders/{id}/finalize" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrdersfinalizeOutput { + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + metadata: Record; + custom_field_data?: Record; + platform_fee_amount: number; + platform_fee_currency: string | null; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + } | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + subscription: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; +} +export const OrdersfinalizeOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + platform_fee_amount: Schema.Number, + platform_fee_currency: Schema.NullOr(Schema.String), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + subscription: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, +}) as unknown as Schema.Codec; + +// The operation +/** + * Finalize Order + * + * Finalize a draft order and synchronously attempt an off-session charge. + * On success, the order transitions to `paid` and benefit grants fire + * before the response returns. On failure (decline, missing payment method, + * SCA challenge), the order stays in `draft` and a 4xx error is returned. + * The request fails with 412 if the order is not in `draft` status. + * **Scopes**: `orders:write` + * + * @param id - The order ID. + */ +export const ordersfinalize = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrdersfinalizeInput, + outputSchema: OrdersfinalizeOutput, +})); diff --git a/packages/polar/src/operations/ordersgenerateInvoice.ts b/packages/polar/src/operations/ordersgenerateInvoice.ts new file mode 100644 index 0000000000..bba3a36d93 --- /dev/null +++ b/packages/polar/src/operations/ordersgenerateInvoice.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersgenerateInvoiceInput { + id: string; +} +export const OrdersgenerateInvoiceInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "POST", path: "/v1/orders/{id}/invoice" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type OrdersgenerateInvoiceOutput = void; +export const OrdersgenerateInvoiceOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Generate Order Invoice + * + * Trigger generation of an order's invoice. + * **Scopes**: `orders:read` + * + * @param id - The order ID. + */ +export const ordersgenerateInvoice = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: OrdersgenerateInvoiceInput, + outputSchema: OrdersgenerateInvoiceOutput, + }), +); diff --git a/packages/polar/src/operations/ordersget.ts b/packages/polar/src/operations/ordersget.ts new file mode 100644 index 0000000000..9bf340ad1f --- /dev/null +++ b/packages/polar/src/operations/ordersget.ts @@ -0,0 +1,1541 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersgetInput { + id: string; +} +export const OrdersgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/orders/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrdersgetOutput { + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + metadata: Record; + custom_field_data?: Record; + platform_fee_amount: number; + platform_fee_currency: string | null; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + } | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + subscription: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; +} +export const OrdersgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + platform_fee_amount: Schema.Number, + platform_fee_currency: Schema.NullOr(Schema.String), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + subscription: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Order + * + * Get an order by ID. + * **Scopes**: `orders:read` + * + * @param id - The order ID. + */ +export const ordersget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrdersgetInput, + outputSchema: OrdersgetOutput, +})); diff --git a/packages/polar/src/operations/ordersinvoice.ts b/packages/polar/src/operations/ordersinvoice.ts new file mode 100644 index 0000000000..3952cb8210 --- /dev/null +++ b/packages/polar/src/operations/ordersinvoice.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersinvoiceInput { + id: string; +} +export const OrdersinvoiceInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/orders/{id}/invoice" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrdersinvoiceOutput { + url: string; +} +export const OrdersinvoiceOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + url: Schema.String, +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Order Invoice + * + * Get an order's invoice data. + * **Scopes**: `orders:read` + * + * @param id - The order ID. + */ +export const ordersinvoice = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrdersinvoiceInput, + outputSchema: OrdersinvoiceOutput, +})); diff --git a/packages/polar/src/operations/orderslist.ts b/packages/polar/src/operations/orderslist.ts new file mode 100644 index 0000000000..f67bba5c68 --- /dev/null +++ b/packages/polar/src/operations/orderslist.ts @@ -0,0 +1,1678 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrderslistInput { + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; + product_billing_type?: + | "one_time" + | "recurring" + | ReadonlyArray<"one_time" | "recurring"> + | null; + discount_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + checkout_id?: string | ReadonlyArray | null; + subscription_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "status" + | "-status" + | "invoice_number" + | "-invoice_number" + | "amount" + | "-amount" + | "net_amount" + | "-net_amount" + | "customer" + | "-customer" + | "product" + | "-product" + | "discount" + | "-discount" + | "subscription" + | "-subscription" + > | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const OrderslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_billing_type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["one_time", "recurring"]), + Schema.Array(Schema.Literals(["one_time", "recurring"])), + ]), + ), + ), + discount_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + checkout_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + subscription_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "status", + "-status", + "invoice_number", + "-invoice_number", + "amount", + "-amount", + "net_amount", + "-net_amount", + "customer", + "-customer", + "product", + "-product", + "discount", + "-discount", + "subscription", + "-subscription", + ]), + ), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/orders/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrderslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + metadata: Record; + custom_field_data?: Record; + platform_fee_amount: number; + platform_fee_currency: string | null; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + } | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + subscription: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; + }>; + pagination: { total_count: number; max_page: number }; +} +export const OrderslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + platform_fee_amount: Schema.Number, + platform_fee_currency: Schema.NullOr(Schema.String), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + subscription: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Orders + * + * List orders. + * **Scopes**: `orders:read` + * + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + * @param product_billing_type - Filter by product billing type. `recurring` will filter data corresponding to subscriptions creations or renewals. `one_time` will filter data corresponding to one-time purchases. + * @param discount_id - Filter by discount ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by customer external ID. + * @param checkout_id - Filter by checkout ID. + * @param subscription_id - Filter by subscription ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const orderslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrderslistInput, + outputSchema: OrderslistOutput, +})); diff --git a/packages/polar/src/operations/ordersreceipt.ts b/packages/polar/src/operations/ordersreceipt.ts new file mode 100644 index 0000000000..2612bfc8e2 --- /dev/null +++ b/packages/polar/src/operations/ordersreceipt.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersreceiptInput { + id: string; +} +export const OrdersreceiptInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/orders/{id}/receipt" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrdersreceiptOutput { + url: string; +} +export const OrdersreceiptOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + url: Schema.String, +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Order Receipt + * + * Get a presigned URL to download an order's receipt PDF. + * **Scopes**: `orders:read` + * + * @param id - The order ID. + */ +export const ordersreceipt = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrdersreceiptInput, + outputSchema: OrdersreceiptOutput, +})); diff --git a/packages/polar/src/operations/ordersupdate.ts b/packages/polar/src/operations/ordersupdate.ts new file mode 100644 index 0000000000..2f923a8fcf --- /dev/null +++ b/packages/polar/src/operations/ordersupdate.ts @@ -0,0 +1,2052 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrdersupdateInput { + id: string; + billing_name?: string | null; + billing_address?: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; +} +export const OrdersupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + billing_name: Schema.optional(Schema.NullOr(Schema.String)), + billing_address: Schema.optional( + Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + ), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/orders/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrdersupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + status: + | "draft" + | "pending" + | "paid" + | "refunded" + | "partially_refunded" + | "void"; + paid: boolean; + subtotal_amount: number; + discount_amount: number; + net_amount: number; + tax_amount: number; + total_amount: number; + applied_balance_amount: number; + due_amount: number; + refunded_amount: number; + refunded_tax_amount: number; + currency: string; + billing_reason: + | "purchase" + | "subscription_create" + | "subscription_cycle" + | "subscription_update"; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + invoice_number: string | null; + is_invoice_generated: boolean; + receipt_number: string | null; + seats?: number | null; + customer_id: string; + product_id: string | null; + discount_id: string | null; + subscription_id: string | null; + checkout_id: string | null; + next_payment_attempt_at?: string | null; + metadata: Record; + custom_field_data?: Record; + platform_fee_amount: number; + platform_fee_currency: string | null; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + metadata: Record; + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + } | null; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + subscription: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + } | null; + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + label: string; + amount: number; + tax_amount: number; + proration: boolean; + product_price_id: string | null; + }>; + description: string; + refundable_amount: number; + refundable_tax_amount: number; +} +export const OrdersupdateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + status: Schema.Literals([ + "draft", + "pending", + "paid", + "refunded", + "partially_refunded", + "void", + ]), + paid: Schema.Boolean, + subtotal_amount: Schema.Number, + discount_amount: Schema.Number, + net_amount: Schema.Number, + tax_amount: Schema.Number, + total_amount: Schema.Number, + applied_balance_amount: Schema.Number, + due_amount: Schema.Number, + refunded_amount: Schema.Number, + refunded_tax_amount: Schema.Number, + currency: Schema.String, + billing_reason: Schema.Literals([ + "purchase", + "subscription_create", + "subscription_cycle", + "subscription_update", + ]), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + invoice_number: Schema.NullOr(Schema.String), + is_invoice_generated: Schema.Boolean, + receipt_number: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_id: Schema.String, + product_id: Schema.NullOr(Schema.String), + discount_id: Schema.NullOr(Schema.String), + subscription_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + next_payment_attempt_at: Schema.optional(Schema.NullOr(Schema.String)), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + platform_fee_amount: Schema.Number, + platform_fee_currency: Schema.NullOr(Schema.String), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + }), + ), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + subscription: Schema.NullOr( + Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + }), + ), + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + label: Schema.String, + amount: Schema.Number, + tax_amount: Schema.Number, + proration: Schema.Boolean, + product_price_id: Schema.NullOr(Schema.String), + }), + ), + description: Schema.String, + refundable_amount: Schema.Number, + refundable_tax_amount: Schema.Number, +}) as unknown as Schema.Codec; + +// The operation +/** + * Update Order + * + * Update an order. + * **Scopes**: `orders:write` + * + * @param id - The order ID. + */ +export const ordersupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrdersupdateInput, + outputSchema: OrdersupdateOutput, +})); diff --git a/packages/polar/src/operations/organizationscreate.ts b/packages/polar/src/operations/organizationscreate.ts new file mode 100644 index 0000000000..756e30239c --- /dev/null +++ b/packages/polar/src/operations/organizationscreate.ts @@ -0,0 +1,1719 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrganizationscreateInput { + name: string; + slug: string; + avatar_url?: string | null; + legal_entity?: + | { type: string } + | { type: string; registered_name: string } + | null; + email?: string | null; + website?: string | null; + socials?: ReadonlyArray<{ + platform: + | "x" + | "github" + | "facebook" + | "instagram" + | "youtube" + | "tiktok" + | "linkedin" + | "threads" + | "discord" + | "other"; + url: string; + }> | null; + details?: { + about?: string | null; + product_description?: string | null; + selling_categories?: ReadonlyArray; + pricing_models?: ReadonlyArray; + intended_use?: string | null; + customer_acquisition?: ReadonlyArray; + future_annual_revenue?: number | null; + switching?: boolean; + switching_from?: + | "paddle" + | "lemon_squeezy" + | "gumroad" + | "stripe" + | "other" + | null; + previous_annual_revenue?: number | null; + } | null; + country?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null; + feature_settings?: { + seat_based_pricing_enabled?: boolean; + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + overview_metrics?: ReadonlyArray | null; + } | null; + subscription_settings?: { + allow_multiple_subscriptions: boolean; + proration_behavior: "invoice" | "prorate" | "next_period"; + benefit_revocation_grace_period: number; + prevent_trial_abuse: boolean; + allow_customer_updates: boolean; + } | null; + customer_email_settings?: { + order_confirmation: boolean; + subscription_cancellation: boolean; + subscription_confirmation: boolean; + subscription_cycled: boolean; + subscription_cycled_after_trial: boolean; + subscription_past_due: boolean; + subscription_paused: boolean; + subscription_resumed: boolean; + subscription_renewal_reminder: boolean; + subscription_revoked: boolean; + subscription_trial_conversion_reminder: boolean; + subscription_uncanceled: boolean; + subscription_updated: boolean; + } | null; + customer_portal_settings?: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + } | null; + default_presentment_currency?: + | "aed" + | "all" + | "amd" + | "aoa" + | "ars" + | "aud" + | "awg" + | "azn" + | "bam" + | "bbd" + | "bdt" + | "bif" + | "bmd" + | "bnd" + | "bob" + | "brl" + | "bsd" + | "bwp" + | "bzd" + | "cad" + | "cdf" + | "chf" + | "clp" + | "cny" + | "cop" + | "crc" + | "cve" + | "czk" + | "djf" + | "dkk" + | "dop" + | "dzd" + | "egp" + | "etb" + | "eur" + | "fjd" + | "fkp" + | "gbp" + | "gel" + | "gip" + | "gmd" + | "gnf" + | "gtq" + | "gyd" + | "hkd" + | "hnl" + | "htg" + | "huf" + | "idr" + | "ils" + | "inr" + | "isk" + | "jmd" + | "jpy" + | "kes" + | "kgs" + | "khr" + | "kmf" + | "krw" + | "kyd" + | "kzt" + | "lak" + | "lkr" + | "lrd" + | "lsl" + | "mad" + | "mdl" + | "mga" + | "mkd" + | "mnt" + | "mop" + | "mur" + | "mvr" + | "mwk" + | "mxn" + | "myr" + | "mzn" + | "nad" + | "ngn" + | "nio" + | "nok" + | "npr" + | "nzd" + | "pab" + | "pen" + | "pgk" + | "php" + | "pkr" + | "pln" + | "pyg" + | "qar" + | "ron" + | "rsd" + | "rwf" + | "sar" + | "sbd" + | "scr" + | "sek" + | "sgd" + | "shp" + | "sos" + | "srd" + | "szl" + | "thb" + | "tjs" + | "top" + | "try" + | "ttd" + | "twd" + | "tzs" + | "uah" + | "ugx" + | "usd" + | "uyu" + | "uzs" + | "vnd" + | "vuv" + | "wst" + | "xaf" + | "xcd" + | "xcg" + | "xof" + | "xpf" + | "yer" + | "zar" + | "zmw"; + default_tax_behavior?: "location" | "inclusive" | "exclusive"; +} +export const OrganizationscreateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.optional(Schema.NullOr(Schema.String)), + legal_entity: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Struct({ + type: Schema.String, + }), + Schema.Struct({ + type: Schema.String, + registered_name: Schema.String, + }), + ]), + ), + ), + email: Schema.optional(Schema.NullOr(Schema.String)), + website: Schema.optional(Schema.NullOr(Schema.String)), + socials: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Struct({ + platform: Schema.Literals([ + "x", + "github", + "facebook", + "instagram", + "youtube", + "tiktok", + "linkedin", + "threads", + "discord", + "other", + ]), + url: Schema.String, + }), + ), + ), + ), + details: Schema.optional( + Schema.NullOr( + Schema.Struct({ + about: Schema.optional(Schema.NullOr(Schema.String)), + product_description: Schema.optional(Schema.NullOr(Schema.String)), + selling_categories: Schema.optional(Schema.Array(Schema.String)), + pricing_models: Schema.optional(Schema.Array(Schema.String)), + intended_use: Schema.optional(Schema.NullOr(Schema.String)), + customer_acquisition: Schema.optional(Schema.Array(Schema.String)), + future_annual_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + switching: Schema.optional(Schema.Boolean), + switching_from: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "paddle", + "lemon_squeezy", + "gumroad", + "stripe", + "other", + ]), + ), + ), + previous_annual_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + }), + ), + ), + country: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + ), + ), + feature_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + seat_based_pricing_enabled: Schema.optional(Schema.Boolean), + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + overview_metrics: Schema.optional( + Schema.NullOr(Schema.Array(Schema.String)), + ), + }), + ), + ), + subscription_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + allow_multiple_subscriptions: Schema.Boolean, + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + ]), + benefit_revocation_grace_period: Schema.Number, + prevent_trial_abuse: Schema.Boolean, + allow_customer_updates: Schema.Boolean, + }), + ), + ), + customer_email_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + order_confirmation: Schema.Boolean, + subscription_cancellation: Schema.Boolean, + subscription_confirmation: Schema.Boolean, + subscription_cycled: Schema.Boolean, + subscription_cycled_after_trial: Schema.Boolean, + subscription_past_due: Schema.Boolean, + subscription_paused: Schema.Boolean, + subscription_resumed: Schema.Boolean, + subscription_renewal_reminder: Schema.Boolean, + subscription_revoked: Schema.Boolean, + subscription_trial_conversion_reminder: Schema.Boolean, + subscription_uncanceled: Schema.Boolean, + subscription_updated: Schema.Boolean, + }), + ), + ), + customer_portal_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + ), + ), + default_presentment_currency: Schema.optional( + Schema.Literals([ + "aed", + "all", + "amd", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bif", + "bmd", + "bnd", + "bob", + "brl", + "bsd", + "bwp", + "bzd", + "cad", + "cdf", + "chf", + "clp", + "cny", + "cop", + "crc", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "egp", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "htg", + "huf", + "idr", + "ils", + "inr", + "isk", + "jmd", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "krw", + "kyd", + "kzt", + "lak", + "lkr", + "lrd", + "lsl", + "mad", + "mdl", + "mga", + "mkd", + "mnt", + "mop", + "mur", + "mvr", + "mwk", + "mxn", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rwf", + "sar", + "sbd", + "scr", + "sek", + "sgd", + "shp", + "sos", + "srd", + "szl", + "thb", + "tjs", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "uyu", + "uzs", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmw", + ]), + ), + default_tax_behavior: Schema.optional( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + }).pipe( + T.Http({ method: "POST", path: "/v1/organizations/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface OrganizationscreateOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + email: string | null; + website: string | null; + socials: ReadonlyArray<{ + platform: + | "x" + | "github" + | "facebook" + | "instagram" + | "youtube" + | "tiktok" + | "linkedin" + | "threads" + | "discord" + | "other"; + url: string; + }>; + status: + | "created" + | "review" + | "snoozed" + | "denied" + | "active" + | "blocked" + | "offboarding" + | "offboarded"; + details_submitted_at: string | null; + sso_enforced: boolean; + default_presentment_currency: string; + default_tax_behavior: "location" | "inclusive" | "exclusive"; + feature_settings: { + issue_funding_enabled?: boolean; + seat_based_pricing_enabled?: boolean; + wallets_enabled?: boolean; + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + overview_metrics?: ReadonlyArray | null; + reset_proration_behavior_enabled?: boolean; + off_session_charges_enabled?: boolean; + slack_benefit_enabled?: boolean; + preview_access_enabled?: boolean; + disputes_enabled?: boolean; + sso_enabled?: boolean; + compass_enabled?: boolean; + merchant_migration_enabled?: boolean; + } | null; + subscription_settings: { + allow_multiple_subscriptions: boolean; + proration_behavior: "invoice" | "prorate" | "next_period"; + benefit_revocation_grace_period: number; + prevent_trial_abuse: boolean; + allow_customer_updates: boolean; + }; + customer_email_settings: { + order_confirmation: boolean; + subscription_cancellation: boolean; + subscription_confirmation: boolean; + subscription_cycled: boolean; + subscription_cycled_after_trial: boolean; + subscription_past_due: boolean; + subscription_paused: boolean; + subscription_resumed: boolean; + subscription_renewal_reminder: boolean; + subscription_revoked: boolean; + subscription_trial_conversion_reminder: boolean; + subscription_uncanceled: boolean; + subscription_updated: boolean; + }; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + country?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null; + account_id: string | null; + payout_account_id: string | null; + capabilities: { + checkout_payments: boolean; + subscription_renewals: boolean; + payouts: boolean; + refunds: boolean; + api_access: boolean; + dashboard_access: boolean; + }; +} +export const OrganizationscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + email: Schema.NullOr(Schema.String), + website: Schema.NullOr(Schema.String), + socials: Schema.Array( + Schema.Struct({ + platform: Schema.Literals([ + "x", + "github", + "facebook", + "instagram", + "youtube", + "tiktok", + "linkedin", + "threads", + "discord", + "other", + ]), + url: Schema.String, + }), + ), + status: Schema.Literals([ + "created", + "review", + "snoozed", + "denied", + "active", + "blocked", + "offboarding", + "offboarded", + ]), + details_submitted_at: Schema.NullOr(Schema.String), + sso_enforced: Schema.Boolean, + default_presentment_currency: Schema.String, + default_tax_behavior: Schema.Literals([ + "location", + "inclusive", + "exclusive", + ]), + feature_settings: Schema.NullOr( + Schema.Struct({ + issue_funding_enabled: Schema.optional(Schema.Boolean), + seat_based_pricing_enabled: Schema.optional(Schema.Boolean), + wallets_enabled: Schema.optional(Schema.Boolean), + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + overview_metrics: Schema.optional( + Schema.NullOr(Schema.Array(Schema.String)), + ), + reset_proration_behavior_enabled: Schema.optional(Schema.Boolean), + off_session_charges_enabled: Schema.optional(Schema.Boolean), + slack_benefit_enabled: Schema.optional(Schema.Boolean), + preview_access_enabled: Schema.optional(Schema.Boolean), + disputes_enabled: Schema.optional(Schema.Boolean), + sso_enabled: Schema.optional(Schema.Boolean), + compass_enabled: Schema.optional(Schema.Boolean), + merchant_migration_enabled: Schema.optional(Schema.Boolean), + }), + ), + subscription_settings: Schema.Struct({ + allow_multiple_subscriptions: Schema.Boolean, + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + ]), + benefit_revocation_grace_period: Schema.Number, + prevent_trial_abuse: Schema.Boolean, + allow_customer_updates: Schema.Boolean, + }), + customer_email_settings: Schema.Struct({ + order_confirmation: Schema.Boolean, + subscription_cancellation: Schema.Boolean, + subscription_confirmation: Schema.Boolean, + subscription_cycled: Schema.Boolean, + subscription_cycled_after_trial: Schema.Boolean, + subscription_past_due: Schema.Boolean, + subscription_paused: Schema.Boolean, + subscription_resumed: Schema.Boolean, + subscription_renewal_reminder: Schema.Boolean, + subscription_revoked: Schema.Boolean, + subscription_trial_conversion_reminder: Schema.Boolean, + subscription_uncanceled: Schema.Boolean, + subscription_updated: Schema.Boolean, + }), + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + country: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + ), + ), + account_id: Schema.NullOr(Schema.String), + payout_account_id: Schema.NullOr(Schema.String), + capabilities: Schema.Struct({ + checkout_payments: Schema.Boolean, + subscription_renewals: Schema.Boolean, + payouts: Schema.Boolean, + refunds: Schema.Boolean, + api_access: Schema.Boolean, + dashboard_access: Schema.Boolean, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Organization + * + * Create an organization. + * **Scopes**: `organizations:write` + */ +export const organizationscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrganizationscreateInput, + outputSchema: OrganizationscreateOutput, +})); diff --git a/packages/polar/src/operations/organizationsget.ts b/packages/polar/src/operations/organizationsget.ts new file mode 100644 index 0000000000..f103c3d34a --- /dev/null +++ b/packages/polar/src/operations/organizationsget.ts @@ -0,0 +1,754 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrganizationsgetInput { + id: string; +} +export const OrganizationsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/organizations/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrganizationsgetOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + email: string | null; + website: string | null; + socials: ReadonlyArray<{ + platform: + | "x" + | "github" + | "facebook" + | "instagram" + | "youtube" + | "tiktok" + | "linkedin" + | "threads" + | "discord" + | "other"; + url: string; + }>; + status: + | "created" + | "review" + | "snoozed" + | "denied" + | "active" + | "blocked" + | "offboarding" + | "offboarded"; + details_submitted_at: string | null; + sso_enforced: boolean; + default_presentment_currency: string; + default_tax_behavior: "location" | "inclusive" | "exclusive"; + feature_settings: { + issue_funding_enabled?: boolean; + seat_based_pricing_enabled?: boolean; + wallets_enabled?: boolean; + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + overview_metrics?: ReadonlyArray | null; + reset_proration_behavior_enabled?: boolean; + off_session_charges_enabled?: boolean; + slack_benefit_enabled?: boolean; + preview_access_enabled?: boolean; + disputes_enabled?: boolean; + sso_enabled?: boolean; + compass_enabled?: boolean; + merchant_migration_enabled?: boolean; + } | null; + subscription_settings: { + allow_multiple_subscriptions: boolean; + proration_behavior: "invoice" | "prorate" | "next_period"; + benefit_revocation_grace_period: number; + prevent_trial_abuse: boolean; + allow_customer_updates: boolean; + }; + customer_email_settings: { + order_confirmation: boolean; + subscription_cancellation: boolean; + subscription_confirmation: boolean; + subscription_cycled: boolean; + subscription_cycled_after_trial: boolean; + subscription_past_due: boolean; + subscription_paused: boolean; + subscription_resumed: boolean; + subscription_renewal_reminder: boolean; + subscription_revoked: boolean; + subscription_trial_conversion_reminder: boolean; + subscription_uncanceled: boolean; + subscription_updated: boolean; + }; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + country?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null; + account_id: string | null; + payout_account_id: string | null; + capabilities: { + checkout_payments: boolean; + subscription_renewals: boolean; + payouts: boolean; + refunds: boolean; + api_access: boolean; + dashboard_access: boolean; + }; +} +export const OrganizationsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + email: Schema.NullOr(Schema.String), + website: Schema.NullOr(Schema.String), + socials: Schema.Array( + Schema.Struct({ + platform: Schema.Literals([ + "x", + "github", + "facebook", + "instagram", + "youtube", + "tiktok", + "linkedin", + "threads", + "discord", + "other", + ]), + url: Schema.String, + }), + ), + status: Schema.Literals([ + "created", + "review", + "snoozed", + "denied", + "active", + "blocked", + "offboarding", + "offboarded", + ]), + details_submitted_at: Schema.NullOr(Schema.String), + sso_enforced: Schema.Boolean, + default_presentment_currency: Schema.String, + default_tax_behavior: Schema.Literals([ + "location", + "inclusive", + "exclusive", + ]), + feature_settings: Schema.NullOr( + Schema.Struct({ + issue_funding_enabled: Schema.optional(Schema.Boolean), + seat_based_pricing_enabled: Schema.optional(Schema.Boolean), + wallets_enabled: Schema.optional(Schema.Boolean), + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + overview_metrics: Schema.optional( + Schema.NullOr(Schema.Array(Schema.String)), + ), + reset_proration_behavior_enabled: Schema.optional(Schema.Boolean), + off_session_charges_enabled: Schema.optional(Schema.Boolean), + slack_benefit_enabled: Schema.optional(Schema.Boolean), + preview_access_enabled: Schema.optional(Schema.Boolean), + disputes_enabled: Schema.optional(Schema.Boolean), + sso_enabled: Schema.optional(Schema.Boolean), + compass_enabled: Schema.optional(Schema.Boolean), + merchant_migration_enabled: Schema.optional(Schema.Boolean), + }), + ), + subscription_settings: Schema.Struct({ + allow_multiple_subscriptions: Schema.Boolean, + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + ]), + benefit_revocation_grace_period: Schema.Number, + prevent_trial_abuse: Schema.Boolean, + allow_customer_updates: Schema.Boolean, + }), + customer_email_settings: Schema.Struct({ + order_confirmation: Schema.Boolean, + subscription_cancellation: Schema.Boolean, + subscription_confirmation: Schema.Boolean, + subscription_cycled: Schema.Boolean, + subscription_cycled_after_trial: Schema.Boolean, + subscription_past_due: Schema.Boolean, + subscription_paused: Schema.Boolean, + subscription_resumed: Schema.Boolean, + subscription_renewal_reminder: Schema.Boolean, + subscription_revoked: Schema.Boolean, + subscription_trial_conversion_reminder: Schema.Boolean, + subscription_uncanceled: Schema.Boolean, + subscription_updated: Schema.Boolean, + }), + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + country: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + ), + ), + account_id: Schema.NullOr(Schema.String), + payout_account_id: Schema.NullOr(Schema.String), + capabilities: Schema.Struct({ + checkout_payments: Schema.Boolean, + subscription_renewals: Schema.Boolean, + payouts: Schema.Boolean, + refunds: Schema.Boolean, + api_access: Schema.Boolean, + dashboard_access: Schema.Boolean, + }), + }, +) as unknown as Schema.Codec; + +// The operation +/** + * Get Organization + * + * Get an organization by ID. + * **Scopes**: `organizations:read` `organizations:write` + */ +export const organizationsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrganizationsgetInput, + outputSchema: OrganizationsgetOutput, +})); diff --git a/packages/polar/src/operations/organizationslist.ts b/packages/polar/src/operations/organizationslist.ts new file mode 100644 index 0000000000..265cad09a8 --- /dev/null +++ b/packages/polar/src/operations/organizationslist.ts @@ -0,0 +1,805 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrganizationslistInput { + slug?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "slug" + | "-slug" + | "name" + | "-name" + | "next_review_threshold" + | "-next_review_threshold" + | "days_in_status" + | "-days_in_status" + > | null; +} +export const OrganizationslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + slug: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "slug", + "-slug", + "name", + "-name", + "next_review_threshold", + "-next_review_threshold", + "days_in_status", + "-days_in_status", + ]), + ), + ), + ), + }, +).pipe( + T.Http({ method: "GET", path: "/v1/organizations/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface OrganizationslistOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + email: string | null; + website: string | null; + socials: ReadonlyArray<{ + platform: + | "x" + | "github" + | "facebook" + | "instagram" + | "youtube" + | "tiktok" + | "linkedin" + | "threads" + | "discord" + | "other"; + url: string; + }>; + status: + | "created" + | "review" + | "snoozed" + | "denied" + | "active" + | "blocked" + | "offboarding" + | "offboarded"; + details_submitted_at: string | null; + sso_enforced: boolean; + default_presentment_currency: string; + default_tax_behavior: "location" | "inclusive" | "exclusive"; + feature_settings: { + issue_funding_enabled?: boolean; + seat_based_pricing_enabled?: boolean; + wallets_enabled?: boolean; + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + overview_metrics?: ReadonlyArray | null; + reset_proration_behavior_enabled?: boolean; + off_session_charges_enabled?: boolean; + slack_benefit_enabled?: boolean; + preview_access_enabled?: boolean; + disputes_enabled?: boolean; + sso_enabled?: boolean; + compass_enabled?: boolean; + merchant_migration_enabled?: boolean; + } | null; + subscription_settings: { + allow_multiple_subscriptions: boolean; + proration_behavior: "invoice" | "prorate" | "next_period"; + benefit_revocation_grace_period: number; + prevent_trial_abuse: boolean; + allow_customer_updates: boolean; + }; + customer_email_settings: { + order_confirmation: boolean; + subscription_cancellation: boolean; + subscription_confirmation: boolean; + subscription_cycled: boolean; + subscription_cycled_after_trial: boolean; + subscription_past_due: boolean; + subscription_paused: boolean; + subscription_resumed: boolean; + subscription_renewal_reminder: boolean; + subscription_revoked: boolean; + subscription_trial_conversion_reminder: boolean; + subscription_uncanceled: boolean; + subscription_updated: boolean; + }; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + country?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null; + account_id: string | null; + payout_account_id: string | null; + capabilities: { + checkout_payments: boolean; + subscription_renewals: boolean; + payouts: boolean; + refunds: boolean; + api_access: boolean; + dashboard_access: boolean; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const OrganizationslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + email: Schema.NullOr(Schema.String), + website: Schema.NullOr(Schema.String), + socials: Schema.Array( + Schema.Struct({ + platform: Schema.Literals([ + "x", + "github", + "facebook", + "instagram", + "youtube", + "tiktok", + "linkedin", + "threads", + "discord", + "other", + ]), + url: Schema.String, + }), + ), + status: Schema.Literals([ + "created", + "review", + "snoozed", + "denied", + "active", + "blocked", + "offboarding", + "offboarded", + ]), + details_submitted_at: Schema.NullOr(Schema.String), + sso_enforced: Schema.Boolean, + default_presentment_currency: Schema.String, + default_tax_behavior: Schema.Literals([ + "location", + "inclusive", + "exclusive", + ]), + feature_settings: Schema.NullOr( + Schema.Struct({ + issue_funding_enabled: Schema.optional(Schema.Boolean), + seat_based_pricing_enabled: Schema.optional(Schema.Boolean), + wallets_enabled: Schema.optional(Schema.Boolean), + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + overview_metrics: Schema.optional( + Schema.NullOr(Schema.Array(Schema.String)), + ), + reset_proration_behavior_enabled: Schema.optional(Schema.Boolean), + off_session_charges_enabled: Schema.optional(Schema.Boolean), + slack_benefit_enabled: Schema.optional(Schema.Boolean), + preview_access_enabled: Schema.optional(Schema.Boolean), + disputes_enabled: Schema.optional(Schema.Boolean), + sso_enabled: Schema.optional(Schema.Boolean), + compass_enabled: Schema.optional(Schema.Boolean), + merchant_migration_enabled: Schema.optional(Schema.Boolean), + }), + ), + subscription_settings: Schema.Struct({ + allow_multiple_subscriptions: Schema.Boolean, + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + ]), + benefit_revocation_grace_period: Schema.Number, + prevent_trial_abuse: Schema.Boolean, + allow_customer_updates: Schema.Boolean, + }), + customer_email_settings: Schema.Struct({ + order_confirmation: Schema.Boolean, + subscription_cancellation: Schema.Boolean, + subscription_confirmation: Schema.Boolean, + subscription_cycled: Schema.Boolean, + subscription_cycled_after_trial: Schema.Boolean, + subscription_past_due: Schema.Boolean, + subscription_paused: Schema.Boolean, + subscription_resumed: Schema.Boolean, + subscription_renewal_reminder: Schema.Boolean, + subscription_revoked: Schema.Boolean, + subscription_trial_conversion_reminder: Schema.Boolean, + subscription_uncanceled: Schema.Boolean, + subscription_updated: Schema.Boolean, + }), + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + country: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + ), + ), + account_id: Schema.NullOr(Schema.String), + payout_account_id: Schema.NullOr(Schema.String), + capabilities: Schema.Struct({ + checkout_payments: Schema.Boolean, + subscription_renewals: Schema.Boolean, + payouts: Schema.Boolean, + refunds: Schema.Boolean, + api_access: Schema.Boolean, + dashboard_access: Schema.Boolean, + }), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Organizations + * + * List organizations. + * **Scopes**: `organizations:read` `organizations:write` + * + * @param slug - Filter by slug. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const organizationslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrganizationslistInput, + outputSchema: OrganizationslistOutput, +})); diff --git a/packages/polar/src/operations/organizationsupdate.ts b/packages/polar/src/operations/organizationsupdate.ts new file mode 100644 index 0000000000..f672c09d68 --- /dev/null +++ b/packages/polar/src/operations/organizationsupdate.ts @@ -0,0 +1,1707 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface OrganizationsupdateInput { + id: string; + name?: string | null; + avatar_url?: string | null; + email?: string | null; + website?: string | null; + socials?: ReadonlyArray<{ + platform: + | "x" + | "github" + | "facebook" + | "instagram" + | "youtube" + | "tiktok" + | "linkedin" + | "threads" + | "discord" + | "other"; + url: string; + }> | null; + details?: { + about?: string | null; + product_description?: string | null; + selling_categories?: ReadonlyArray; + pricing_models?: ReadonlyArray; + intended_use?: string | null; + customer_acquisition?: ReadonlyArray; + future_annual_revenue?: number | null; + switching?: boolean; + switching_from?: + | "paddle" + | "lemon_squeezy" + | "gumroad" + | "stripe" + | "other" + | null; + previous_annual_revenue?: number | null; + } | null; + country?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null; + feature_settings?: { + seat_based_pricing_enabled?: boolean; + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + overview_metrics?: ReadonlyArray | null; + } | null; + subscription_settings?: { + allow_multiple_subscriptions: boolean; + proration_behavior: "invoice" | "prorate" | "next_period"; + benefit_revocation_grace_period: number; + prevent_trial_abuse: boolean; + allow_customer_updates: boolean; + } | null; + customer_email_settings?: { + order_confirmation: boolean; + subscription_cancellation: boolean; + subscription_confirmation: boolean; + subscription_cycled: boolean; + subscription_cycled_after_trial: boolean; + subscription_past_due: boolean; + subscription_paused: boolean; + subscription_resumed: boolean; + subscription_renewal_reminder: boolean; + subscription_revoked: boolean; + subscription_trial_conversion_reminder: boolean; + subscription_uncanceled: boolean; + subscription_updated: boolean; + } | null; + customer_portal_settings?: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + } | null; + default_presentment_currency?: + | "aed" + | "all" + | "amd" + | "aoa" + | "ars" + | "aud" + | "awg" + | "azn" + | "bam" + | "bbd" + | "bdt" + | "bif" + | "bmd" + | "bnd" + | "bob" + | "brl" + | "bsd" + | "bwp" + | "bzd" + | "cad" + | "cdf" + | "chf" + | "clp" + | "cny" + | "cop" + | "crc" + | "cve" + | "czk" + | "djf" + | "dkk" + | "dop" + | "dzd" + | "egp" + | "etb" + | "eur" + | "fjd" + | "fkp" + | "gbp" + | "gel" + | "gip" + | "gmd" + | "gnf" + | "gtq" + | "gyd" + | "hkd" + | "hnl" + | "htg" + | "huf" + | "idr" + | "ils" + | "inr" + | "isk" + | "jmd" + | "jpy" + | "kes" + | "kgs" + | "khr" + | "kmf" + | "krw" + | "kyd" + | "kzt" + | "lak" + | "lkr" + | "lrd" + | "lsl" + | "mad" + | "mdl" + | "mga" + | "mkd" + | "mnt" + | "mop" + | "mur" + | "mvr" + | "mwk" + | "mxn" + | "myr" + | "mzn" + | "nad" + | "ngn" + | "nio" + | "nok" + | "npr" + | "nzd" + | "pab" + | "pen" + | "pgk" + | "php" + | "pkr" + | "pln" + | "pyg" + | "qar" + | "ron" + | "rsd" + | "rwf" + | "sar" + | "sbd" + | "scr" + | "sek" + | "sgd" + | "shp" + | "sos" + | "srd" + | "szl" + | "thb" + | "tjs" + | "top" + | "try" + | "ttd" + | "twd" + | "tzs" + | "uah" + | "ugx" + | "usd" + | "uyu" + | "uzs" + | "vnd" + | "vuv" + | "wst" + | "xaf" + | "xcd" + | "xcg" + | "xof" + | "xpf" + | "yer" + | "zar" + | "zmw" + | null; + default_tax_behavior?: "location" | "inclusive" | "exclusive" | null; + sso_enforced?: boolean | null; +} +export const OrganizationsupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + name: Schema.optional(Schema.NullOr(Schema.String)), + avatar_url: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + website: Schema.optional(Schema.NullOr(Schema.String)), + socials: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Struct({ + platform: Schema.Literals([ + "x", + "github", + "facebook", + "instagram", + "youtube", + "tiktok", + "linkedin", + "threads", + "discord", + "other", + ]), + url: Schema.String, + }), + ), + ), + ), + details: Schema.optional( + Schema.NullOr( + Schema.Struct({ + about: Schema.optional(Schema.NullOr(Schema.String)), + product_description: Schema.optional(Schema.NullOr(Schema.String)), + selling_categories: Schema.optional(Schema.Array(Schema.String)), + pricing_models: Schema.optional(Schema.Array(Schema.String)), + intended_use: Schema.optional(Schema.NullOr(Schema.String)), + customer_acquisition: Schema.optional(Schema.Array(Schema.String)), + future_annual_revenue: Schema.optional(Schema.NullOr(Schema.Number)), + switching: Schema.optional(Schema.Boolean), + switching_from: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "paddle", + "lemon_squeezy", + "gumroad", + "stripe", + "other", + ]), + ), + ), + previous_annual_revenue: Schema.optional( + Schema.NullOr(Schema.Number), + ), + }), + ), + ), + country: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + ), + ), + feature_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + seat_based_pricing_enabled: Schema.optional(Schema.Boolean), + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + overview_metrics: Schema.optional( + Schema.NullOr(Schema.Array(Schema.String)), + ), + }), + ), + ), + subscription_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + allow_multiple_subscriptions: Schema.Boolean, + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + ]), + benefit_revocation_grace_period: Schema.Number, + prevent_trial_abuse: Schema.Boolean, + allow_customer_updates: Schema.Boolean, + }), + ), + ), + customer_email_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + order_confirmation: Schema.Boolean, + subscription_cancellation: Schema.Boolean, + subscription_confirmation: Schema.Boolean, + subscription_cycled: Schema.Boolean, + subscription_cycled_after_trial: Schema.Boolean, + subscription_past_due: Schema.Boolean, + subscription_paused: Schema.Boolean, + subscription_resumed: Schema.Boolean, + subscription_renewal_reminder: Schema.Boolean, + subscription_revoked: Schema.Boolean, + subscription_trial_conversion_reminder: Schema.Boolean, + subscription_uncanceled: Schema.Boolean, + subscription_updated: Schema.Boolean, + }), + ), + ), + customer_portal_settings: Schema.optional( + Schema.NullOr( + Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + ), + ), + default_presentment_currency: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "aed", + "all", + "amd", + "aoa", + "ars", + "aud", + "awg", + "azn", + "bam", + "bbd", + "bdt", + "bif", + "bmd", + "bnd", + "bob", + "brl", + "bsd", + "bwp", + "bzd", + "cad", + "cdf", + "chf", + "clp", + "cny", + "cop", + "crc", + "cve", + "czk", + "djf", + "dkk", + "dop", + "dzd", + "egp", + "etb", + "eur", + "fjd", + "fkp", + "gbp", + "gel", + "gip", + "gmd", + "gnf", + "gtq", + "gyd", + "hkd", + "hnl", + "htg", + "huf", + "idr", + "ils", + "inr", + "isk", + "jmd", + "jpy", + "kes", + "kgs", + "khr", + "kmf", + "krw", + "kyd", + "kzt", + "lak", + "lkr", + "lrd", + "lsl", + "mad", + "mdl", + "mga", + "mkd", + "mnt", + "mop", + "mur", + "mvr", + "mwk", + "mxn", + "myr", + "mzn", + "nad", + "ngn", + "nio", + "nok", + "npr", + "nzd", + "pab", + "pen", + "pgk", + "php", + "pkr", + "pln", + "pyg", + "qar", + "ron", + "rsd", + "rwf", + "sar", + "sbd", + "scr", + "sek", + "sgd", + "shp", + "sos", + "srd", + "szl", + "thb", + "tjs", + "top", + "try", + "ttd", + "twd", + "tzs", + "uah", + "ugx", + "usd", + "uyu", + "uzs", + "vnd", + "vuv", + "wst", + "xaf", + "xcd", + "xcg", + "xof", + "xpf", + "yer", + "zar", + "zmw", + ]), + ), + ), + default_tax_behavior: Schema.optional( + Schema.NullOr(Schema.Literals(["location", "inclusive", "exclusive"])), + ), + sso_enforced: Schema.optional(Schema.NullOr(Schema.Boolean)), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/organizations/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface OrganizationsupdateOutput { + created_at: string; + modified_at: string | null; + id: string; + name: string; + slug: string; + avatar_url: string | null; + proration_behavior: "invoice" | "prorate" | "next_period" | "reset"; + allow_customer_updates: boolean; + email: string | null; + website: string | null; + socials: ReadonlyArray<{ + platform: + | "x" + | "github" + | "facebook" + | "instagram" + | "youtube" + | "tiktok" + | "linkedin" + | "threads" + | "discord" + | "other"; + url: string; + }>; + status: + | "created" + | "review" + | "snoozed" + | "denied" + | "active" + | "blocked" + | "offboarding" + | "offboarded"; + details_submitted_at: string | null; + sso_enforced: boolean; + default_presentment_currency: string; + default_tax_behavior: "location" | "inclusive" | "exclusive"; + feature_settings: { + issue_funding_enabled?: boolean; + seat_based_pricing_enabled?: boolean; + wallets_enabled?: boolean; + member_model_enabled?: boolean; + checkout_localization_enabled?: boolean; + overview_metrics?: ReadonlyArray | null; + reset_proration_behavior_enabled?: boolean; + off_session_charges_enabled?: boolean; + slack_benefit_enabled?: boolean; + preview_access_enabled?: boolean; + disputes_enabled?: boolean; + sso_enabled?: boolean; + compass_enabled?: boolean; + merchant_migration_enabled?: boolean; + } | null; + subscription_settings: { + allow_multiple_subscriptions: boolean; + proration_behavior: "invoice" | "prorate" | "next_period"; + benefit_revocation_grace_period: number; + prevent_trial_abuse: boolean; + allow_customer_updates: boolean; + }; + customer_email_settings: { + order_confirmation: boolean; + subscription_cancellation: boolean; + subscription_confirmation: boolean; + subscription_cycled: boolean; + subscription_cycled_after_trial: boolean; + subscription_past_due: boolean; + subscription_paused: boolean; + subscription_resumed: boolean; + subscription_renewal_reminder: boolean; + subscription_revoked: boolean; + subscription_trial_conversion_reminder: boolean; + subscription_uncanceled: boolean; + subscription_updated: boolean; + }; + customer_portal_settings: { + usage: { show: boolean }; + subscription: { + update_seats: boolean; + update_plan: boolean; + pause?: boolean; + }; + customer?: { allow_email_change?: boolean }; + }; + country?: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW" + | null; + account_id: string | null; + payout_account_id: string | null; + capabilities: { + checkout_payments: boolean; + subscription_renewals: boolean; + payouts: boolean; + refunds: boolean; + api_access: boolean; + dashboard_access: boolean; + }; +} +export const OrganizationsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + slug: Schema.String, + avatar_url: Schema.NullOr(Schema.String), + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + "reset", + ]), + allow_customer_updates: Schema.Boolean, + email: Schema.NullOr(Schema.String), + website: Schema.NullOr(Schema.String), + socials: Schema.Array( + Schema.Struct({ + platform: Schema.Literals([ + "x", + "github", + "facebook", + "instagram", + "youtube", + "tiktok", + "linkedin", + "threads", + "discord", + "other", + ]), + url: Schema.String, + }), + ), + status: Schema.Literals([ + "created", + "review", + "snoozed", + "denied", + "active", + "blocked", + "offboarding", + "offboarded", + ]), + details_submitted_at: Schema.NullOr(Schema.String), + sso_enforced: Schema.Boolean, + default_presentment_currency: Schema.String, + default_tax_behavior: Schema.Literals([ + "location", + "inclusive", + "exclusive", + ]), + feature_settings: Schema.NullOr( + Schema.Struct({ + issue_funding_enabled: Schema.optional(Schema.Boolean), + seat_based_pricing_enabled: Schema.optional(Schema.Boolean), + wallets_enabled: Schema.optional(Schema.Boolean), + member_model_enabled: Schema.optional(Schema.Boolean), + checkout_localization_enabled: Schema.optional(Schema.Boolean), + overview_metrics: Schema.optional( + Schema.NullOr(Schema.Array(Schema.String)), + ), + reset_proration_behavior_enabled: Schema.optional(Schema.Boolean), + off_session_charges_enabled: Schema.optional(Schema.Boolean), + slack_benefit_enabled: Schema.optional(Schema.Boolean), + preview_access_enabled: Schema.optional(Schema.Boolean), + disputes_enabled: Schema.optional(Schema.Boolean), + sso_enabled: Schema.optional(Schema.Boolean), + compass_enabled: Schema.optional(Schema.Boolean), + merchant_migration_enabled: Schema.optional(Schema.Boolean), + }), + ), + subscription_settings: Schema.Struct({ + allow_multiple_subscriptions: Schema.Boolean, + proration_behavior: Schema.Literals([ + "invoice", + "prorate", + "next_period", + ]), + benefit_revocation_grace_period: Schema.Number, + prevent_trial_abuse: Schema.Boolean, + allow_customer_updates: Schema.Boolean, + }), + customer_email_settings: Schema.Struct({ + order_confirmation: Schema.Boolean, + subscription_cancellation: Schema.Boolean, + subscription_confirmation: Schema.Boolean, + subscription_cycled: Schema.Boolean, + subscription_cycled_after_trial: Schema.Boolean, + subscription_past_due: Schema.Boolean, + subscription_paused: Schema.Boolean, + subscription_resumed: Schema.Boolean, + subscription_renewal_reminder: Schema.Boolean, + subscription_revoked: Schema.Boolean, + subscription_trial_conversion_reminder: Schema.Boolean, + subscription_uncanceled: Schema.Boolean, + subscription_updated: Schema.Boolean, + }), + customer_portal_settings: Schema.Struct({ + usage: Schema.Struct({ + show: Schema.Boolean, + }), + subscription: Schema.Struct({ + update_seats: Schema.Boolean, + update_plan: Schema.Boolean, + pause: Schema.optional(Schema.Boolean), + }), + customer: Schema.optional( + Schema.Struct({ + allow_email_change: Schema.optional(Schema.Boolean), + }), + ), + }), + country: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + ), + ), + account_id: Schema.NullOr(Schema.String), + payout_account_id: Schema.NullOr(Schema.String), + capabilities: Schema.Struct({ + checkout_payments: Schema.Boolean, + subscription_renewals: Schema.Boolean, + payouts: Schema.Boolean, + refunds: Schema.Boolean, + api_access: Schema.Boolean, + dashboard_access: Schema.Boolean, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Organization + * + * Update an organization. + * **Scopes**: `organizations:write` + */ +export const organizationsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: OrganizationsupdateInput, + outputSchema: OrganizationsupdateOutput, +})); diff --git a/packages/polar/src/operations/paymentsget.ts b/packages/polar/src/operations/paymentsget.ts new file mode 100644 index 0000000000..b65d4df19c --- /dev/null +++ b/packages/polar/src/operations/paymentsget.ts @@ -0,0 +1,141 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface PaymentsgetInput { + id: string; +} +export const PaymentsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/payments/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export type PaymentsgetOutput = + | { + created_at: string; + modified_at: string | null; + id: string; + processor: "stripe"; + status: "pending" | "succeeded" | "failed"; + amount: number; + currency: string; + method: string; + trigger: + | "purchase" + | "subscription_cycle" + | "retry_dunning" + | "retry_customer" + | "retry_payment_method_update" + | "retry_admin" + | null; + decline_reason: string | null; + decline_message: string | null; + organization_id: string; + checkout_id: string | null; + order_id: string | null; + processor_metadata?: Record; + method_metadata: { brand: string; last4: string }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + processor: "stripe"; + status: "pending" | "succeeded" | "failed"; + amount: number; + currency: string; + method: string; + trigger: + | "purchase" + | "subscription_cycle" + | "retry_dunning" + | "retry_customer" + | "retry_payment_method_update" + | "retry_admin" + | null; + decline_reason: string | null; + decline_message: string | null; + organization_id: string; + checkout_id: string | null; + order_id: string | null; + processor_metadata?: Record; + }; +export const PaymentsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + processor: Schema.Literals(["stripe"]), + status: Schema.Literals(["pending", "succeeded", "failed"]), + amount: Schema.Number, + currency: Schema.String, + method: Schema.String, + trigger: Schema.NullOr( + Schema.Literals([ + "purchase", + "subscription_cycle", + "retry_dunning", + "retry_customer", + "retry_payment_method_update", + "retry_admin", + ]), + ), + decline_reason: Schema.NullOr(Schema.String), + decline_message: Schema.NullOr(Schema.String), + organization_id: Schema.String, + checkout_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + processor_metadata: Schema.optional( + Schema.Record(Schema.String, Schema.Unknown), + ), + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + processor: Schema.Literals(["stripe"]), + status: Schema.Literals(["pending", "succeeded", "failed"]), + amount: Schema.Number, + currency: Schema.String, + method: Schema.String, + trigger: Schema.NullOr( + Schema.Literals([ + "purchase", + "subscription_cycle", + "retry_dunning", + "retry_customer", + "retry_payment_method_update", + "retry_admin", + ]), + ), + decline_reason: Schema.NullOr(Schema.String), + decline_message: Schema.NullOr(Schema.String), + organization_id: Schema.String, + checkout_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + processor_metadata: Schema.optional( + Schema.Record(Schema.String, Schema.Unknown), + ), + }), +]) as unknown as Schema.Codec; + +// The operation +/** + * Get Payment + * + * Get a payment by ID. + * **Scopes**: `payments:read` + * + * @param id - The payment ID. + */ +export const paymentsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: PaymentsgetInput, + outputSchema: PaymentsgetOutput, +})); diff --git a/packages/polar/src/operations/paymentslist.ts b/packages/polar/src/operations/paymentslist.ts new file mode 100644 index 0000000000..40e2446e9e --- /dev/null +++ b/packages/polar/src/operations/paymentslist.ts @@ -0,0 +1,228 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface PaymentslistInput { + organization_id?: string | ReadonlyArray | null; + checkout_id?: string | ReadonlyArray | null; + order_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + status?: + | "pending" + | "succeeded" + | "failed" + | ReadonlyArray<"pending" | "succeeded" | "failed"> + | null; + method?: string | ReadonlyArray | null; + customer_email?: string | ReadonlyArray | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "status" + | "-status" + | "amount" + | "-amount" + | "method" + | "-method" + > | null; +} +export const PaymentslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + checkout_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + order_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + status: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals(["pending", "succeeded", "failed"]), + Schema.Array(Schema.Literals(["pending", "succeeded", "failed"])), + ]), + ), + ), + method: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_email: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "status", + "-status", + "amount", + "-amount", + "method", + "-method", + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/payments/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface PaymentslistOutput { + items: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + processor: "stripe"; + status: "pending" | "succeeded" | "failed"; + amount: number; + currency: string; + method: string; + trigger: + | "purchase" + | "subscription_cycle" + | "retry_dunning" + | "retry_customer" + | "retry_payment_method_update" + | "retry_admin" + | null; + decline_reason: string | null; + decline_message: string | null; + organization_id: string; + checkout_id: string | null; + order_id: string | null; + processor_metadata?: Record; + method_metadata: { brand: string; last4: string }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + processor: "stripe"; + status: "pending" | "succeeded" | "failed"; + amount: number; + currency: string; + method: string; + trigger: + | "purchase" + | "subscription_cycle" + | "retry_dunning" + | "retry_customer" + | "retry_payment_method_update" + | "retry_admin" + | null; + decline_reason: string | null; + decline_message: string | null; + organization_id: string; + checkout_id: string | null; + order_id: string | null; + processor_metadata?: Record; + } + >; + pagination: { total_count: number; max_page: number }; +} +export const PaymentslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + processor: Schema.Literals(["stripe"]), + status: Schema.Literals(["pending", "succeeded", "failed"]), + amount: Schema.Number, + currency: Schema.String, + method: Schema.String, + trigger: Schema.NullOr( + Schema.Literals([ + "purchase", + "subscription_cycle", + "retry_dunning", + "retry_customer", + "retry_payment_method_update", + "retry_admin", + ]), + ), + decline_reason: Schema.NullOr(Schema.String), + decline_message: Schema.NullOr(Schema.String), + organization_id: Schema.String, + checkout_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + processor_metadata: Schema.optional( + Schema.Record(Schema.String, Schema.Unknown), + ), + method_metadata: Schema.Struct({ + brand: Schema.String, + last4: Schema.String, + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + processor: Schema.Literals(["stripe"]), + status: Schema.Literals(["pending", "succeeded", "failed"]), + amount: Schema.Number, + currency: Schema.String, + method: Schema.String, + trigger: Schema.NullOr( + Schema.Literals([ + "purchase", + "subscription_cycle", + "retry_dunning", + "retry_customer", + "retry_payment_method_update", + "retry_admin", + ]), + ), + decline_reason: Schema.NullOr(Schema.String), + decline_message: Schema.NullOr(Schema.String), + organization_id: Schema.String, + checkout_id: Schema.NullOr(Schema.String), + order_id: Schema.NullOr(Schema.String), + processor_metadata: Schema.optional( + Schema.Record(Schema.String, Schema.Unknown), + ), + }), + ]), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Payments + * + * List payments. + * **Scopes**: `payments:read` + * + * @param organization_id - Filter by organization ID. + * @param checkout_id - Filter by checkout ID. + * @param order_id - Filter by order ID. + * @param customer_id - Filter by customer ID. + * @param status - Filter by payment status. + * @param method - Filter by payment method. + * @param customer_email - Filter by customer email. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const paymentslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: PaymentslistInput, + outputSchema: PaymentslistOutput, +})); diff --git a/packages/polar/src/operations/productscreate.ts b/packages/polar/src/operations/productscreate.ts new file mode 100644 index 0000000000..eee5007967 --- /dev/null +++ b/packages/polar/src/operations/productscreate.ts @@ -0,0 +1,694 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface ProductscreateInput { + metadata?: Record; + name: string; + description?: string | null; + visibility?: "draft" | "private" | "public"; + prices: ReadonlyArray; + medias?: ReadonlyArray | null; + attached_custom_fields?: ReadonlyArray<{ + custom_field_id: string; + required: boolean; + }>; + organization_id?: string | null; + trial_interval?: "day" | "week" | "month" | "year" | null; + trial_interval_count?: number | null; + recurring_interval?: unknown; + recurring_interval_count?: unknown; + meter_interval?: "day" | "week" | "month" | "year" | null; + meter_interval_count?: number | null; +} +export const ProductscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + name: Schema.String, + description: Schema.optional(Schema.NullOr(Schema.String)), + visibility: Schema.optional(Schema.Literals(["draft", "private", "public"])), + prices: Schema.Array(Schema.Unknown), + medias: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), + attached_custom_fields: Schema.optional( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + required: Schema.Boolean, + }), + ), + ), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + trial_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + trial_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + recurring_interval: Schema.optional(Schema.Unknown), + recurring_interval_count: Schema.optional(Schema.Unknown), + meter_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + meter_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), +}).pipe( + T.Http({ method: "POST", path: "/v1/products/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface ProductscreateOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; +} +export const ProductscreateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Create Product + * + * Create a product. + * **Scopes**: `products:write` + */ +export const productscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: ProductscreateInput, + outputSchema: ProductscreateOutput, +})); diff --git a/packages/polar/src/operations/productsget.ts b/packages/polar/src/operations/productsget.ts new file mode 100644 index 0000000000..035b600b82 --- /dev/null +++ b/packages/polar/src/operations/productsget.ts @@ -0,0 +1,649 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface ProductsgetInput { + id: string; +} +export const ProductsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/products/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface ProductsgetOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; +} +export const ProductsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Get Product + * + * Get a product by ID. + * **Scopes**: `products:read` `products:write` + */ +export const productsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: ProductsgetInput, + outputSchema: ProductsgetOutput, +})); diff --git a/packages/polar/src/operations/productslist.ts b/packages/polar/src/operations/productslist.ts new file mode 100644 index 0000000000..a267e8c068 --- /dev/null +++ b/packages/polar/src/operations/productslist.ts @@ -0,0 +1,764 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface ProductslistInput { + id?: string | ReadonlyArray | null; + organization_id?: string | ReadonlyArray | null; + query?: string | null; + is_archived?: boolean | null; + is_recurring?: boolean | null; + benefit_id?: string | ReadonlyArray | null; + visibility?: ReadonlyArray<"draft" | "private" | "public"> | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "created_at" + | "-created_at" + | "name" + | "-name" + | "price_amount_type" + | "-price_amount_type" + | "price_amount" + | "-price_amount" + > | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const ProductslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + query: Schema.optional(Schema.NullOr(Schema.String)), + is_archived: Schema.optional(Schema.NullOr(Schema.Boolean)), + is_recurring: Schema.optional(Schema.NullOr(Schema.Boolean)), + benefit_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + visibility: Schema.optional( + Schema.NullOr( + Schema.Array(Schema.Literals(["draft", "private", "public"])), + ), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "created_at", + "-created_at", + "name", + "-name", + "price_amount_type", + "-price_amount_type", + "price_amount", + "-price_amount", + ]), + ), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/products/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface ProductslistOutput { + items: ReadonlyArray<{ + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; + }>; + pagination: { total_count: number; max_page: number }; +} +export const ProductslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Products + * + * List products. + * **Scopes**: `products:read` `products:write` + * + * @param id - Filter by product ID. + * @param organization_id - Filter by organization ID. + * @param query - Filter by product name. + * @param is_archived - Filter on archived products. + * @param is_recurring - Filter on recurring products. If `true`, only subscriptions tiers are returned. If `false`, only one-time purchase products are returned. + * @param benefit_id - Filter products granting specific benefit. + * @param visibility - Filter by visibility. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const productslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: ProductslistInput, + outputSchema: ProductslistOutput, +})); diff --git a/packages/polar/src/operations/productsupdate.ts b/packages/polar/src/operations/productsupdate.ts new file mode 100644 index 0000000000..112236bb2f --- /dev/null +++ b/packages/polar/src/operations/productsupdate.ts @@ -0,0 +1,707 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface ProductsupdateInput { + id: string; + metadata?: Record; + trial_interval?: "day" | "week" | "month" | "year" | null; + trial_interval_count?: number | null; + name?: string | null; + description?: string | null; + recurring_interval?: "day" | "week" | "month" | "year" | null; + recurring_interval_count?: number | null; + is_archived?: boolean | null; + visibility?: "draft" | "private" | "public" | null; + prices?: ReadonlyArray<{ id: string } | unknown> | null; + medias?: ReadonlyArray | null; + attached_custom_fields?: ReadonlyArray<{ + custom_field_id: string; + required: boolean; + }> | null; +} +export const ProductsupdateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + trial_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + trial_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + name: Schema.optional(Schema.NullOr(Schema.String)), + description: Schema.optional(Schema.NullOr(Schema.String)), + recurring_interval: Schema.optional( + Schema.NullOr(Schema.Literals(["day", "week", "month", "year"])), + ), + recurring_interval_count: Schema.optional(Schema.NullOr(Schema.Number)), + is_archived: Schema.optional(Schema.NullOr(Schema.Boolean)), + visibility: Schema.optional( + Schema.NullOr(Schema.Literals(["draft", "private", "public"])), + ), + prices: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Union([ + Schema.Struct({ + id: Schema.String, + }), + Schema.Unknown, + ]), + ), + ), + ), + medias: Schema.optional(Schema.NullOr(Schema.Array(Schema.String))), + attached_custom_fields: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + required: Schema.Boolean, + }), + ), + ), + ), +}).pipe( + T.Http({ method: "PATCH", path: "/v1/products/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface ProductsupdateOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; +} +export const ProductsupdateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Update Product + * + * Update a product. + * **Scopes**: `products:write` + */ +export const productsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: ProductsupdateInput, + outputSchema: ProductsupdateOutput, +})); diff --git a/packages/polar/src/operations/productsupdateBenefits.ts b/packages/polar/src/operations/productsupdateBenefits.ts new file mode 100644 index 0000000000..f1ae244b0d --- /dev/null +++ b/packages/polar/src/operations/productsupdateBenefits.ts @@ -0,0 +1,665 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface ProductsupdateBenefitsInput { + id: string; + benefits: ReadonlyArray; +} +export const ProductsupdateBenefitsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + benefits: Schema.Array(Schema.String), + }).pipe( + T.Http({ method: "POST", path: "/v1/products/{id}/benefits" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface ProductsupdateBenefitsOutput { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { ttl: number; timeframe: "year" | "month" | "day" } | null; + activations: { limit: number; enable_customer_admin: boolean } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; +} +export const ProductsupdateBenefitsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Product Benefits + * + * Update benefits granted by a product. + * **Scopes**: `products:write` + */ +export const productsupdateBenefits = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: ProductsupdateBenefitsInput, + outputSchema: ProductsupdateBenefitsOutput, + }), +); diff --git a/packages/polar/src/operations/refundscreate.ts b/packages/polar/src/operations/refundscreate.ts new file mode 100644 index 0000000000..318ee0c975 --- /dev/null +++ b/packages/polar/src/operations/refundscreate.ts @@ -0,0 +1,152 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface RefundscreateInput { + metadata?: Record; + order_id: string; + reason: + | "duplicate" + | "fraudulent" + | "customer_request" + | "service_disruption" + | "satisfaction_guarantee" + | "other"; + amount: number; + comment?: string | null; + revoke_benefits?: boolean; +} +export const RefundscreateInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + order_id: Schema.String, + reason: Schema.Literals([ + "duplicate", + "fraudulent", + "customer_request", + "service_disruption", + "satisfaction_guarantee", + "other", + ]), + amount: Schema.Number, + comment: Schema.optional(Schema.NullOr(Schema.String)), + revoke_benefits: Schema.optional(Schema.Boolean), +}).pipe( + T.Http({ method: "POST", path: "/v1/refunds/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface RefundscreateOutput { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + status: "pending" | "succeeded" | "failed" | "canceled"; + reason: + | "duplicate" + | "fraudulent" + | "customer_request" + | "service_disruption" + | "satisfaction_guarantee" + | "dispute_prevention" + | "other"; + amount: number; + tax_amount: number; + currency: string; + organization_id: string; + order_id: string; + subscription_id: string | null; + customer_id: string; + revoke_benefits: boolean; + dispute: { + created_at: string; + modified_at: string | null; + id: string; + status: + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won"; + resolved: boolean; + closed: boolean; + amount: number; + tax_amount: number; + currency: string; + reason: string | null; + evidence_due_by: string | null; + past_due: boolean; + order_id: string; + payment_id: string; + } | null; +} +export const RefundscreateOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + status: Schema.Literals(["pending", "succeeded", "failed", "canceled"]), + reason: Schema.Literals([ + "duplicate", + "fraudulent", + "customer_request", + "service_disruption", + "satisfaction_guarantee", + "dispute_prevention", + "other", + ]), + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + organization_id: Schema.String, + order_id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + customer_id: Schema.String, + revoke_benefits: Schema.Boolean, + dispute: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + status: Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + resolved: Schema.Boolean, + closed: Schema.Boolean, + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + reason: Schema.NullOr(Schema.String), + evidence_due_by: Schema.NullOr(Schema.String), + past_due: Schema.Boolean, + order_id: Schema.String, + payment_id: Schema.String, + }), + ), +}) as unknown as Schema.Codec; + +// The operation +/** + * Create Refund + * + * Create a refund. + * **Scopes**: `refunds:write` + */ +export const refundscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: RefundscreateInput, + outputSchema: RefundscreateOutput, +})); diff --git a/packages/polar/src/operations/refundslist.ts b/packages/polar/src/operations/refundslist.ts new file mode 100644 index 0000000000..be5ed637c1 --- /dev/null +++ b/packages/polar/src/operations/refundslist.ts @@ -0,0 +1,184 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface RefundslistInput { + id?: string | ReadonlyArray | null; + organization_id?: string | ReadonlyArray | null; + order_id?: string | ReadonlyArray | null; + subscription_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + succeeded?: boolean | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + "created_at" | "-created_at" | "amount" | "-amount" + > | null; +} +export const RefundslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + order_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + subscription_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + succeeded: Schema.optional(Schema.NullOr(Schema.Boolean)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals(["created_at", "-created_at", "amount", "-amount"]), + ), + ), + ), +}).pipe( + T.Http({ method: "GET", path: "/v1/refunds/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface RefundslistOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + status: "pending" | "succeeded" | "failed" | "canceled"; + reason: + | "duplicate" + | "fraudulent" + | "customer_request" + | "service_disruption" + | "satisfaction_guarantee" + | "dispute_prevention" + | "other"; + amount: number; + tax_amount: number; + currency: string; + organization_id: string; + order_id: string; + subscription_id: string | null; + customer_id: string; + revoke_benefits: boolean; + dispute: { + created_at: string; + modified_at: string | null; + id: string; + status: + | "prevented" + | "early_warning" + | "needs_response" + | "under_review" + | "lost" + | "won"; + resolved: boolean; + closed: boolean; + amount: number; + tax_amount: number; + currency: string; + reason: string | null; + evidence_due_by: string | null; + past_due: boolean; + order_id: string; + payment_id: string; + } | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const RefundslistOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + status: Schema.Literals(["pending", "succeeded", "failed", "canceled"]), + reason: Schema.Literals([ + "duplicate", + "fraudulent", + "customer_request", + "service_disruption", + "satisfaction_guarantee", + "dispute_prevention", + "other", + ]), + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + organization_id: Schema.String, + order_id: Schema.String, + subscription_id: Schema.NullOr(Schema.String), + customer_id: Schema.String, + revoke_benefits: Schema.Boolean, + dispute: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + status: Schema.Literals([ + "prevented", + "early_warning", + "needs_response", + "under_review", + "lost", + "won", + ]), + resolved: Schema.Boolean, + closed: Schema.Boolean, + amount: Schema.Number, + tax_amount: Schema.Number, + currency: Schema.String, + reason: Schema.NullOr(Schema.String), + evidence_due_by: Schema.NullOr(Schema.String), + past_due: Schema.Boolean, + order_id: Schema.String, + payment_id: Schema.String, + }), + ), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), +}) as unknown as Schema.Codec; + +// The operation +/** + * List Refunds + * + * List refunds. + * **Scopes**: `refunds:read` `refunds:write` + * + * @param id - Filter by refund ID. + * @param organization_id - Filter by organization ID. + * @param order_id - Filter by order ID. + * @param subscription_id - Filter by subscription ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by customer external ID. + * @param succeeded - Filter by `succeeded`. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + */ +export const refundslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: RefundslistInput, + outputSchema: RefundslistOutput, +})); diff --git a/packages/polar/src/operations/subscriptionscreate.ts b/packages/polar/src/operations/subscriptionscreate.ts new file mode 100644 index 0000000000..3b0e25e81d --- /dev/null +++ b/packages/polar/src/operations/subscriptionscreate.ts @@ -0,0 +1,1873 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface SubscriptionscreateInput { + metadata?: Record; + product_id: string; + customer_id?: string; + external_customer_id?: string; +} +export const SubscriptionscreateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + metadata: Schema.optional( + Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + product_id: Schema.String, + customer_id: Schema.optional(Schema.String), + external_customer_id: Schema.optional(Schema.String), + }).pipe( + T.Http({ method: "POST", path: "/v1/subscriptions/" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface SubscriptionscreateOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + metadata: Record; + custom_field_data?: Record; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; + }; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const SubscriptionscreateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Subscription + * + * Create a subscription programmatically. + * This endpoint only allows to create subscription on free products. + * For paid products, use the checkout flow. + * No initial order will be created and no confirmation email will be sent. + * **Scopes**: `subscriptions:write` + */ +export const subscriptionscreate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: SubscriptionscreateInput, + outputSchema: SubscriptionscreateOutput, +})); diff --git a/packages/polar/src/operations/subscriptionsexport.ts b/packages/polar/src/operations/subscriptionsexport.ts new file mode 100644 index 0000000000..67ffbbac56 --- /dev/null +++ b/packages/polar/src/operations/subscriptionsexport.ts @@ -0,0 +1,35 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface SubscriptionsexportInput { + organization_id?: string | ReadonlyArray | null; +} +export const SubscriptionsexportInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + }).pipe( + T.Http({ method: "GET", path: "/v1/subscriptions/export" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type SubscriptionsexportOutput = void; +export const SubscriptionsexportOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Export Subscriptions + * + * Export subscriptions as a CSV file. + * **Scopes**: `subscriptions:read` `subscriptions:write` + * + * @param organization_id - Filter by organization ID. + */ +export const subscriptionsexport = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: SubscriptionsexportInput, + outputSchema: SubscriptionsexportOutput, +})); diff --git a/packages/polar/src/operations/subscriptionsget.ts b/packages/polar/src/operations/subscriptionsget.ts new file mode 100644 index 0000000000..8bfbfae065 --- /dev/null +++ b/packages/polar/src/operations/subscriptionsget.ts @@ -0,0 +1,1861 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface SubscriptionsgetInput { + id: string; +} +export const SubscriptionsgetInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), +}).pipe( + T.Http({ method: "GET", path: "/v1/subscriptions/{id}" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface SubscriptionsgetOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + metadata: Record; + custom_field_data?: Record; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; + }; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const SubscriptionsgetOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }, +) as unknown as Schema.Codec; + +// The operation +/** + * Get Subscription + * + * Get a subscription by ID. + * **Scopes**: `subscriptions:read` `subscriptions:write` + * + * @param id - The subscription ID. + */ +export const subscriptionsget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: SubscriptionsgetInput, + outputSchema: SubscriptionsgetOutput, +})); diff --git a/packages/polar/src/operations/subscriptionslist.ts b/packages/polar/src/operations/subscriptionslist.ts new file mode 100644 index 0000000000..5379d08f90 --- /dev/null +++ b/packages/polar/src/operations/subscriptionslist.ts @@ -0,0 +1,1962 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface SubscriptionslistInput { + organization_id?: string | ReadonlyArray | null; + product_id?: string | ReadonlyArray | null; + customer_id?: string | ReadonlyArray | null; + external_customer_id?: string | ReadonlyArray | null; + discount_id?: string | ReadonlyArray | null; + active?: boolean | null; + status?: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused" + | ReadonlyArray< + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused" + > + | null; + cancel_at_period_end?: boolean | null; + customer_cancellation_reason?: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | ReadonlyArray< + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + > + | null; + canceled_at_after?: string | null; + canceled_at_before?: string | null; + page?: number; + limit?: number; + sorting?: ReadonlyArray< + | "customer" + | "-customer" + | "status" + | "-status" + | "started_at" + | "-started_at" + | "current_period_end" + | "-current_period_end" + | "ended_at" + | "-ended_at" + | "ends_at" + | "-ends_at" + | "amount" + | "-amount" + | "product" + | "-product" + | "discount" + | "-discount" + > | null; + metadata?: Record< + string, + | string + | number + | boolean + | ReadonlyArray + | ReadonlyArray + | ReadonlyArray + > | null; +} +export const SubscriptionslistInput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct( + { + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + product_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + external_customer_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + discount_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + active: Schema.optional(Schema.NullOr(Schema.Boolean)), + status: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + Schema.Array( + Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + ), + ]), + ), + ), + cancel_at_period_end: Schema.optional(Schema.NullOr(Schema.Boolean)), + customer_cancellation_reason: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + Schema.Array( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + ]), + ), + ), + canceled_at_after: Schema.optional(Schema.NullOr(Schema.String)), + canceled_at_before: Schema.optional(Schema.NullOr(Schema.String)), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + sorting: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "customer", + "-customer", + "status", + "-status", + "started_at", + "-started_at", + "current_period_end", + "-current_period_end", + "ended_at", + "-ended_at", + "ends_at", + "-ends_at", + "amount", + "-amount", + "product", + "-product", + "discount", + "-discount", + ]), + ), + ), + ), + metadata: Schema.optional( + Schema.NullOr( + Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + Schema.Array(Schema.String), + Schema.Array(Schema.Number), + Schema.Array(Schema.Boolean), + ]), + ), + ), + ), + }, +).pipe( + T.Http({ method: "GET", path: "/v1/subscriptions/" }), +) as unknown as Schema.Codec; + +// Output Schema +export interface SubscriptionslistOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + metadata: Record; + custom_field_data?: Record; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: unknown }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: unknown; + activations: unknown; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; + }; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; + }>; + pagination: { total_count: number; max_page: number }; +} +export const SubscriptionslistOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional( + Schema.NullOr(Schema.String), + ), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array(Schema.Unknown), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Subscriptions + * + * List subscriptions. + * **Scopes**: `subscriptions:read` `subscriptions:write` + * + * @param organization_id - Filter by organization ID. + * @param product_id - Filter by product ID. + * @param customer_id - Filter by customer ID. + * @param external_customer_id - Filter by customer external ID. + * @param discount_id - Filter by discount ID. + * @param active - Filter by active or inactive subscription. + * @param status - Filter by subscription status. + * @param cancel_at_period_end - Filter by subscriptions that are set to cancel at period end. + * @param customer_cancellation_reason - Filter by customer cancellation reason. + * @param canceled_at_after - Filter by cancellation date (after or equal to). + * @param canceled_at_before - Filter by cancellation date (before or equal to). + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + * @param sorting - Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign `-` before the criteria name to sort by descending order. + * @param metadata - Filter by metadata key-value pairs. It uses the `deepObject` style, e.g. `?metadata[key]=value`. + */ +export const subscriptionslist = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: SubscriptionslistInput, + outputSchema: SubscriptionslistOutput, +})); diff --git a/packages/polar/src/operations/subscriptionsrevoke.ts b/packages/polar/src/operations/subscriptionsrevoke.ts new file mode 100644 index 0000000000..307a2cd658 --- /dev/null +++ b/packages/polar/src/operations/subscriptionsrevoke.ts @@ -0,0 +1,1861 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface SubscriptionsrevokeInput { + id: string; +} +export const SubscriptionsrevokeInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/subscriptions/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface SubscriptionsrevokeOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + metadata: Record; + custom_field_data?: Record; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; + }; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const SubscriptionsrevokeOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Revoke Subscription + * + * Revoke a subscription, i.e cancel immediately. + * **Scopes**: `subscriptions:write` + * + * @param id - The subscription ID. + */ +export const subscriptionsrevoke = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: SubscriptionsrevokeInput, + outputSchema: SubscriptionsrevokeOutput, +})); diff --git a/packages/polar/src/operations/subscriptionsupdate.ts b/packages/polar/src/operations/subscriptionsupdate.ts new file mode 100644 index 0000000000..856aa0f23f --- /dev/null +++ b/packages/polar/src/operations/subscriptionsupdate.ts @@ -0,0 +1,1917 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface SubscriptionsupdateInput { + id: string; + product_id?: string | null; + proration_behavior?: "invoice" | "prorate" | "next_period" | "reset" | null; + discount_id?: string | null; + trial_end?: string | null; + seats?: number; + current_billing_period_end?: string; + customer_cancellation_reason?: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment?: string | null; + cancel_at_period_end?: boolean; + revoke?: boolean; + pause_at_period_end?: boolean; + resumes_at?: string | null; + resume?: boolean; + pending_update?: unknown; +} +export const SubscriptionsupdateInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + product_id: Schema.optional(Schema.NullOr(Schema.String)), + proration_behavior: Schema.optional( + Schema.NullOr( + Schema.Literals(["invoice", "prorate", "next_period", "reset"]), + ), + ), + discount_id: Schema.optional(Schema.NullOr(Schema.String)), + trial_end: Schema.optional(Schema.NullOr(Schema.String)), + seats: Schema.optional(Schema.Number), + current_billing_period_end: Schema.optional(Schema.String), + customer_cancellation_reason: Schema.optional( + Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + ), + customer_cancellation_comment: Schema.optional( + Schema.NullOr(Schema.String), + ), + cancel_at_period_end: Schema.optional(Schema.Boolean), + revoke: Schema.optional(Schema.Boolean), + pause_at_period_end: Schema.optional(Schema.Boolean), + resumes_at: Schema.optional(Schema.NullOr(Schema.String)), + resume: Schema.optional(Schema.Boolean), + pending_update: Schema.optional(Schema.Unknown), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/subscriptions/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface SubscriptionsupdateOutput { + created_at: string; + modified_at: string | null; + id: string; + amount: number; + currency: string; + recurring_interval: "day" | "week" | "month" | "year"; + recurring_interval_count: number; + status: + | "incomplete" + | "incomplete_expired" + | "trialing" + | "active" + | "past_due" + | "canceled" + | "unpaid" + | "paused"; + current_period_start: string; + current_period_end: string; + current_meter_period_start: string | null; + current_meter_period_end: string | null; + trial_start: string | null; + trial_end: string | null; + cancel_at_period_end: boolean; + canceled_at: string | null; + started_at: string | null; + ends_at: string | null; + ended_at: string | null; + past_due_at?: string | null; + pause_at_period_end: boolean; + paused_at: string | null; + resumes_at: string | null; + customer_id: string; + product_id: string; + discount_id: string | null; + checkout_id: string | null; + seats?: number | null; + customer_cancellation_reason: + | "customer_service" + | "low_quality" + | "missing_features" + | "switched_service" + | "too_complex" + | "too_expensive" + | "unused" + | "other" + | null; + customer_cancellation_comment: string | null; + metadata: Record; + custom_field_data?: Record; + customer: { + id: string; + created_at: string; + modified_at: string | null; + metadata: Record; + external_id?: string | null; + email?: string | null; + email_verified: boolean; + type: "individual" | "team"; + name: string | null; + billing_name: string | null; + billing_address: { + line1?: string | null; + line2?: string | null; + postal_code?: string | null; + city?: string | null; + state?: string | null; + country: + | "AD" + | "AE" + | "AF" + | "AG" + | "AI" + | "AL" + | "AM" + | "AO" + | "AQ" + | "AR" + | "AS" + | "AT" + | "AU" + | "AW" + | "AX" + | "AZ" + | "BA" + | "BB" + | "BD" + | "BE" + | "BF" + | "BG" + | "BH" + | "BI" + | "BJ" + | "BL" + | "BM" + | "BN" + | "BO" + | "BQ" + | "BR" + | "BS" + | "BT" + | "BV" + | "BW" + | "BY" + | "BZ" + | "CA" + | "CC" + | "CD" + | "CF" + | "CG" + | "CH" + | "CI" + | "CK" + | "CL" + | "CM" + | "CN" + | "CO" + | "CR" + | "CU" + | "CV" + | "CW" + | "CX" + | "CY" + | "CZ" + | "DE" + | "DJ" + | "DK" + | "DM" + | "DO" + | "DZ" + | "EC" + | "EE" + | "EG" + | "EH" + | "ER" + | "ES" + | "ET" + | "FI" + | "FJ" + | "FK" + | "FM" + | "FO" + | "FR" + | "GA" + | "GB" + | "GD" + | "GE" + | "GF" + | "GG" + | "GH" + | "GI" + | "GL" + | "GM" + | "GN" + | "GP" + | "GQ" + | "GR" + | "GS" + | "GT" + | "GU" + | "GW" + | "GY" + | "HK" + | "HM" + | "HN" + | "HR" + | "HT" + | "HU" + | "ID" + | "IE" + | "IL" + | "IM" + | "IN" + | "IO" + | "IQ" + | "IR" + | "IS" + | "IT" + | "JE" + | "JM" + | "JO" + | "JP" + | "KE" + | "KG" + | "KH" + | "KI" + | "KM" + | "KN" + | "KP" + | "KR" + | "KW" + | "KY" + | "KZ" + | "LA" + | "LB" + | "LC" + | "LI" + | "LK" + | "LR" + | "LS" + | "LT" + | "LU" + | "LV" + | "LY" + | "MA" + | "MC" + | "MD" + | "ME" + | "MF" + | "MG" + | "MH" + | "MK" + | "ML" + | "MM" + | "MN" + | "MO" + | "MP" + | "MQ" + | "MR" + | "MS" + | "MT" + | "MU" + | "MV" + | "MW" + | "MX" + | "MY" + | "MZ" + | "NA" + | "NC" + | "NE" + | "NF" + | "NG" + | "NI" + | "NL" + | "NO" + | "NP" + | "NR" + | "NU" + | "NZ" + | "OM" + | "PA" + | "PE" + | "PF" + | "PG" + | "PH" + | "PK" + | "PL" + | "PM" + | "PN" + | "PR" + | "PS" + | "PT" + | "PW" + | "PY" + | "QA" + | "RE" + | "RO" + | "RS" + | "RU" + | "RW" + | "SA" + | "SB" + | "SC" + | "SD" + | "SE" + | "SG" + | "SH" + | "SI" + | "SJ" + | "SK" + | "SL" + | "SM" + | "SN" + | "SO" + | "SR" + | "SS" + | "ST" + | "SV" + | "SX" + | "SY" + | "SZ" + | "TC" + | "TD" + | "TF" + | "TG" + | "TH" + | "TJ" + | "TK" + | "TL" + | "TM" + | "TN" + | "TO" + | "TR" + | "TT" + | "TV" + | "TW" + | "TZ" + | "UA" + | "UG" + | "UM" + | "US" + | "UY" + | "UZ" + | "VA" + | "VC" + | "VE" + | "VG" + | "VI" + | "VN" + | "VU" + | "WF" + | "WS" + | "YE" + | "YT" + | "ZA" + | "ZM" + | "ZW"; + } | null; + tax_id: ReadonlyArray | null; + locale?: string | null; + organization_id: string; + default_payment_method_id?: string | null; + deleted_at: string | null; + avatar_url: string | null; + }; + product: { + id: string; + created_at: string; + modified_at: string | null; + trial_interval: "day" | "week" | "month" | "year" | null; + trial_interval_count: number | null; + name: string; + description: string | null; + visibility: "draft" | "private" | "public"; + recurring_interval: "day" | "week" | "month" | "year" | null; + recurring_interval_count: number | null; + meter_interval: "day" | "week" | "month" | "year" | null; + meter_interval_count: number | null; + is_recurring: boolean; + is_archived: boolean; + organization_id: string; + metadata: Record; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + benefits: ReadonlyArray< + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { note: string | null | null }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + guild_id: string; + role_id: string; + kick_member: boolean; + guild_token: string; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + repository_owner: string; + repository_name: string; + permission: "pull" | "triage" | "push" | "maintain" | "admin"; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + archived: Record; + files: ReadonlyArray; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + prefix: string | null; + expires: { + ttl: number; + timeframe: "year" | "month" | "day"; + } | null; + activations: { + limit: number; + enable_customer_admin: boolean; + } | null; + limit_usage: number | null; + }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { units: number; rollover: boolean; meter_id: string }; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: {}; + visibility_configurable: boolean; + } + | { + id: string; + created_at: string; + modified_at: string | null; + type: string; + description: string; + selectable: boolean; + deletable: boolean; + is_deleted: boolean; + organization_id: string; + metadata: Record; + visibility: "draft" | "private" | "public"; + properties: { + slack_integration_id: string; + channel_name_template: string; + private?: boolean; + welcome_message?: string | null; + archive_on_revoke?: boolean; + team_invitees?: ReadonlyArray; + }; + visibility_configurable: boolean; + } + >; + medias: ReadonlyArray<{ + id: string; + organization_id: string; + name: string; + path: string; + mime_type: string; + size: number; + storage_version: string | null; + checksum_etag: string | null; + checksum_sha256_base64: string | null; + checksum_sha256_hex: string | null; + last_modified_at: string | null; + version: string | null; + service: string; + is_uploaded: boolean; + created_at: string; + size_readable: string; + public_url: string; + }>; + attached_custom_fields: ReadonlyArray<{ + custom_field_id: string; + custom_field: + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + textarea?: boolean; + min_length?: number; + max_length?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + ge?: number; + le?: number; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + type: string; + slug: string; + name: string; + organization_id: string; + properties: { + form_label?: string; + form_help_text?: string; + form_placeholder?: string; + options: ReadonlyArray<{ value: string; label: string }>; + }; + }; + order: number; + required: boolean; + }>; + }; + discount: + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + amount: number; + currency: string; + amounts: Record; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | { + duration: "once" | "forever" | "repeating"; + duration_in_months: number; + type: "fixed" | "percentage"; + basis_points: number; + created_at: string; + modified_at: string | null; + id: string; + metadata: Record; + name: string; + code: string | null; + starts_at: string | null; + ends_at: string | null; + max_redemptions: number | null; + redemptions_count: number; + organization_id: string; + } + | null; + prices: ReadonlyArray< + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + price_amount: number; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + type: string; + recurring_interval: "day" | "week" | "month" | "year"; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + legacy: boolean; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + price_amount: number; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + minimum_amount: number; + maximum_amount: number | null; + preset_amount: number | null; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + seat_tiers: { + seat_tier_type?: "volume" | "graduated"; + tiers: ReadonlyArray<{ + min_seats: number; + max_seats?: number | null; + price_per_seat: number; + }>; + minimum_seats: number; + maximum_seats: number | null; + }; + } + | { + created_at: string; + modified_at: string | null; + id: string; + source: "catalog" | "ad_hoc"; + amount_type: string; + price_currency: string; + tax_behavior: "location" | "inclusive" | "exclusive" | null; + is_archived: boolean; + product_id: string; + unit_amount: string; + cap_amount: number | null; + meter_id: string; + meter: { + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label: string | null; + custom_multiplier: number | null; + }; + } + >; + meters: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + consumed_units: number; + credited_units: number; + amount: number; + meter_id: string; + meter: { + metadata: Record; + created_at: string; + modified_at: string | null; + id: string; + name: string; + unit: "scalar" | "token" | "custom"; + custom_label?: string | null; + custom_multiplier?: number | null; + filter: { + conjunction: "and" | "or"; + clauses: ReadonlyArray< + | { + property: string; + operator: + | "eq" + | "ne" + | "gt" + | "gte" + | "lt" + | "lte" + | "like" + | "not_like"; + value: string | number | boolean; + } + | unknown + >; + }; + aggregation: + | { func?: string } + | { func: "sum" | "max" | "min" | "avg"; property: string } + | { func?: string; property: string }; + organization_id: string; + archived_at?: string | null; + }; + }>; + pending_update: { + created_at: string; + modified_at: string | null; + id: string; + applies_at: string; + product_id: string | null; + seats: number | null; + } | null; +} +export const SubscriptionsupdateOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + amount: Schema.Number, + currency: Schema.String, + recurring_interval: Schema.Literals(["day", "week", "month", "year"]), + recurring_interval_count: Schema.Number, + status: Schema.Literals([ + "incomplete", + "incomplete_expired", + "trialing", + "active", + "past_due", + "canceled", + "unpaid", + "paused", + ]), + current_period_start: Schema.String, + current_period_end: Schema.String, + current_meter_period_start: Schema.NullOr(Schema.String), + current_meter_period_end: Schema.NullOr(Schema.String), + trial_start: Schema.NullOr(Schema.String), + trial_end: Schema.NullOr(Schema.String), + cancel_at_period_end: Schema.Boolean, + canceled_at: Schema.NullOr(Schema.String), + started_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + ended_at: Schema.NullOr(Schema.String), + past_due_at: Schema.optional(Schema.NullOr(Schema.String)), + pause_at_period_end: Schema.Boolean, + paused_at: Schema.NullOr(Schema.String), + resumes_at: Schema.NullOr(Schema.String), + customer_id: Schema.String, + product_id: Schema.String, + discount_id: Schema.NullOr(Schema.String), + checkout_id: Schema.NullOr(Schema.String), + seats: Schema.optional(Schema.NullOr(Schema.Number)), + customer_cancellation_reason: Schema.NullOr( + Schema.Literals([ + "customer_service", + "low_quality", + "missing_features", + "switched_service", + "too_complex", + "too_expensive", + "unused", + "other", + ]), + ), + customer_cancellation_comment: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + custom_field_data: Schema.optional( + Schema.Record( + Schema.String, + Schema.NullOr( + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + ), + ), + customer: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + external_id: Schema.optional(Schema.NullOr(Schema.String)), + email: Schema.optional(Schema.NullOr(Schema.String)), + email_verified: Schema.Boolean, + type: Schema.Literals(["individual", "team"]), + name: Schema.NullOr(Schema.String), + billing_name: Schema.NullOr(Schema.String), + billing_address: Schema.NullOr( + Schema.Struct({ + line1: Schema.optional(Schema.NullOr(Schema.String)), + line2: Schema.optional(Schema.NullOr(Schema.String)), + postal_code: Schema.optional(Schema.NullOr(Schema.String)), + city: Schema.optional(Schema.NullOr(Schema.String)), + state: Schema.optional(Schema.NullOr(Schema.String)), + country: Schema.Literals([ + "AD", + "AE", + "AF", + "AG", + "AI", + "AL", + "AM", + "AO", + "AQ", + "AR", + "AS", + "AT", + "AU", + "AW", + "AX", + "AZ", + "BA", + "BB", + "BD", + "BE", + "BF", + "BG", + "BH", + "BI", + "BJ", + "BL", + "BM", + "BN", + "BO", + "BQ", + "BR", + "BS", + "BT", + "BV", + "BW", + "BY", + "BZ", + "CA", + "CC", + "CD", + "CF", + "CG", + "CH", + "CI", + "CK", + "CL", + "CM", + "CN", + "CO", + "CR", + "CU", + "CV", + "CW", + "CX", + "CY", + "CZ", + "DE", + "DJ", + "DK", + "DM", + "DO", + "DZ", + "EC", + "EE", + "EG", + "EH", + "ER", + "ES", + "ET", + "FI", + "FJ", + "FK", + "FM", + "FO", + "FR", + "GA", + "GB", + "GD", + "GE", + "GF", + "GG", + "GH", + "GI", + "GL", + "GM", + "GN", + "GP", + "GQ", + "GR", + "GS", + "GT", + "GU", + "GW", + "GY", + "HK", + "HM", + "HN", + "HR", + "HT", + "HU", + "ID", + "IE", + "IL", + "IM", + "IN", + "IO", + "IQ", + "IR", + "IS", + "IT", + "JE", + "JM", + "JO", + "JP", + "KE", + "KG", + "KH", + "KI", + "KM", + "KN", + "KP", + "KR", + "KW", + "KY", + "KZ", + "LA", + "LB", + "LC", + "LI", + "LK", + "LR", + "LS", + "LT", + "LU", + "LV", + "LY", + "MA", + "MC", + "MD", + "ME", + "MF", + "MG", + "MH", + "MK", + "ML", + "MM", + "MN", + "MO", + "MP", + "MQ", + "MR", + "MS", + "MT", + "MU", + "MV", + "MW", + "MX", + "MY", + "MZ", + "NA", + "NC", + "NE", + "NF", + "NG", + "NI", + "NL", + "NO", + "NP", + "NR", + "NU", + "NZ", + "OM", + "PA", + "PE", + "PF", + "PG", + "PH", + "PK", + "PL", + "PM", + "PN", + "PR", + "PS", + "PT", + "PW", + "PY", + "QA", + "RE", + "RO", + "RS", + "RU", + "RW", + "SA", + "SB", + "SC", + "SD", + "SE", + "SG", + "SH", + "SI", + "SJ", + "SK", + "SL", + "SM", + "SN", + "SO", + "SR", + "SS", + "ST", + "SV", + "SX", + "SY", + "SZ", + "TC", + "TD", + "TF", + "TG", + "TH", + "TJ", + "TK", + "TL", + "TM", + "TN", + "TO", + "TR", + "TT", + "TV", + "TW", + "TZ", + "UA", + "UG", + "UM", + "US", + "UY", + "UZ", + "VA", + "VC", + "VE", + "VG", + "VI", + "VN", + "VU", + "WF", + "WS", + "YE", + "YT", + "ZA", + "ZM", + "ZW", + ]), + }), + ), + tax_id: Schema.NullOr(Schema.Array(Schema.Unknown)), + locale: Schema.optional(Schema.NullOr(Schema.String)), + organization_id: Schema.String, + default_payment_method_id: Schema.optional(Schema.NullOr(Schema.String)), + deleted_at: Schema.NullOr(Schema.String), + avatar_url: Schema.NullOr(Schema.String), + }), + product: Schema.Struct({ + id: Schema.String, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + trial_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + trial_interval_count: Schema.NullOr(Schema.Number), + name: Schema.String, + description: Schema.NullOr(Schema.String), + visibility: Schema.Literals(["draft", "private", "public"]), + recurring_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + recurring_interval_count: Schema.NullOr(Schema.Number), + meter_interval: Schema.NullOr( + Schema.Literals(["day", "week", "month", "year"]), + ), + meter_interval_count: Schema.NullOr(Schema.Number), + is_recurring: Schema.Boolean, + is_archived: Schema.Boolean, + organization_id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + benefits: Schema.Array(Schema.Unknown), + medias: Schema.Array( + Schema.Struct({ + id: Schema.String, + organization_id: Schema.String, + name: Schema.String, + path: Schema.String, + mime_type: Schema.String, + size: Schema.Number, + storage_version: Schema.NullOr(Schema.String), + checksum_etag: Schema.NullOr(Schema.String), + checksum_sha256_base64: Schema.NullOr(Schema.String), + checksum_sha256_hex: Schema.NullOr(Schema.String), + last_modified_at: Schema.NullOr(Schema.String), + version: Schema.NullOr(Schema.String), + service: Schema.String, + is_uploaded: Schema.Boolean, + created_at: Schema.String, + size_readable: Schema.String, + public_url: Schema.String, + }), + ), + attached_custom_fields: Schema.Array( + Schema.Struct({ + custom_field_id: Schema.String, + custom_field: Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + textarea: Schema.optional(Schema.Boolean), + min_length: Schema.optional(Schema.Number), + max_length: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + ge: Schema.optional(Schema.Number), + le: Schema.optional(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + type: Schema.String, + slug: Schema.String, + name: Schema.String, + organization_id: Schema.String, + properties: Schema.Struct({ + form_label: Schema.optional(Schema.String), + form_help_text: Schema.optional(Schema.String), + form_placeholder: Schema.optional(Schema.String), + options: Schema.Array( + Schema.Struct({ + value: Schema.String, + label: Schema.String, + }), + ), + }), + }), + ]), + order: Schema.Number, + required: Schema.Boolean, + }), + ), + }), + discount: Schema.NullOr( + Schema.Union([ + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + amount: Schema.Number, + currency: Schema.String, + amounts: Schema.Record(Schema.String, Schema.Number), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + Schema.Struct({ + duration: Schema.Literals(["once", "forever", "repeating"]), + duration_in_months: Schema.Number, + type: Schema.Literals(["fixed", "percentage"]), + basis_points: Schema.Number, + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + name: Schema.String, + code: Schema.NullOr(Schema.String), + starts_at: Schema.NullOr(Schema.String), + ends_at: Schema.NullOr(Schema.String), + max_redemptions: Schema.NullOr(Schema.Number), + redemptions_count: Schema.Number, + organization_id: Schema.String, + }), + ]), + ), + prices: Schema.Array( + Schema.Union([ + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + price_amount: Schema.Number, + legacy: Schema.Boolean, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + type: Schema.String, + recurring_interval: Schema.Literals([ + "day", + "week", + "month", + "year", + ]), + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + legacy: Schema.Boolean, + }), + ]), + Schema.Union([ + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + price_amount: Schema.Number, + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + minimum_amount: Schema.Number, + maximum_amount: Schema.NullOr(Schema.Number), + preset_amount: Schema.NullOr(Schema.Number), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + seat_tiers: Schema.Struct({ + seat_tier_type: Schema.optional( + Schema.Literals(["volume", "graduated"]), + ), + tiers: Schema.Array( + Schema.Struct({ + min_seats: Schema.Number, + max_seats: Schema.optional(Schema.NullOr(Schema.Number)), + price_per_seat: Schema.Number, + }), + ), + minimum_seats: Schema.Number, + maximum_seats: Schema.NullOr(Schema.Number), + }), + }), + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + source: Schema.Literals(["catalog", "ad_hoc"]), + amount_type: Schema.String, + price_currency: Schema.String, + tax_behavior: Schema.NullOr( + Schema.Literals(["location", "inclusive", "exclusive"]), + ), + is_archived: Schema.Boolean, + product_id: Schema.String, + unit_amount: Schema.String, + cap_amount: Schema.NullOr(Schema.Number), + meter_id: Schema.String, + meter: Schema.Struct({ + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.NullOr(Schema.String), + custom_multiplier: Schema.NullOr(Schema.Number), + }), + }), + ]), + ]), + ), + meters: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + consumed_units: Schema.Number, + credited_units: Schema.Number, + amount: Schema.Number, + meter_id: Schema.String, + meter: Schema.Struct({ + metadata: Schema.Record( + Schema.String, + Schema.Union([Schema.String, Schema.Number, Schema.Boolean]), + ), + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + name: Schema.String, + unit: Schema.Literals(["scalar", "token", "custom"]), + custom_label: Schema.optional(Schema.NullOr(Schema.String)), + custom_multiplier: Schema.optional(Schema.NullOr(Schema.Number)), + filter: Schema.Struct({ + conjunction: Schema.Literals(["and", "or"]), + clauses: Schema.Array( + Schema.Union([ + Schema.Struct({ + property: Schema.String, + operator: Schema.Literals([ + "eq", + "ne", + "gt", + "gte", + "lt", + "lte", + "like", + "not_like", + ]), + value: Schema.Union([ + Schema.String, + Schema.Number, + Schema.Boolean, + ]), + }), + Schema.Unknown, + ]), + ), + }), + aggregation: Schema.Union([ + Schema.Struct({ + func: Schema.optional(Schema.String), + }), + Schema.Struct({ + func: Schema.Literals(["sum", "max", "min", "avg"]), + property: Schema.String, + }), + Schema.Struct({ + func: Schema.optional(Schema.String), + property: Schema.String, + }), + ]), + organization_id: Schema.String, + archived_at: Schema.optional(Schema.NullOr(Schema.String)), + }), + }), + ), + pending_update: Schema.NullOr( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + applies_at: Schema.String, + product_id: Schema.NullOr(Schema.String), + seats: Schema.NullOr(Schema.Number), + }), + ), + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Subscription + * + * Update a subscription. + * **Scopes**: `subscriptions:write` + * + * @param id - The subscription ID. + */ +export const subscriptionsupdate = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: SubscriptionsupdateInput, + outputSchema: SubscriptionsupdateOutput, +})); diff --git a/packages/polar/src/operations/webhookscreateWebhookEndpoint.ts b/packages/polar/src/operations/webhookscreateWebhookEndpoint.ts new file mode 100644 index 0000000000..ff99c897e3 --- /dev/null +++ b/packages/polar/src/operations/webhookscreateWebhookEndpoint.ts @@ -0,0 +1,220 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface WebhookscreateWebhookEndpointInput { + url: string; + name?: string | null; + format: "raw" | "discord" | "slack"; + events: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + >; + organization_id?: string | null; +} +export const WebhookscreateWebhookEndpointInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + url: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.Literals(["raw", "discord", "slack"]), + events: Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + organization_id: Schema.optional(Schema.NullOr(Schema.String)), + }).pipe( + T.Http({ method: "POST", path: "/v1/webhooks/endpoints" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface WebhookscreateWebhookEndpointOutput { + created_at: string; + modified_at: string | null; + id: string; + url: string; + name?: string | null; + format: "raw" | "discord" | "slack"; + secret: Redacted.Redacted; + organization_id: string; + events: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + >; + enabled: boolean; +} +export const WebhookscreateWebhookEndpointOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + url: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.Literals(["raw", "discord", "slack"]), + secret: SensitiveOutputString, + organization_id: Schema.String, + events: Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + enabled: Schema.Boolean, + }) as unknown as Schema.Codec; + +// The operation +/** + * Create Webhook Endpoint + * + * Create a webhook endpoint. + * **Scopes**: `webhooks:write` + */ +export const webhookscreateWebhookEndpoint = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhookscreateWebhookEndpointInput, + outputSchema: WebhookscreateWebhookEndpointOutput, + })); diff --git a/packages/polar/src/operations/webhooksdeleteWebhookEndpoint.ts b/packages/polar/src/operations/webhooksdeleteWebhookEndpoint.ts new file mode 100644 index 0000000000..e27c5f378f --- /dev/null +++ b/packages/polar/src/operations/webhooksdeleteWebhookEndpoint.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface WebhooksdeleteWebhookEndpointInput { + id: string; +} +export const WebhooksdeleteWebhookEndpointInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "DELETE", path: "/v1/webhooks/endpoints/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type WebhooksdeleteWebhookEndpointOutput = void; +export const WebhooksdeleteWebhookEndpointOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Delete Webhook Endpoint + * + * Delete a webhook endpoint. + * **Scopes**: `webhooks:write` + * + * @param id - The webhook endpoint ID. + */ +export const webhooksdeleteWebhookEndpoint = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhooksdeleteWebhookEndpointInput, + outputSchema: WebhooksdeleteWebhookEndpointOutput, + })); diff --git a/packages/polar/src/operations/webhooksgetWebhookEndpoint.ts b/packages/polar/src/operations/webhooksgetWebhookEndpoint.ts new file mode 100644 index 0000000000..43cb28809c --- /dev/null +++ b/packages/polar/src/operations/webhooksgetWebhookEndpoint.ts @@ -0,0 +1,137 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface WebhooksgetWebhookEndpointInput { + id: string; +} +export const WebhooksgetWebhookEndpointInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "GET", path: "/v1/webhooks/endpoints/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface WebhooksgetWebhookEndpointOutput { + created_at: string; + modified_at: string | null; + id: string; + url: string; + name?: string | null; + format: "raw" | "discord" | "slack"; + secret: Redacted.Redacted; + organization_id: string; + events: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + >; + enabled: boolean; +} +export const WebhooksgetWebhookEndpointOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + url: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.Literals(["raw", "discord", "slack"]), + secret: SensitiveOutputString, + organization_id: Schema.String, + events: Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + enabled: Schema.Boolean, + }) as unknown as Schema.Codec; + +// The operation +/** + * Get Webhook Endpoint + * + * Get a webhook endpoint by ID. + * **Scopes**: `webhooks:read` `webhooks:write` + * + * @param id - The webhook endpoint ID. + */ +export const webhooksgetWebhookEndpoint = /*@__PURE__*/ /*#__PURE__*/ API.make( + () => ({ + inputSchema: WebhooksgetWebhookEndpointInput, + outputSchema: WebhooksgetWebhookEndpointOutput, + }), +); diff --git a/packages/polar/src/operations/webhookslistWebhookDeliveries.ts b/packages/polar/src/operations/webhookslistWebhookDeliveries.ts new file mode 100644 index 0000000000..5ba3e48d56 --- /dev/null +++ b/packages/polar/src/operations/webhookslistWebhookDeliveries.ts @@ -0,0 +1,347 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface WebhookslistWebhookDeliveriesInput { + endpoint_id?: string | ReadonlyArray | null; + start_timestamp?: string | null; + end_timestamp?: string | null; + succeeded?: boolean | null; + query?: string | null; + http_code_class?: "2xx" | "3xx" | "4xx" | "5xx" | null; + event_type?: + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + | ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + > + | null; + page?: number; + limit?: number; +} +export const WebhookslistWebhookDeliveriesInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + endpoint_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + start_timestamp: Schema.optional(Schema.NullOr(Schema.String)), + end_timestamp: Schema.optional(Schema.NullOr(Schema.String)), + succeeded: Schema.optional(Schema.NullOr(Schema.Boolean)), + query: Schema.optional(Schema.NullOr(Schema.String)), + http_code_class: Schema.optional( + Schema.NullOr(Schema.Literals(["2xx", "3xx", "4xx", "5xx"])), + ), + event_type: Schema.optional( + Schema.NullOr( + Schema.Union([ + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + ]), + ), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/webhooks/deliveries" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface WebhookslistWebhookDeliveriesOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + succeeded: boolean; + http_code: number | null; + response: string | null; + webhook_event: { + created_at: string; + modified_at: string | null; + id: string; + last_http_code?: number | null; + succeeded?: boolean | null; + skipped: boolean; + payload: string | null; + type: + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated"; + is_archived: boolean; + }; + }>; + pagination: { total_count: number; max_page: number }; +} +export const WebhookslistWebhookDeliveriesOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + succeeded: Schema.Boolean, + http_code: Schema.NullOr(Schema.Number), + response: Schema.NullOr(Schema.String), + webhook_event: Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + last_http_code: Schema.optional(Schema.NullOr(Schema.Number)), + succeeded: Schema.optional(Schema.NullOr(Schema.Boolean)), + skipped: Schema.Boolean, + payload: Schema.NullOr(Schema.String), + type: Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + is_archived: Schema.Boolean, + }), + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Webhook Deliveries + * + * List webhook deliveries. + * Deliveries are all the attempts to deliver a webhook event to an endpoint. + * **Scopes**: `webhooks:read` `webhooks:write` + * + * @param endpoint_id - Filter by webhook endpoint ID. + * @param start_timestamp - Filter deliveries after this timestamp. + * @param end_timestamp - Filter deliveries before this timestamp. + * @param succeeded - Filter by delivery success status. + * @param query - Query to filter webhook deliveries. + * @param http_code_class - Filter by HTTP response code class (2xx, 3xx, 4xx, 5xx). + * @param event_type - Filter by webhook event type. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const webhookslistWebhookDeliveries = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhookslistWebhookDeliveriesInput, + outputSchema: WebhookslistWebhookDeliveriesOutput, + })); diff --git a/packages/polar/src/operations/webhookslistWebhookEndpoints.ts b/packages/polar/src/operations/webhookslistWebhookEndpoints.ts new file mode 100644 index 0000000000..8f05a47af6 --- /dev/null +++ b/packages/polar/src/operations/webhookslistWebhookEndpoints.ts @@ -0,0 +1,155 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface WebhookslistWebhookEndpointsInput { + organization_id?: string | ReadonlyArray | null; + page?: number; + limit?: number; +} +export const WebhookslistWebhookEndpointsInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + organization_id: Schema.optional( + Schema.NullOr(Schema.Union([Schema.String, Schema.Array(Schema.String)])), + ), + page: Schema.optional(Schema.Number), + limit: Schema.optional(Schema.Number), + }).pipe( + T.Http({ method: "GET", path: "/v1/webhooks/endpoints" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface WebhookslistWebhookEndpointsOutput { + items: ReadonlyArray<{ + created_at: string; + modified_at: string | null; + id: string; + url: string; + name?: string | null; + format: "raw" | "discord" | "slack"; + secret: Redacted.Redacted; + organization_id: string; + events: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + >; + enabled: boolean; + }>; + pagination: { total_count: number; max_page: number }; +} +export const WebhookslistWebhookEndpointsOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + items: Schema.Array( + Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + url: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.Literals(["raw", "discord", "slack"]), + secret: SensitiveOutputString, + organization_id: Schema.String, + events: Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + enabled: Schema.Boolean, + }), + ), + pagination: Schema.Struct({ + total_count: Schema.Number, + max_page: Schema.Number, + }), + }) as unknown as Schema.Codec; + +// The operation +/** + * List Webhook Endpoints + * + * List webhook endpoints. + * **Scopes**: `webhooks:read` `webhooks:write` + * + * @param organization_id - Filter by organization ID. + * @param page - Page number, defaults to 1. + * @param limit - Size of a page, defaults to 10. Maximum is 100. + */ +export const webhookslistWebhookEndpoints = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhookslistWebhookEndpointsInput, + outputSchema: WebhookslistWebhookEndpointsOutput, + })); diff --git a/packages/polar/src/operations/webhooksredeliverWebhookEvent.ts b/packages/polar/src/operations/webhooksredeliverWebhookEvent.ts new file mode 100644 index 0000000000..3871650ad8 --- /dev/null +++ b/packages/polar/src/operations/webhooksredeliverWebhookEvent.ts @@ -0,0 +1,34 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; + +// Input Schema +export interface WebhooksredeliverWebhookEventInput { + id: string; +} +export const WebhooksredeliverWebhookEventInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "POST", path: "/v1/webhooks/events/{id}/redeliver" }), + ) as unknown as Schema.Codec; + +// Output Schema +export type WebhooksredeliverWebhookEventOutput = void; +export const WebhooksredeliverWebhookEventOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Void as unknown as Schema.Codec; + +// The operation +/** + * Redeliver Webhook Event + * + * Schedule the re-delivery of a webhook event. + * **Scopes**: `webhooks:write` + * + * @param id - The webhook event ID. + */ +export const webhooksredeliverWebhookEvent = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhooksredeliverWebhookEventInput, + outputSchema: WebhooksredeliverWebhookEventOutput, + })); diff --git a/packages/polar/src/operations/webhooksresetWebhookEndpointSecret.ts b/packages/polar/src/operations/webhooksresetWebhookEndpointSecret.ts new file mode 100644 index 0000000000..3a1a3e040e --- /dev/null +++ b/packages/polar/src/operations/webhooksresetWebhookEndpointSecret.ts @@ -0,0 +1,136 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface WebhooksresetWebhookEndpointSecretInput { + id: string; +} +export const WebhooksresetWebhookEndpointSecretInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/webhooks/endpoints/{id}/secret" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface WebhooksresetWebhookEndpointSecretOutput { + created_at: string; + modified_at: string | null; + id: string; + url: string; + name?: string | null; + format: "raw" | "discord" | "slack"; + secret: Redacted.Redacted; + organization_id: string; + events: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + >; + enabled: boolean; +} +export const WebhooksresetWebhookEndpointSecretOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + url: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.Literals(["raw", "discord", "slack"]), + secret: SensitiveOutputString, + organization_id: Schema.String, + events: Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + enabled: Schema.Boolean, + }) as unknown as Schema.Codec; + +// The operation +/** + * Reset Webhook Endpoint Secret + * + * Regenerate a webhook endpoint secret. + * **Scopes**: `webhooks:write` + * + * @param id - The webhook endpoint ID. + */ +export const webhooksresetWebhookEndpointSecret = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhooksresetWebhookEndpointSecretInput, + outputSchema: WebhooksresetWebhookEndpointSecretOutput, + })); diff --git a/packages/polar/src/operations/webhooksupdateWebhookEndpoint.ts b/packages/polar/src/operations/webhooksupdateWebhookEndpoint.ts new file mode 100644 index 0000000000..9e345605a3 --- /dev/null +++ b/packages/polar/src/operations/webhooksupdateWebhookEndpoint.ts @@ -0,0 +1,230 @@ +import * as Schema from "effect/Schema"; +import { API } from "../client.ts"; +import * as T from "../traits.ts"; +import { SensitiveOutputString } from "../sensitive.ts"; +import * as Redacted from "effect/Redacted"; + +// Input Schema +export interface WebhooksupdateWebhookEndpointInput { + id: string; + url?: string | null; + name?: string | null; + format?: "raw" | "discord" | "slack" | null; + events?: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + > | null; + enabled?: boolean | null; +} +export const WebhooksupdateWebhookEndpointInput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + id: Schema.String.pipe(T.PathParam()), + url: Schema.optional(Schema.NullOr(Schema.String)), + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.optional( + Schema.NullOr(Schema.Literals(["raw", "discord", "slack"])), + ), + events: Schema.optional( + Schema.NullOr( + Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + ), + ), + enabled: Schema.optional(Schema.NullOr(Schema.Boolean)), + }).pipe( + T.Http({ method: "PATCH", path: "/v1/webhooks/endpoints/{id}" }), + ) as unknown as Schema.Codec; + +// Output Schema +export interface WebhooksupdateWebhookEndpointOutput { + created_at: string; + modified_at: string | null; + id: string; + url: string; + name?: string | null; + format: "raw" | "discord" | "slack"; + secret: Redacted.Redacted; + organization_id: string; + events: ReadonlyArray< + | "checkout.created" + | "checkout.updated" + | "checkout.expired" + | "customer.created" + | "customer.updated" + | "customer.deleted" + | "customer.state_changed" + | "customer_seat.assigned" + | "customer_seat.claimed" + | "customer_seat.revoked" + | "member.created" + | "member.updated" + | "member.deleted" + | "order.created" + | "order.updated" + | "order.paid" + | "order.refunded" + | "subscription.created" + | "subscription.updated" + | "subscription.active" + | "subscription.canceled" + | "subscription.uncanceled" + | "subscription.revoked" + | "subscription.past_due" + | "subscription.paused" + | "subscription.resumed" + | "refund.created" + | "refund.updated" + | "product.created" + | "product.updated" + | "benefit.created" + | "benefit.updated" + | "benefit_grant.created" + | "benefit_grant.cycled" + | "benefit_grant.updated" + | "benefit_grant.revoked" + | "organization.updated" + >; + enabled: boolean; +} +export const WebhooksupdateWebhookEndpointOutput = + /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({ + created_at: Schema.String, + modified_at: Schema.NullOr(Schema.String), + id: Schema.String, + url: Schema.String, + name: Schema.optional(Schema.NullOr(Schema.String)), + format: Schema.Literals(["raw", "discord", "slack"]), + secret: SensitiveOutputString, + organization_id: Schema.String, + events: Schema.Array( + Schema.Literals([ + "checkout.created", + "checkout.updated", + "checkout.expired", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.state_changed", + "customer_seat.assigned", + "customer_seat.claimed", + "customer_seat.revoked", + "member.created", + "member.updated", + "member.deleted", + "order.created", + "order.updated", + "order.paid", + "order.refunded", + "subscription.created", + "subscription.updated", + "subscription.active", + "subscription.canceled", + "subscription.uncanceled", + "subscription.revoked", + "subscription.past_due", + "subscription.paused", + "subscription.resumed", + "refund.created", + "refund.updated", + "product.created", + "product.updated", + "benefit.created", + "benefit.updated", + "benefit_grant.created", + "benefit_grant.cycled", + "benefit_grant.updated", + "benefit_grant.revoked", + "organization.updated", + ]), + ), + enabled: Schema.Boolean, + }) as unknown as Schema.Codec; + +// The operation +/** + * Update Webhook Endpoint + * + * Update a webhook endpoint. + * **Scopes**: `webhooks:write` + * + * @param id - The webhook endpoint ID. + */ +export const webhooksupdateWebhookEndpoint = + /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({ + inputSchema: WebhooksupdateWebhookEndpointInput, + outputSchema: WebhooksupdateWebhookEndpointOutput, + })); diff --git a/packages/polar/src/retry.ts b/packages/polar/src/retry.ts new file mode 100644 index 0000000000..5354e0f88e --- /dev/null +++ b/packages/polar/src/retry.ts @@ -0,0 +1,55 @@ +/** + * Polar retry configuration. + * + * Defines the per-SDK `Retry` Context.Service tag that + * `packages/polar/src/client.ts` wires into `makeAPI`. Callers can install a + * blanket retry policy at the layer level and have every Polar API call below + * it pick it up: + * + * @example + * ```ts + * import * as Polar from "@distilled.cloud/polar"; + * + * myEffect.pipe(Polar.Retry.transient); + * Effect.provide(myEffect, Layer.succeed(Polar.Retry.Retry, customPolicy)); + * ``` + */ +import * as Context from "effect/Context"; +import * as Effect from "effect/Effect"; +import * as Layer from "effect/Layer"; +import { + type Policy, + throttlingFactory, + transientFactory, +} from "@distilled.cloud/core/retry"; + +export { + type Options, + type Factory, + type Policy, + makeDefault, + jittered, + capped, + throttlingOptions, + transientOptions, + throttlingFactory, + transientFactory, +} from "@distilled.cloud/core/retry"; + +/** Context tag for configuring retry behavior of Polar API calls. */ +export class Retry extends Context.Service()("PolarRetry") {} + +/** Provides a custom retry policy to every Polar API call below it. */ +export const policy = (optionsOrFactory: Policy) => + Effect.provide(Layer.succeed(Retry, optionsOrFactory)); + +/** Disables all automatic retries. */ +export const none = Effect.provide( + Layer.succeed(Retry, { while: () => false }), +); + +/** Apply the throttling retry policy (retries throttling errors indefinitely). */ +export const throttling = policy(throttlingFactory); + +/** Apply the transient retry policy (retries all transient errors indefinitely). */ +export const transient = policy(transientFactory); diff --git a/packages/polar/src/sensitive.ts b/packages/polar/src/sensitive.ts new file mode 100644 index 0000000000..2167a39b2a --- /dev/null +++ b/packages/polar/src/sensitive.ts @@ -0,0 +1,4 @@ +/** + * Re-export sensitive data schemas from sdk-core. + */ +export * from "@distilled.cloud/core/sensitive"; diff --git a/packages/polar/src/traits.ts b/packages/polar/src/traits.ts new file mode 100644 index 0000000000..cf13e396a9 --- /dev/null +++ b/packages/polar/src/traits.ts @@ -0,0 +1,4 @@ +/** + * Re-export the shared traits system from sdk-core. + */ +export * from "@distilled.cloud/core/traits"; diff --git a/packages/polar/tests/customers.test.ts b/packages/polar/tests/customers.test.ts new file mode 100644 index 0000000000..9d17d42b1a --- /dev/null +++ b/packages/polar/tests/customers.test.ts @@ -0,0 +1,48 @@ +import { describe, expect, it } from "vitest"; +import { Effect } from "effect"; +import { customerscreate } from "../src/operations/customerscreate.ts"; +import { customersget } from "../src/operations/customersget.ts"; +import { customersdelete } from "../src/operations/customersdelete.ts"; +import { hasCredentials, runEffect, testRunId } from "./setup.ts"; + +// Live lifecycle tests against the Polar sandbox — require `POLAR_ACCESS_TOKEN` +// (with `POLAR_SERVER=sandbox`). They skip without it. The created customer is +// cleaned up via `Effect.ensuring`, even on failure. +describe.skipIf(!hasCredentials)("Polar customers (live)", () => { + it( + "creates, reads, and deletes a customer", + { timeout: 30_000 }, + async () => { + const email = `distilled-polar-${testRunId}@example.com`; + let createdId: string | undefined; + + await runEffect( + Effect.gen(function* () { + const created = (yield* customerscreate({ + email, + name: `Distilled Test ${testRunId}`, + })) as { id: string; email: string }; + createdId = created.id; + + expect(created.id).toBeTruthy(); + expect(created.email).toBe(email); + + const fetched = (yield* customersget({ id: created.id })) as { + id: string; + email: string; + }; + expect(fetched.id).toBe(created.id); + expect(fetched.email).toBe(email); + }).pipe( + Effect.ensuring( + Effect.suspend(() => + createdId === undefined + ? Effect.void + : customersdelete({ id: createdId }).pipe(Effect.ignore), + ), + ), + ), + ); + }, + ); +}); diff --git a/packages/polar/tests/organizations.test.ts b/packages/polar/tests/organizations.test.ts new file mode 100644 index 0000000000..f111a6a83d --- /dev/null +++ b/packages/polar/tests/organizations.test.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from "vitest"; +import { Effect, Layer } from "effect"; +import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient"; +import { layer } from "../src/credentials.ts"; +import { Unauthorized } from "../src/errors.ts"; +import { organizationslist } from "../src/operations/organizationslist.ts"; +import { hasCredentials, runEffect } from "./setup.ts"; + +// Live tests hit the Polar API and require a sandbox token +// (`POLAR_ACCESS_TOKEN`, with `POLAR_SERVER=sandbox`). They skip without it. +describe.skipIf(!hasCredentials)("Polar organizations (live)", () => { + describe("organizationslist", () => { + it("lists organizations for the token", { timeout: 30_000 }, async () => { + const result = await runEffect(organizationslist({})); + expect(result).toBeDefined(); + expect(Array.isArray((result as { items?: unknown[] }).items)).toBe(true); + }); + + it( + "fails with Unauthorized for a bad token", + { timeout: 30_000 }, + async () => { + const badLayer = Layer.merge( + layer({ + accessToken: "polar_pat_definitely-invalid", + server: "sandbox", + }), + FetchHttpClient.layer, + ); + const error = await Effect.runPromise( + organizationslist({}).pipe( + Effect.provide(badLayer), + Effect.flip, + ) as Effect.Effect, + ); + expect(error).toBeInstanceOf(Unauthorized); + }, + ); + }); +}); diff --git a/packages/polar/tests/setup.ts b/packages/polar/tests/setup.ts new file mode 100644 index 0000000000..5c573d1c9d --- /dev/null +++ b/packages/polar/tests/setup.ts @@ -0,0 +1,29 @@ +import { config } from "dotenv"; +import { Effect, Layer } from "effect"; +import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient"; +import { CredentialsFromEnv } from "../src/credentials.ts"; + +// Load environment variables from .env file (repo root + package). +config(); + +/** True when a Polar token is available, so live tests can run. */ +export const hasCredentials: boolean = + typeof process.env.POLAR_ACCESS_TOKEN === "string" && + process.env.POLAR_ACCESS_TOKEN.length > 0; + +/** Credentials (from env) + HTTP client for all tests. */ +export const TestLayer = Layer.merge(CredentialsFromEnv, FetchHttpClient.layer); + +/** Short random hex string generated once per test run. */ +export const testRunId: string = crypto + .randomUUID() + .replace(/-/g, "") + .slice(0, 8); + +/** Run an Effect (requiring the SDK's Credentials + HttpClient) with the TestLayer provided. */ +export const runEffect = ( + effect: Effect.Effect, +): Promise => + Effect.runPromise( + effect.pipe(Effect.provide(TestLayer)) as Effect.Effect, + ); diff --git a/packages/polar/tsconfig.json b/packages/polar/tsconfig.json new file mode 100644 index 0000000000..59f710c649 --- /dev/null +++ b/packages/polar/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.base.json", + "include": [ + "src/**/*.ts" + ], + "compilerOptions": { + "outDir": "./lib", + "rootDir": "./src" + }, + "references": [ + { + "path": "../core" + } + ] +} diff --git a/packages/polar/vitest.config.ts b/packages/polar/vitest.config.ts new file mode 100644 index 0000000000..94092b93ba --- /dev/null +++ b/packages/polar/vitest.config.ts @@ -0,0 +1,12 @@ +import { config } from "dotenv"; +import { resolve } from "path"; + +config({ path: resolve(__dirname, "../../.env") }); +config({ path: resolve(__dirname, ".env") }); + +export default { + test: { + include: ["tests/**/*.test.ts"], + testTimeout: 30000, + }, +}; diff --git a/tsconfig.json b/tsconfig.json index d2c3778f3e..c22c32e45f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,6 +14,7 @@ { "path": "./packages/mongodb-atlas/tsconfig.json" }, { "path": "./packages/neon/tsconfig.json" }, { "path": "./packages/planetscale/tsconfig.json" }, + { "path": "./packages/polar/tsconfig.json" }, { "path": "./packages/posthog/tsconfig.json" }, { "path": "./packages/prisma-postgres/tsconfig.json" }, { "path": "./packages/stripe/tsconfig.json" }, diff --git a/www/distilled.cloud/index.html b/www/distilled.cloud/index.html index 4f98882d61..32c87f83eb 100644 --- a/www/distilled.cloud/index.html +++ b/www/distilled.cloud/index.html @@ -261,6 +261,18 @@

@distilled.cloud/stripe + + +
+
Polar
+ npm +
+
+

@distilled.cloud/polar

+

Polar billing API client with typed errors for products, subscriptions, meters, events, and checkouts.

+
+
+
diff --git a/www/distilled.cloud/public/logos/polar.svg b/www/distilled.cloud/public/logos/polar.svg new file mode 100644 index 0000000000..eca7b5017c --- /dev/null +++ b/www/distilled.cloud/public/logos/polar.svg @@ -0,0 +1,6 @@ + + + + + +