/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { CheckoutRequest } from '../models/CheckoutRequest'; import type { PortalRequest } from '../models/PortalRequest'; import type { SignupRequest } from '../models/SignupRequest'; import type { UsageStatsOut } from '../models/UsageStatsOut'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class AccountService { /** * Setup Intent Endpoint * Pre-signup: return Stripe SetupIntent client_secret for browser to collect payment method. * * No auth required (pre-signup). IP-throttled to 5 requests / 10 minutes per * client IP — generous for a real user retrying after a card error, brutal * for an attacker farming SetupIntents (each one creates a real Stripe * object even though it never gets confirmed). Beyond the throttle Stripe's * own fraud detection on duplicate card-on-file blocks abuse during the * /signup step. * * Browser uses returned client_secret to call ``stripe.confirmCardSetup()``. * @returns any Successful Response * @throws ApiError */ public static accountSetupIntent(): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/v1/account/setup-intent', }); } /** * Signup * Create new account on Free tier with payment method on file (anti-abuse). * * Two valid signup flows (see ``SignupRequest`` docstring): * * - **Browser flow** (humans): ``turnstile_token`` + ``setup_intent_id`` * - **Programmatic flow** (AI agents): ``payment_method_id`` direct * * Returns plaintext API key ONE TIME ONLY. Subsequent retrieval requires creating * a new key via POST /v1/account/api-keys. * * Anti-abuse: * - Browser flow: Turnstile blocks bots * - Programmatic flow: Stripe fraud detection on card-on-file blocks duplicates * - Both flows: email uniqueness, card-on-file always required * @returns any Successful Response * @throws ApiError */ public static accountSignup({ requestBody, }: { requestBody: SignupRequest, }): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/v1/account/signup', body: requestBody, mediaType: 'application/json', errors: { 422: `Validation Error`, }, }); } /** * Checkout * Upgrade Free -> Starter/Growth via Stripe Checkout. * @returns any Successful Response * @throws ApiError */ public static accountCheckout({ requestBody, }: { requestBody: CheckoutRequest, }): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/v1/account/checkout', body: requestBody, mediaType: 'application/json', errors: { 422: `Validation Error`, }, }); } /** * Portal * Open Stripe Customer Portal session for self-service billing. * @returns any Successful Response * @throws ApiError */ public static accountPortal({ requestBody, }: { requestBody: PortalRequest, }): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/v1/account/portal', body: requestBody, mediaType: 'application/json', errors: { 422: `Validation Error`, }, }); } /** * List Api Keys * List all API keys owned by the calling customer (by owner_email). * @returns any Successful Response * @throws ApiError */ public static accountListApiKeys(): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/v1/account/api-keys', }); } /** * Create Additional Api Key * Create another API key for an existing customer (same tier + Stripe customer). * @returns any Successful Response * @throws ApiError */ public static accountCreateApiKey(): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/v1/account/api-keys', }); } /** * Revoke Api Key * Soft-revoke an API key (sets revoked_at). Owner-only. * @returns any Successful Response * @throws ApiError */ public static accountRevokeApiKey({ keyId, }: { keyId: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'DELETE', url: '/v1/account/api-keys/{key_id}', path: { 'key_id': keyId, }, errors: { 422: `Validation Error`, }, }); } /** * Request Export * Trigger GDPR Art. 20 data export via step-up email confirmation. * * Anti-exfiltration: stolen API key alone cannot exfiltrate the customer dossier. * Owner must click email link to confirm (signed token, 24h TTL). * @returns any Successful Response * @throws ApiError */ public static accountRequestExport(): CancelablePromise> { return __request(OpenAPI, { method: 'POST', url: '/v1/account/export', }); } /** * Confirm Export * Verify token + start async export generation. * * In v1: returns confirmation only. Future: generate full export, upload to R2, * send second email with signed URL. * @returns any Successful Response * @throws ApiError */ public static accountConfirmExport({ token, }: { /** * Signed token from email link */ token: string, }): CancelablePromise> { return __request(OpenAPI, { method: 'GET', url: '/v1/account/export/confirm', query: { 'token': token, }, errors: { 422: `Validation Error`, }, }); } /** * Usage Status * Current usage stats for the calling API key. * @returns UsageStatsOut Successful Response * @throws ApiError */ public static accountUsage(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/account/usage', }); } }