@4players/payment 1.0.2-beta.2 → 1.0.2-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -412,6 +412,19 @@ var PaymentClient = class {
412
412
  if (error) this.handleError("get products", error);
413
413
  return data;
414
414
  }
415
+ /**
416
+ * Get product details by slug.
417
+ *
418
+ * @param slug - The product slug (e.g. voice, rooms, fleet, cortex)
419
+ * @returns Product details including features, pricing, and dependencies
420
+ */
421
+ async getProduct(slug) {
422
+ const { data, error } = await this.client.GET("/products/{slug}", {
423
+ params: { path: { slug } }
424
+ });
425
+ if (error) this.handleError("get product", error);
426
+ return data;
427
+ }
415
428
  /**
416
429
  * Get activated products for a project.
417
430
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/client.ts"],"names":["createClient"],"mappings":";;;;;;;;;;;;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EACtC,WAAA,CACE,OAAA,EACgB,UAAA,EACA,OAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAEZ,IAAA,IAAI,OAAO,KAAA,CAAM,iBAAA,KAAsB,UAAA,EAAY;AACjD,MAAA,KAAA,CAAM,iBAAA,CAAkB,MAAM,aAAY,CAAA;AAAA,IAC5C;AAAA,EACF;AACF;AAeO,IAAM,eAAA,GAAN,cAA8B,YAAA,CAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAA;AAAA,EAEhB,WAAA,CAAY,OAAA,EAAiB,IAAA,EAAc,UAAA,EAAoB;AAC7D,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACz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Y,6BAAA,EAA+B,KAAK,CAAA;AAChE,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEA,IAAO,cAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Payment SDK Error Classes\n *\n * Provides structured error handling for Payment API operations.\n */\n\n// V8-specific stack trace capture (available in Node.js, Chrome, etc.)\ndeclare const Error: ErrorConstructor & {\n captureStackTrace?(targetObject: object, constructorOpt?: Function): void;\n};\n\n/**\n * Base error class for all Payment SDK errors.\n */\nexport class PaymentError extends Error {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly details?: unknown\n ) {\n super(message);\n this.name = \"PaymentError\";\n // Maintains proper stack trace for where error was thrown (V8 engines)\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, PaymentError);\n }\n }\n}\n\n/**\n * Error thrown when the Payment API returns an application-level error\n * in its response envelope.\n *\n * The Payment API wraps all responses in an envelope:\n * ```json\n * { \"data\": T | null, \"error\": { \"code\": number, \"message\": string } }\n * ```\n *\n * A `PaymentApiError` is thrown when:\n * - `error.code !== 0` (application-level error, even if HTTP status is 200)\n * - `data` is `null` (legacy error pattern from before HTTP status codes were used)\n */\nexport class PaymentApiError extends PaymentError {\n /**\n * Application-level error code from the response envelope.\n * A value of `0` means no specific error code was returned (legacy null-data case).\n */\n public readonly code: number;\n\n /**\n * The HTTP status code of the response.\n * Note: This may be `200` even when there is an application error.\n */\n public readonly httpStatus: number;\n\n constructor(message: string, code: number, httpStatus: number) {\n super(message, httpStatus);\n this.name = \"PaymentApiError\";\n this.code = code;\n this.httpStatus = httpStatus;\n }\n}\n\n/**\n * Error thrown when authentication fails or is required.\n */\nexport class PaymentAuthError extends PaymentError {\n constructor(message = \"Authentication required. Please provide a valid session ID.\") {\n super(message, 401);\n this.name = \"PaymentAuthError\";\n }\n}\n\n/**\n * Error thrown when a requested resource is not found.\n */\nexport class PaymentNotFoundError extends PaymentError {\n constructor(resource: string, id: string) {\n super(`${resource} with ID ${id} not found`, 404);\n this.name = \"PaymentNotFoundError\";\n }\n}\n\n/**\n * Error thrown when request validation fails.\n */\nexport class PaymentValidationError extends PaymentError {\n constructor(message: string, details?: unknown) {\n super(message, 422, details);\n this.name = \"PaymentValidationError\";\n }\n}\n\n/**\n * Error thrown when the API rate limit is exceeded.\n */\nexport class PaymentRateLimitError extends PaymentError {\n constructor(retryAfter?: number) {\n super(\n retryAfter\n ? `Rate limit exceeded. Retry after ${retryAfter} seconds.`\n : \"Rate limit exceeded. Please try again later.\",\n 429,\n { retryAfter }\n );\n this.name = \"PaymentRateLimitError\";\n }\n}\n","/**\n * 4Players Payment API Client\n *\n * A type-safe client for the 4Players Payment API.\n * Works in browsers, Node.js, Deno, Bun, and edge runtimes.\n *\n * @example\n * ```typescript\n * import { PaymentClient } from '@4players/payment';\n *\n * const client = new PaymentClient({ sessionId: 'your-session-id' });\n *\n * const projects = await client.getProjects();\n * ```\n */\n\nimport createClient, { type Middleware } from \"openapi-fetch\";\nimport type { paths, components, operations } from \"./types.js\";\nimport {\n PaymentError,\n PaymentApiError,\n PaymentAuthError,\n PaymentNotFoundError,\n PaymentRateLimitError,\n} from \"./errors.js\";\n\nconst DEFAULT_BASE_URL = \"https://secure.4players.de/public/api/v1\";\n\n/**\n * Configuration options for the Payment client.\n */\nexport interface PaymentClientConfig {\n /** Fusion session ID for authentication (sent as fusion-sid header) */\n sessionId: string;\n /** Base URL for the Payment API (default: https://secure.4players.de/public/api/v1) */\n baseUrl?: string;\n /** Custom fetch implementation (useful for testing or special environments) */\n fetch?: typeof fetch;\n}\n\n// ==================== Entity types from components.schemas ====================\n\nexport type PaymentProject = components[\"schemas\"][\"PaymentProject\"];\nexport type BillingAccount = components[\"schemas\"][\"BillingAccount\"];\nexport type OdinAccessKey = components[\"schemas\"][\"OdinAccessKey\"];\nexport type OdinUserPermissions = components[\"schemas\"][\"OdinUserPermissions\"];\nexport type OdinUserRole = components[\"schemas\"][\"OdinUserRole\"];\nexport type TimeSeriesData = components[\"schemas\"][\"TimeSeriesData\"];\nexport type Subscription = components[\"schemas\"][\"Subscription\"];\nexport type Invoice = components[\"schemas\"][\"Invoice\"];\nexport type InvoicePosition = components[\"schemas\"][\"InvoicePosition\"];\nexport type Invoices = components[\"schemas\"][\"Invoices\"];\nexport type SubscriptionPosition = components[\"schemas\"][\"SubscriptionPosition\"];\nexport type TariffParams = components[\"schemas\"][\"TariffParams\"];\nexport type SetupSession = components[\"schemas\"][\"SetupSession\"];\nexport type PortalSession = components[\"schemas\"][\"PortalSession\"];\nexport type TokenPayload = components[\"schemas\"][\"TokenPayload\"];\nexport type BillingOptions = components[\"schemas\"][\"BillingOptions\"];\nexport type BillingChangeOptions = components[\"schemas\"][\"BillingChangeOptions\"];\nexport type BillingStateHistory = components[\"schemas\"][\"BillingStateHistory\"];\nexport type ResourcePackagePrice = components[\"schemas\"][\"ResourcePackagePrice\"];\nexport type SuccessResponse = components[\"schemas\"][\"SuccessResponse\"];\nexport type ProjectProduct = components[\"schemas\"][\"ProjectProduct\"];\nexport type ProjectProductFeature = components[\"schemas\"][\"ProjectProductFeature\"];\nexport type ProductPricing = components[\"schemas\"][\"ProductPricing\"];\nexport type ActivatedProduct = components[\"schemas\"][\"ActivatedProduct\"];\nexport type FeatureAvailability = components[\"schemas\"][\"FeatureAvailability\"];\nexport type ProductDependencyCheck = components[\"schemas\"][\"ProductDependencyCheck\"];\nexport type ProductDependencyStatus = components[\"schemas\"][\"ProductDependencyStatus\"];\n\n// Enum types\nexport type APIType = components[\"schemas\"][\"APIType\"];\nexport type BillingState = components[\"schemas\"][\"BillingState\"];\nexport type PermissionRole = components[\"schemas\"][\"PermissionRole\"];\nexport type UserStatus = components[\"schemas\"][\"UserStatus\"];\nexport type InvoiceStatus = components[\"schemas\"][\"InvoiceStatus\"];\nexport type ProductSlug = components[\"schemas\"][\"ProductSlug\"];\nexport type PricingType = components[\"schemas\"][\"PricingType\"];\n\n// ==================== Request/Payload types ====================\n\nexport type ActivateAPIPayload = components[\"schemas\"][\"ActivateAPIPayload\"];\nexport type AddUserToProjectPayload = components[\"schemas\"][\"AddUserToProjectPayload\"];\nexport type ChangeUserRolePayload = components[\"schemas\"][\"ChangeUserRolePayload\"];\nexport type CreateAccessKeyPayload = components[\"schemas\"][\"CreateAccessKeyPayload\"];\nexport type CreateBillingPortalSessionPayload = components[\"schemas\"][\"CreateBillingPortalSessionPayload\"];\nexport type CreateSetupSessionPayload = components[\"schemas\"][\"CreateSetupSessionPayload\"];\nexport type CreateTokenPayload = components[\"schemas\"][\"CreateTokenPayload\"];\nexport type EditAccessKeyPayload = components[\"schemas\"][\"EditAccessKeyPayload\"];\nexport type EditProjectPayload = components[\"schemas\"][\"EditProjectPayload\"];\nexport type ResourcePackagePricePayload = components[\"schemas\"][\"ResourcePackagePricePayload\"];\nexport type ResourcePackagePricesPayload = components[\"schemas\"][\"ResourcePackagePricesPayload\"];\nexport type RevokeUserPayload = components[\"schemas\"][\"RevokeUserPayload\"];\nexport type SetBillingAccountPayload = components[\"schemas\"][\"SetBillingAccountPayload\"];\nexport type ActivateProductPayload = components[\"schemas\"][\"ActivateProductPayload\"];\nexport type DeactivateProductPayload = components[\"schemas\"][\"DeactivateProductPayload\"];\n\n// ==================== Query parameter types ====================\n\nexport type GetProjectsQuery = operations[\"getProjects\"][\"parameters\"][\"query\"];\nexport type GetPeersOverTimeQuery = operations[\"getPeersOverTime\"][\"parameters\"][\"query\"];\nexport type GetRoomsOverTimeQuery = operations[\"getRoomsOverTime\"][\"parameters\"][\"query\"];\nexport type GetInstancesOverTimeQuery = operations[\"getInstancesOverTime\"][\"parameters\"][\"query\"];\nexport type GetInvoicesQuery = operations[\"getInvoices\"][\"parameters\"][\"query\"];\nexport type CheckFeatureQuery = operations[\"checkFeature\"][\"parameters\"][\"query\"];\nexport type CheckProductDependenciesQuery = operations[\"checkProductDependencies\"][\"parameters\"][\"query\"];\n\n/**\n * Response envelope used by the Payment API.\n */\ninterface PaymentEnvelope<T = unknown> {\n data: T | null;\n error: {\n code: number;\n message: string;\n };\n}\n\n/**\n * 4Players Payment API Client\n *\n * Provides a type-safe interface to the 4Players Payment REST API for managing\n * projects, billing, invoices, access keys, and user permissions.\n */\nexport class PaymentClient {\n private client: ReturnType<typeof createClient<paths>>;\n\n /**\n * Create a new Payment client instance.\n *\n * @param config - Client configuration\n * @throws {PaymentAuthError} If no session ID is provided\n *\n * @example\n * ```typescript\n * const client = new PaymentClient({\n * sessionId: 'your-fusion-sid'\n * });\n * ```\n */\n constructor(config: PaymentClientConfig) {\n if (!config.sessionId) {\n throw new PaymentAuthError(\"Session ID is required\");\n }\n\n this.client = createClient<paths>({\n baseUrl: config.baseUrl || DEFAULT_BASE_URL,\n headers: {\n \"fusion-sid\": config.sessionId,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n },\n fetch: config.fetch,\n });\n\n // Register the envelope-unwrapping middleware\n this.client.use(this.createEnvelopeMiddleware());\n }\n\n /**\n * Creates middleware that unwraps the Payment API response envelope.\n *\n * The Payment API wraps ALL responses in `{ data, error }`.\n * This middleware:\n * 1. Checks `error.code` — if non-zero, throws `PaymentApiError`\n * 2. Checks `data` — if null, throws `PaymentApiError` (legacy error pattern)\n * 3. Returns a new Response containing only the unwrapped `data`\n */\n private createEnvelopeMiddleware(): Middleware {\n return {\n async onResponse({ response }) {\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return response;\n }\n\n const text = await response.clone().text();\n let body: unknown;\n try {\n body = JSON.parse(text);\n } catch {\n return response;\n }\n\n if (\n body !== null &&\n typeof body === \"object\" &&\n \"error\" in body &&\n \"data\" in body\n ) {\n const envelope = body as PaymentEnvelope;\n\n // Application-level error (can happen even with HTTP 200!)\n if (envelope.error && envelope.error.code !== 0) {\n throw new PaymentApiError(\n envelope.error.message,\n envelope.error.code,\n response.status\n );\n }\n\n // Legacy error pattern: data is null with HTTP 200\n if (envelope.data === null || envelope.data === undefined) {\n throw new PaymentApiError(\n envelope.error?.message || \"Response data is null\",\n envelope.error?.code || 0,\n response.status\n );\n }\n\n // Return unwrapped data so openapi-fetch sees the schema-matching body\n return new Response(JSON.stringify(envelope.data), {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n }\n\n // Not an envelope — return as-is\n return response;\n },\n };\n }\n\n private handleError(operation: string, error: unknown): never {\n if (error && typeof error === \"object\") {\n const errorObj = error as Record<string, unknown>;\n\n if (errorObj.status === 401 || errorObj.status === 403) {\n throw new PaymentAuthError();\n }\n if (errorObj.status === 404) {\n throw new PaymentNotFoundError(operation, \"unknown\");\n }\n if (errorObj.status === 429) {\n throw new PaymentRateLimitError();\n }\n }\n\n throw new PaymentError(\n `Failed to ${operation}: ${JSON.stringify(error)}`,\n undefined,\n error\n );\n }\n\n // ==================== Fleet Apps ====================\n\n /**\n * Get all fleet apps the user has access to (projects with Fleet activated).\n *\n * @returns Array of payment projects with Fleet app IDs\n */\n async getFleetProjects(): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/apps\");\n if (error) this.handleError(\"get fleet projects\", error);\n return data!;\n }\n\n /**\n * Get the details of a specific fleet app including the payment project.\n *\n * @param appId - The ID of the fleet app to retrieve\n * @returns Payment project details\n */\n async getFleetProject(appId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/apps/{app_id}\", {\n params: { path: { app_id: appId } },\n });\n if (error) this.handleError(\"get fleet project\", error);\n return data!;\n }\n\n // ==================== Projects ====================\n\n /**\n * Get all projects the authenticated user has access to.\n *\n * @param query - Optional query parameters to filter by project type\n * @returns Array of payment projects\n */\n async getProjects(query?: GetProjectsQuery): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/projects\", {\n params: { query },\n });\n if (error) this.handleError(\"get projects\", error);\n return data!;\n }\n\n /**\n * Get a specific project by ID.\n *\n * @param projectId - The unique identifier of the project\n * @returns Project details\n */\n async getProject(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project\", error);\n return data!;\n }\n\n /**\n * Update a project's name, description, or peer limit.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Updated project fields\n * @returns Success response\n */\n async editProject(projectId: string, body: EditProjectPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"edit project\", error);\n return data!;\n }\n\n // ==================== Peers / Metrics ====================\n\n /**\n * Get peak peers over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required)\n * @returns Peers over time data\n */\n async getPeersOverTime(projectId: string, query: GetPeersOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/peers-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get peers over time\", error);\n return data!;\n }\n\n /**\n * Get room count over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of active rooms\n */\n async getRoomsOverTime(projectId: string, query: GetRoomsOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/rooms-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get rooms over time\", error);\n return data!;\n }\n\n /**\n * Get Fleet server instances over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of deployed server instances\n */\n async getInstancesOverTime(projectId: string, query: GetInstancesOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/instances-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get instances over time\", error);\n return data!;\n }\n\n // ==================== Billing ====================\n\n /**\n * Get all billing accounts for the current user.\n *\n * @returns Array of billing accounts\n */\n async getBillingAccounts(): Promise<BillingAccount[]> {\n const { data, error } = await this.client.GET(\"/billing\");\n if (error) this.handleError(\"get billing accounts\", error);\n return data!;\n }\n\n /**\n * Get a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Billing account details\n */\n async getBillingAccount(billingAccountId: string): Promise<BillingAccount> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account\", error);\n return data!;\n }\n\n /**\n * Get invoices for a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Array of invoices\n */\n async getBillingAccountInvoices(billingAccountId: string): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}/invoices\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account invoices\", error);\n return data!;\n }\n\n /**\n * Create a Stripe setup session for a new billing account.\n *\n * @param body - Setup session creation payload\n * @returns Setup session with redirect URL\n */\n async createSetupSession(body: CreateSetupSessionPayload): Promise<SetupSession> {\n const { data, error } = await this.client.POST(\"/billing/create-setup-session\", {\n body,\n });\n if (error) this.handleError(\"create setup session\", error);\n return data!;\n }\n\n /**\n * Create a Stripe billing portal session.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @param body - Portal session creation payload\n * @returns Portal session with redirect URL\n */\n async createBillingPortalSession(billingAccountId: string, body: CreateBillingPortalSessionPayload): Promise<PortalSession> {\n const { data, error } = await this.client.POST(\"/billing/{billingAccountId}/create-billing-portal-session\", {\n params: { path: { billingAccountId } },\n body,\n });\n if (error) this.handleError(\"create billing portal session\", error);\n return data!;\n }\n\n /**\n * Get billing options for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Billing options including current state and change options\n */\n async getBillingOptions(projectId: string): Promise<BillingOptions> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/get-billing-options\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get billing options\", error);\n return data!;\n }\n\n /**\n * Set a billing account on a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Billing account and state to set\n * @returns Success response\n */\n async setBillingAccount(projectId: string, body: SetBillingAccountPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/set-billing-account\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"set billing account\", error);\n return data!;\n }\n\n /**\n * Cancel billing for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Success response\n */\n async cancelBilling(projectId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/cancel-billing\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"cancel billing\", error);\n return data!;\n }\n\n // ==================== API Activation ====================\n\n /**\n * Activate an API for the specified project.\n *\n * @deprecated Use {@link activateProduct} instead.\n * @param projectId - The unique identifier of the project\n * @param body - The API slug to activate\n * @returns Success response\n */\n async activateAPI(projectId: string, body: ActivateAPIPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-api\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate API\", error);\n return data!;\n }\n\n // ==================== Products ====================\n\n /**\n * List all available products.\n *\n * @returns Array of available products with features and pricing\n */\n async getProducts(): Promise<ProjectProduct[]> {\n const { data, error } = await this.client.GET(\"/products\");\n if (error) this.handleError(\"get products\", error);\n return data!;\n }\n\n /**\n * Get activated products for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Array of activated products\n */\n async getProjectProducts(projectId: string): Promise<ActivatedProduct[]> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/products\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project products\", error);\n return data!;\n }\n\n /**\n * Activate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug and optional configuration\n * @returns Updated project\n */\n async activateProduct(projectId: string, body: ActivateProductPayload): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate product\", error);\n return data!;\n }\n\n /**\n * Deactivate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug to deactivate\n * @returns Success response\n */\n async deactivateProduct(projectId: string, body: DeactivateProductPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/deactivate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"deactivate product\", error);\n return data!;\n }\n\n /**\n * Check if a feature is available for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the feature slug to check\n * @returns Feature availability status\n */\n async checkFeature(projectId: string, query: CheckFeatureQuery): Promise<FeatureAvailability> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-feature\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check feature\", error);\n return data!;\n }\n\n /**\n * Check product dependencies for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the product slug to check\n * @returns Dependency check result with activation status of each dependency\n */\n async checkProductDependencies(projectId: string, query: CheckProductDependenciesQuery): Promise<ProductDependencyCheck> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-product-dependencies\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check product dependencies\", error);\n return data!;\n }\n\n // ==================== Invoices ====================\n\n /**\n * Get all invoices for the current user, optionally filtered by ID.\n *\n * @param query - Optional query parameters for filtering by invoice IDs\n * @returns Array of invoices\n */\n async getInvoices(query?: GetInvoicesQuery): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/invoices\", {\n params: { query },\n });\n if (error) this.handleError(\"get invoices\", error);\n return data!;\n }\n\n /**\n * Get a preview of the current month's invoice for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Invoice preview\n */\n async getInvoicePreview(projectId: string): Promise<Invoice> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/preview-invoice\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get invoice preview\", error);\n return data!;\n }\n\n // ==================== Access Keys ====================\n\n /**\n * Get a specific access key.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Access key details\n */\n async getAccessKey(accessKeyId: string): Promise<OdinAccessKey> {\n const { data, error } = await this.client.GET(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"get access key\", error);\n return data!;\n }\n\n /**\n * Create a new access key for a project.\n *\n * @param body - Access key creation payload\n * @returns Created access key (includes the key value only in this response)\n */\n async createAccessKey(body: CreateAccessKeyPayload): Promise<OdinAccessKey> {\n const { data, error } = await this.client.POST(\"/odin-access-keys/\", {\n body,\n });\n if (error) this.handleError(\"create access key\", error);\n return data!;\n }\n\n /**\n * Update an existing access key's name or description.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @param body - Updated access key fields\n * @returns Success response\n */\n async editAccessKey(accessKeyId: string, body: EditAccessKeyPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n body,\n });\n if (error) this.handleError(\"edit access key\", error);\n return data!;\n }\n\n /**\n * Delete an access key. This operation is irreversible.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Success response\n */\n async deleteAccessKey(accessKeyId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.DELETE(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"delete access key\", error);\n return data!;\n }\n\n // ==================== Project Members ====================\n\n /**\n * Add a user to a project with a specified role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - User email and role\n * @returns The created user role\n */\n async addProjectMember(projectId: string, body: AddUserToProjectPayload): Promise<OdinUserRole> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/add-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"add project member\", error);\n return data!;\n }\n\n /**\n * Revoke a user's permission from a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID to revoke\n * @returns Success response\n */\n async deleteProjectMember(projectId: string, body: RevokeUserPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"delete project member\", error);\n return data!;\n }\n\n /**\n * Change a project member's role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID and new role\n * @returns Success response\n */\n async changeMemberRole(projectId: string, body: ChangeUserRolePayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/change-user-role\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"change member role\", error);\n return data!;\n }\n\n // ==================== Tokens & Secrets ====================\n\n /**\n * Create an ODIN access token for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Token creation payload\n * @returns The created token\n */\n async createAccessToken(projectId: string, body: CreateTokenPayload): Promise<TokenPayload> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/create-token\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"create access token\", error);\n return data!;\n }\n\n /**\n * Revoke the secret for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Updated project with new secret\n */\n async revokeSecret(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-secret\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"revoke secret\", error);\n return data!;\n }\n\n // ==================== Resource Package Pricing ====================\n\n /**\n * Get the price for a single resource package in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package, region, and quantity\n * @returns Price information\n */\n async getResourcePackagePrice(projectId: string, body: ResourcePackagePricePayload): Promise<ResourcePackagePrice> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-price\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package price\", error);\n return data!;\n }\n\n /**\n * Get prices for multiple resource packages in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package IDs, region, and quantity\n * @returns Array of price information\n */\n async getResourcePackagePrices(projectId: string, body: ResourcePackagePricesPayload): Promise<ResourcePackagePrice[]> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-prices\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package prices\", error);\n return data!;\n }\n}\n\nexport default PaymentClient;\n"]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/client.ts"],"names":["createClient"],"mappings":";;;;;;;;;;;;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EACtC,WAAA,CACE,OAAA,EACgB,UAAA,EACA,OAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAEZ,IAAA,IAAI,OAAO,KAAA,CAAM,iBAAA,KAAsB,UAAA,EAAY;AACjD,MAAA,KAAA,CAAM,iBAAA,CAAkB,MAAM,aAAY,CAAA;AAAA,IAC5C;AAAA,EACF;AACF;AAeO,IAAM,eAAA,GAAN,cAA8B,YAAA,CAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAA;AAAA,EAEhB,WAAA,CAAY,OAAA,EAAiB,IAAA,EAAc,UAAA,EAAoB;AAC7D,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AACF;AAKO,IAAM,gBAAA,GAAN,cAA+B,YAAA,CAAa;AAAA,EACjD,WAAA,CAAY,UAAU,6DAAA,EAA+D;AACnF,IAAA,KAAA,CAAM,SAAS,GAAG,CAAA;AAClB,IAAA,IAAA,CAAK,I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,KACD,CAAA;AACD,IAAA,IAAI,KAAA,EAAO,IAAA,CAAK,WAAA,CAAY,6BAAA,EAA+B,KAAK,CAAA;AAChE,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEA,IAAO,cAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Payment SDK Error Classes\n *\n * Provides structured error handling for Payment API operations.\n */\n\n// V8-specific stack trace capture (available in Node.js, Chrome, etc.)\ndeclare const Error: ErrorConstructor & {\n captureStackTrace?(targetObject: object, constructorOpt?: Function): void;\n};\n\n/**\n * Base error class for all Payment SDK errors.\n */\nexport class PaymentError extends Error {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly details?: unknown\n ) {\n super(message);\n this.name = \"PaymentError\";\n // Maintains proper stack trace for where error was thrown (V8 engines)\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, PaymentError);\n }\n }\n}\n\n/**\n * Error thrown when the Payment API returns an application-level error\n * in its response envelope.\n *\n * The Payment API wraps all responses in an envelope:\n * ```json\n * { \"data\": T | null, \"error\": { \"code\": number, \"message\": string } }\n * ```\n *\n * A `PaymentApiError` is thrown when:\n * - `error.code !== 0` (application-level error, even if HTTP status is 200)\n * - `data` is `null` (legacy error pattern from before HTTP status codes were used)\n */\nexport class PaymentApiError extends PaymentError {\n /**\n * Application-level error code from the response envelope.\n * A value of `0` means no specific error code was returned (legacy null-data case).\n */\n public readonly code: number;\n\n /**\n * The HTTP status code of the response.\n * Note: This may be `200` even when there is an application error.\n */\n public readonly httpStatus: number;\n\n constructor(message: string, code: number, httpStatus: number) {\n super(message, httpStatus);\n this.name = \"PaymentApiError\";\n this.code = code;\n this.httpStatus = httpStatus;\n }\n}\n\n/**\n * Error thrown when authentication fails or is required.\n */\nexport class PaymentAuthError extends PaymentError {\n constructor(message = \"Authentication required. Please provide a valid session ID.\") {\n super(message, 401);\n this.name = \"PaymentAuthError\";\n }\n}\n\n/**\n * Error thrown when a requested resource is not found.\n */\nexport class PaymentNotFoundError extends PaymentError {\n constructor(resource: string, id: string) {\n super(`${resource} with ID ${id} not found`, 404);\n this.name = \"PaymentNotFoundError\";\n }\n}\n\n/**\n * Error thrown when request validation fails.\n */\nexport class PaymentValidationError extends PaymentError {\n constructor(message: string, details?: unknown) {\n super(message, 422, details);\n this.name = \"PaymentValidationError\";\n }\n}\n\n/**\n * Error thrown when the API rate limit is exceeded.\n */\nexport class PaymentRateLimitError extends PaymentError {\n constructor(retryAfter?: number) {\n super(\n retryAfter\n ? `Rate limit exceeded. Retry after ${retryAfter} seconds.`\n : \"Rate limit exceeded. Please try again later.\",\n 429,\n { retryAfter }\n );\n this.name = \"PaymentRateLimitError\";\n }\n}\n","/**\n * 4Players Payment API Client\n *\n * A type-safe client for the 4Players Payment API.\n * Works in browsers, Node.js, Deno, Bun, and edge runtimes.\n *\n * @example\n * ```typescript\n * import { PaymentClient } from '@4players/payment';\n *\n * const client = new PaymentClient({ sessionId: 'your-session-id' });\n *\n * const projects = await client.getProjects();\n * ```\n */\n\nimport createClient, { type Middleware } from \"openapi-fetch\";\nimport type { paths, components, operations } from \"./types.js\";\nimport {\n PaymentError,\n PaymentApiError,\n PaymentAuthError,\n PaymentNotFoundError,\n PaymentRateLimitError,\n} from \"./errors.js\";\n\nconst DEFAULT_BASE_URL = \"https://secure.4players.de/public/api/v1\";\n\n/**\n * Configuration options for the Payment client.\n */\nexport interface PaymentClientConfig {\n /** Fusion session ID for authentication (sent as fusion-sid header) */\n sessionId: string;\n /** Base URL for the Payment API (default: https://secure.4players.de/public/api/v1) */\n baseUrl?: string;\n /** Custom fetch implementation (useful for testing or special environments) */\n fetch?: typeof fetch;\n}\n\n// ==================== Entity types from components.schemas ====================\n\nexport type PaymentProject = components[\"schemas\"][\"PaymentProject\"];\nexport type BillingAccount = components[\"schemas\"][\"BillingAccount\"];\nexport type OdinAccessKey = components[\"schemas\"][\"OdinAccessKey\"];\nexport type OdinUserPermissions = components[\"schemas\"][\"OdinUserPermissions\"];\nexport type OdinUserRole = components[\"schemas\"][\"OdinUserRole\"];\nexport type TimeSeriesData = components[\"schemas\"][\"TimeSeriesData\"];\nexport type Subscription = components[\"schemas\"][\"Subscription\"];\nexport type Invoice = components[\"schemas\"][\"Invoice\"];\nexport type InvoicePosition = components[\"schemas\"][\"InvoicePosition\"];\nexport type Invoices = components[\"schemas\"][\"Invoices\"];\nexport type SubscriptionPosition = components[\"schemas\"][\"SubscriptionPosition\"];\nexport type TariffParams = components[\"schemas\"][\"TariffParams\"];\nexport type SetupSession = components[\"schemas\"][\"SetupSession\"];\nexport type PortalSession = components[\"schemas\"][\"PortalSession\"];\nexport type TokenPayload = components[\"schemas\"][\"TokenPayload\"];\nexport type BillingOptions = components[\"schemas\"][\"BillingOptions\"];\nexport type BillingChangeOptions = components[\"schemas\"][\"BillingChangeOptions\"];\nexport type BillingStateHistory = components[\"schemas\"][\"BillingStateHistory\"];\nexport type ResourcePackagePrice = components[\"schemas\"][\"ResourcePackagePrice\"];\nexport type SuccessResponse = components[\"schemas\"][\"SuccessResponse\"];\nexport type ProjectProduct = components[\"schemas\"][\"ProjectProduct\"];\nexport type ProjectProductFeature = components[\"schemas\"][\"ProjectProductFeature\"];\nexport type ProductPricing = components[\"schemas\"][\"ProductPricing\"];\nexport type ActivatedProduct = components[\"schemas\"][\"ActivatedProduct\"];\nexport type FeatureAvailability = components[\"schemas\"][\"FeatureAvailability\"];\nexport type ProductDependencyCheck = components[\"schemas\"][\"ProductDependencyCheck\"];\nexport type ProductDependencyStatus = components[\"schemas\"][\"ProductDependencyStatus\"];\n\n// Enum types\nexport type APIType = components[\"schemas\"][\"APIType\"];\nexport type BillingState = components[\"schemas\"][\"BillingState\"];\nexport type PermissionRole = components[\"schemas\"][\"PermissionRole\"];\nexport type UserStatus = components[\"schemas\"][\"UserStatus\"];\nexport type InvoiceStatus = components[\"schemas\"][\"InvoiceStatus\"];\nexport type ProductSlug = components[\"schemas\"][\"ProductSlug\"];\nexport type PricingType = components[\"schemas\"][\"PricingType\"];\n\n// ==================== Request/Payload types ====================\n\nexport type ActivateAPIPayload = components[\"schemas\"][\"ActivateAPIPayload\"];\nexport type AddUserToProjectPayload = components[\"schemas\"][\"AddUserToProjectPayload\"];\nexport type ChangeUserRolePayload = components[\"schemas\"][\"ChangeUserRolePayload\"];\nexport type CreateAccessKeyPayload = components[\"schemas\"][\"CreateAccessKeyPayload\"];\nexport type CreateBillingPortalSessionPayload = components[\"schemas\"][\"CreateBillingPortalSessionPayload\"];\nexport type CreateSetupSessionPayload = components[\"schemas\"][\"CreateSetupSessionPayload\"];\nexport type CreateTokenPayload = components[\"schemas\"][\"CreateTokenPayload\"];\nexport type EditAccessKeyPayload = components[\"schemas\"][\"EditAccessKeyPayload\"];\nexport type EditProjectPayload = components[\"schemas\"][\"EditProjectPayload\"];\nexport type ResourcePackagePricePayload = components[\"schemas\"][\"ResourcePackagePricePayload\"];\nexport type ResourcePackagePricesPayload = components[\"schemas\"][\"ResourcePackagePricesPayload\"];\nexport type RevokeUserPayload = components[\"schemas\"][\"RevokeUserPayload\"];\nexport type SetBillingAccountPayload = components[\"schemas\"][\"SetBillingAccountPayload\"];\nexport type ActivateProductPayload = components[\"schemas\"][\"ActivateProductPayload\"];\nexport type DeactivateProductPayload = components[\"schemas\"][\"DeactivateProductPayload\"];\n\n// ==================== Query parameter types ====================\n\nexport type GetProjectsQuery = operations[\"getProjects\"][\"parameters\"][\"query\"];\nexport type GetPeersOverTimeQuery = operations[\"getPeersOverTime\"][\"parameters\"][\"query\"];\nexport type GetRoomsOverTimeQuery = operations[\"getRoomsOverTime\"][\"parameters\"][\"query\"];\nexport type GetInstancesOverTimeQuery = operations[\"getInstancesOverTime\"][\"parameters\"][\"query\"];\nexport type GetInvoicesQuery = operations[\"getInvoices\"][\"parameters\"][\"query\"];\nexport type CheckFeatureQuery = operations[\"checkFeature\"][\"parameters\"][\"query\"];\nexport type CheckProductDependenciesQuery = operations[\"checkProductDependencies\"][\"parameters\"][\"query\"];\n\n/**\n * Response envelope used by the Payment API.\n */\ninterface PaymentEnvelope<T = unknown> {\n data: T | null;\n error: {\n code: number;\n message: string;\n };\n}\n\n/**\n * 4Players Payment API Client\n *\n * Provides a type-safe interface to the 4Players Payment REST API for managing\n * projects, billing, invoices, access keys, and user permissions.\n */\nexport class PaymentClient {\n private client: ReturnType<typeof createClient<paths>>;\n\n /**\n * Create a new Payment client instance.\n *\n * @param config - Client configuration\n * @throws {PaymentAuthError} If no session ID is provided\n *\n * @example\n * ```typescript\n * const client = new PaymentClient({\n * sessionId: 'your-fusion-sid'\n * });\n * ```\n */\n constructor(config: PaymentClientConfig) {\n if (!config.sessionId) {\n throw new PaymentAuthError(\"Session ID is required\");\n }\n\n this.client = createClient<paths>({\n baseUrl: config.baseUrl || DEFAULT_BASE_URL,\n headers: {\n \"fusion-sid\": config.sessionId,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n },\n fetch: config.fetch,\n });\n\n // Register the envelope-unwrapping middleware\n this.client.use(this.createEnvelopeMiddleware());\n }\n\n /**\n * Creates middleware that unwraps the Payment API response envelope.\n *\n * The Payment API wraps ALL responses in `{ data, error }`.\n * This middleware:\n * 1. Checks `error.code` — if non-zero, throws `PaymentApiError`\n * 2. Checks `data` — if null, throws `PaymentApiError` (legacy error pattern)\n * 3. Returns a new Response containing only the unwrapped `data`\n */\n private createEnvelopeMiddleware(): Middleware {\n return {\n async onResponse({ response }) {\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return response;\n }\n\n const text = await response.clone().text();\n let body: unknown;\n try {\n body = JSON.parse(text);\n } catch {\n return response;\n }\n\n if (\n body !== null &&\n typeof body === \"object\" &&\n \"error\" in body &&\n \"data\" in body\n ) {\n const envelope = body as PaymentEnvelope;\n\n // Application-level error (can happen even with HTTP 200!)\n if (envelope.error && envelope.error.code !== 0) {\n throw new PaymentApiError(\n envelope.error.message,\n envelope.error.code,\n response.status\n );\n }\n\n // Legacy error pattern: data is null with HTTP 200\n if (envelope.data === null || envelope.data === undefined) {\n throw new PaymentApiError(\n envelope.error?.message || \"Response data is null\",\n envelope.error?.code || 0,\n response.status\n );\n }\n\n // Return unwrapped data so openapi-fetch sees the schema-matching body\n return new Response(JSON.stringify(envelope.data), {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n }\n\n // Not an envelope — return as-is\n return response;\n },\n };\n }\n\n private handleError(operation: string, error: unknown): never {\n if (error && typeof error === \"object\") {\n const errorObj = error as Record<string, unknown>;\n\n if (errorObj.status === 401 || errorObj.status === 403) {\n throw new PaymentAuthError();\n }\n if (errorObj.status === 404) {\n throw new PaymentNotFoundError(operation, \"unknown\");\n }\n if (errorObj.status === 429) {\n throw new PaymentRateLimitError();\n }\n }\n\n throw new PaymentError(\n `Failed to ${operation}: ${JSON.stringify(error)}`,\n undefined,\n error\n );\n }\n\n // ==================== Fleet Apps ====================\n\n /**\n * Get all fleet apps the user has access to (projects with Fleet activated).\n *\n * @returns Array of payment projects with Fleet app IDs\n */\n async getFleetProjects(): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/apps\");\n if (error) this.handleError(\"get fleet projects\", error);\n return data!;\n }\n\n /**\n * Get the details of a specific fleet app including the payment project.\n *\n * @param appId - The ID of the fleet app to retrieve\n * @returns Payment project details\n */\n async getFleetProject(appId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/apps/{app_id}\", {\n params: { path: { app_id: appId } },\n });\n if (error) this.handleError(\"get fleet project\", error);\n return data!;\n }\n\n // ==================== Projects ====================\n\n /**\n * Get all projects the authenticated user has access to.\n *\n * @param query - Optional query parameters to filter by project type\n * @returns Array of payment projects\n */\n async getProjects(query?: GetProjectsQuery): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/projects\", {\n params: { query },\n });\n if (error) this.handleError(\"get projects\", error);\n return data!;\n }\n\n /**\n * Get a specific project by ID.\n *\n * @param projectId - The unique identifier of the project\n * @returns Project details\n */\n async getProject(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project\", error);\n return data!;\n }\n\n /**\n * Update a project's name, description, or peer limit.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Updated project fields\n * @returns Success response\n */\n async editProject(projectId: string, body: EditProjectPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"edit project\", error);\n return data!;\n }\n\n // ==================== Peers / Metrics ====================\n\n /**\n * Get peak peers over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required)\n * @returns Peers over time data\n */\n async getPeersOverTime(projectId: string, query: GetPeersOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/peers-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get peers over time\", error);\n return data!;\n }\n\n /**\n * Get room count over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of active rooms\n */\n async getRoomsOverTime(projectId: string, query: GetRoomsOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/rooms-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get rooms over time\", error);\n return data!;\n }\n\n /**\n * Get Fleet server instances over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of deployed server instances\n */\n async getInstancesOverTime(projectId: string, query: GetInstancesOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/instances-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get instances over time\", error);\n return data!;\n }\n\n // ==================== Billing ====================\n\n /**\n * Get all billing accounts for the current user.\n *\n * @returns Array of billing accounts\n */\n async getBillingAccounts(): Promise<BillingAccount[]> {\n const { data, error } = await this.client.GET(\"/billing\");\n if (error) this.handleError(\"get billing accounts\", error);\n return data!;\n }\n\n /**\n * Get a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Billing account details\n */\n async getBillingAccount(billingAccountId: string): Promise<BillingAccount> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account\", error);\n return data!;\n }\n\n /**\n * Get invoices for a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Array of invoices\n */\n async getBillingAccountInvoices(billingAccountId: string): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}/invoices\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account invoices\", error);\n return data!;\n }\n\n /**\n * Create a Stripe setup session for a new billing account.\n *\n * @param body - Setup session creation payload\n * @returns Setup session with redirect URL\n */\n async createSetupSession(body: CreateSetupSessionPayload): Promise<SetupSession> {\n const { data, error } = await this.client.POST(\"/billing/create-setup-session\", {\n body,\n });\n if (error) this.handleError(\"create setup session\", error);\n return data!;\n }\n\n /**\n * Create a Stripe billing portal session.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @param body - Portal session creation payload\n * @returns Portal session with redirect URL\n */\n async createBillingPortalSession(billingAccountId: string, body: CreateBillingPortalSessionPayload): Promise<PortalSession> {\n const { data, error } = await this.client.POST(\"/billing/{billingAccountId}/create-billing-portal-session\", {\n params: { path: { billingAccountId } },\n body,\n });\n if (error) this.handleError(\"create billing portal session\", error);\n return data!;\n }\n\n /**\n * Get billing options for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Billing options including current state and change options\n */\n async getBillingOptions(projectId: string): Promise<BillingOptions> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/get-billing-options\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get billing options\", error);\n return data!;\n }\n\n /**\n * Set a billing account on a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Billing account and state to set\n * @returns Success response\n */\n async setBillingAccount(projectId: string, body: SetBillingAccountPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/set-billing-account\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"set billing account\", error);\n return data!;\n }\n\n /**\n * Cancel billing for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Success response\n */\n async cancelBilling(projectId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/cancel-billing\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"cancel billing\", error);\n return data!;\n }\n\n // ==================== API Activation ====================\n\n /**\n * Activate an API for the specified project.\n *\n * @deprecated Use {@link activateProduct} instead.\n * @param projectId - The unique identifier of the project\n * @param body - The API slug to activate\n * @returns Success response\n */\n async activateAPI(projectId: string, body: ActivateAPIPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-api\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate API\", error);\n return data!;\n }\n\n // ==================== Products ====================\n\n /**\n * List all available products.\n *\n * @returns Array of available products with features and pricing\n */\n async getProducts(): Promise<ProjectProduct[]> {\n const { data, error } = await this.client.GET(\"/products\");\n if (error) this.handleError(\"get products\", error);\n return data!;\n }\n\n /**\n * Get product details by slug.\n *\n * @param slug - The product slug (e.g. voice, rooms, fleet, cortex)\n * @returns Product details including features, pricing, and dependencies\n */\n async getProduct(slug: ProductSlug): Promise<ProjectProduct> {\n const { data, error } = await this.client.GET(\"/products/{slug}\", {\n params: { path: { slug } },\n });\n if (error) this.handleError(\"get product\", error);\n return data!;\n }\n\n /**\n * Get activated products for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Array of activated products\n */\n async getProjectProducts(projectId: string): Promise<ActivatedProduct[]> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/products\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project products\", error);\n return data!;\n }\n\n /**\n * Activate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug and optional configuration\n * @returns Updated project\n */\n async activateProduct(projectId: string, body: ActivateProductPayload): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate product\", error);\n return data!;\n }\n\n /**\n * Deactivate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug to deactivate\n * @returns Success response\n */\n async deactivateProduct(projectId: string, body: DeactivateProductPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/deactivate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"deactivate product\", error);\n return data!;\n }\n\n /**\n * Check if a feature is available for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the feature slug to check\n * @returns Feature availability status\n */\n async checkFeature(projectId: string, query: CheckFeatureQuery): Promise<FeatureAvailability> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-feature\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check feature\", error);\n return data!;\n }\n\n /**\n * Check product dependencies for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the product slug to check\n * @returns Dependency check result with activation status of each dependency\n */\n async checkProductDependencies(projectId: string, query: CheckProductDependenciesQuery): Promise<ProductDependencyCheck> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-product-dependencies\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check product dependencies\", error);\n return data!;\n }\n\n // ==================== Invoices ====================\n\n /**\n * Get all invoices for the current user, optionally filtered by ID.\n *\n * @param query - Optional query parameters for filtering by invoice IDs\n * @returns Array of invoices\n */\n async getInvoices(query?: GetInvoicesQuery): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/invoices\", {\n params: { query },\n });\n if (error) this.handleError(\"get invoices\", error);\n return data!;\n }\n\n /**\n * Get a preview of the current month's invoice for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Invoice preview\n */\n async getInvoicePreview(projectId: string): Promise<Invoice> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/preview-invoice\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get invoice preview\", error);\n return data!;\n }\n\n // ==================== Access Keys ====================\n\n /**\n * Get a specific access key.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Access key details\n */\n async getAccessKey(accessKeyId: string): Promise<OdinAccessKey> {\n const { data, error } = await this.client.GET(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"get access key\", error);\n return data!;\n }\n\n /**\n * Create a new access key for a project.\n *\n * @param body - Access key creation payload\n * @returns Created access key (includes the key value only in this response)\n */\n async createAccessKey(body: CreateAccessKeyPayload): Promise<OdinAccessKey> {\n const { data, error } = await this.client.POST(\"/odin-access-keys/\", {\n body,\n });\n if (error) this.handleError(\"create access key\", error);\n return data!;\n }\n\n /**\n * Update an existing access key's name or description.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @param body - Updated access key fields\n * @returns Success response\n */\n async editAccessKey(accessKeyId: string, body: EditAccessKeyPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n body,\n });\n if (error) this.handleError(\"edit access key\", error);\n return data!;\n }\n\n /**\n * Delete an access key. This operation is irreversible.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Success response\n */\n async deleteAccessKey(accessKeyId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.DELETE(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"delete access key\", error);\n return data!;\n }\n\n // ==================== Project Members ====================\n\n /**\n * Add a user to a project with a specified role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - User email and role\n * @returns The created user role\n */\n async addProjectMember(projectId: string, body: AddUserToProjectPayload): Promise<OdinUserRole> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/add-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"add project member\", error);\n return data!;\n }\n\n /**\n * Revoke a user's permission from a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID to revoke\n * @returns Success response\n */\n async deleteProjectMember(projectId: string, body: RevokeUserPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"delete project member\", error);\n return data!;\n }\n\n /**\n * Change a project member's role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID and new role\n * @returns Success response\n */\n async changeMemberRole(projectId: string, body: ChangeUserRolePayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/change-user-role\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"change member role\", error);\n return data!;\n }\n\n // ==================== Tokens & Secrets ====================\n\n /**\n * Create an ODIN access token for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Token creation payload\n * @returns The created token\n */\n async createAccessToken(projectId: string, body: CreateTokenPayload): Promise<TokenPayload> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/create-token\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"create access token\", error);\n return data!;\n }\n\n /**\n * Revoke the secret for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Updated project with new secret\n */\n async revokeSecret(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-secret\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"revoke secret\", error);\n return data!;\n }\n\n // ==================== Resource Package Pricing ====================\n\n /**\n * Get the price for a single resource package in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package, region, and quantity\n * @returns Price information\n */\n async getResourcePackagePrice(projectId: string, body: ResourcePackagePricePayload): Promise<ResourcePackagePrice> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-price\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package price\", error);\n return data!;\n }\n\n /**\n * Get prices for multiple resource packages in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package IDs, region, and quantity\n * @returns Array of price information\n */\n async getResourcePackagePrices(projectId: string, body: ResourcePackagePricesPayload): Promise<ResourcePackagePrice[]> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-prices\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package prices\", error);\n return data!;\n }\n}\n\nexport default PaymentClient;\n"]}
package/dist/index.d.cts CHANGED
@@ -476,6 +476,27 @@ interface paths {
476
476
  patch?: never;
477
477
  trace?: never;
478
478
  };
479
+ "/products/{slug}": {
480
+ parameters: {
481
+ query?: never;
482
+ header?: never;
483
+ path?: never;
484
+ cookie?: never;
485
+ };
486
+ /**
487
+ * Get product details by slug
488
+ * @description Returns the full details of a single product including features, pricing tiers,
489
+ * dependencies and links. No authentication required.
490
+ */
491
+ get: operations["getProduct"];
492
+ put?: never;
493
+ post?: never;
494
+ delete?: never;
495
+ options?: never;
496
+ head?: never;
497
+ patch?: never;
498
+ trace?: never;
499
+ };
479
500
  "/projects/{projectId}/products": {
480
501
  parameters: {
481
502
  query?: never;
@@ -1185,6 +1206,12 @@ interface components {
1185
1206
  description?: string;
1186
1207
  /** @description Icon identifier or URL. */
1187
1208
  icon?: string | null;
1209
+ /** @description URL to the terms and conditions for this product. */
1210
+ termsUrl?: string | null;
1211
+ /** @description URL to the pricing page for this product. */
1212
+ pricingUrl?: string | null;
1213
+ /** @description URL to the product website. */
1214
+ websiteUrl?: string | null;
1188
1215
  /** @description Features available within this product. */
1189
1216
  features?: components["schemas"]["ProjectProductFeature"][];
1190
1217
  /** @description Available pricing tiers for this product. */
@@ -2418,6 +2445,36 @@ interface operations {
2418
2445
  };
2419
2446
  };
2420
2447
  };
2448
+ getProduct: {
2449
+ parameters: {
2450
+ query?: never;
2451
+ header?: never;
2452
+ path: {
2453
+ /** @description The product slug (e.g. voice, rooms, fleet, cortex). */
2454
+ slug: components["schemas"]["ProductSlug"];
2455
+ };
2456
+ cookie?: never;
2457
+ };
2458
+ requestBody?: never;
2459
+ responses: {
2460
+ /** @description Product details. */
2461
+ 200: {
2462
+ headers: {
2463
+ [name: string]: unknown;
2464
+ };
2465
+ content: {
2466
+ "application/json": components["schemas"]["ProjectProduct"];
2467
+ };
2468
+ };
2469
+ /** @description Product not found */
2470
+ 404: {
2471
+ headers: {
2472
+ [name: string]: unknown;
2473
+ };
2474
+ content?: never;
2475
+ };
2476
+ };
2477
+ };
2421
2478
  getProjectProducts: {
2422
2479
  parameters: {
2423
2480
  query?: never;
@@ -3164,6 +3221,13 @@ declare class PaymentClient {
3164
3221
  * @returns Array of available products with features and pricing
3165
3222
  */
3166
3223
  getProducts(): Promise<ProjectProduct[]>;
3224
+ /**
3225
+ * Get product details by slug.
3226
+ *
3227
+ * @param slug - The product slug (e.g. voice, rooms, fleet, cortex)
3228
+ * @returns Product details including features, pricing, and dependencies
3229
+ */
3230
+ getProduct(slug: ProductSlug): Promise<ProjectProduct>;
3167
3231
  /**
3168
3232
  * Get activated products for a project.
3169
3233
  *
package/dist/index.d.ts CHANGED
@@ -476,6 +476,27 @@ interface paths {
476
476
  patch?: never;
477
477
  trace?: never;
478
478
  };
479
+ "/products/{slug}": {
480
+ parameters: {
481
+ query?: never;
482
+ header?: never;
483
+ path?: never;
484
+ cookie?: never;
485
+ };
486
+ /**
487
+ * Get product details by slug
488
+ * @description Returns the full details of a single product including features, pricing tiers,
489
+ * dependencies and links. No authentication required.
490
+ */
491
+ get: operations["getProduct"];
492
+ put?: never;
493
+ post?: never;
494
+ delete?: never;
495
+ options?: never;
496
+ head?: never;
497
+ patch?: never;
498
+ trace?: never;
499
+ };
479
500
  "/projects/{projectId}/products": {
480
501
  parameters: {
481
502
  query?: never;
@@ -1185,6 +1206,12 @@ interface components {
1185
1206
  description?: string;
1186
1207
  /** @description Icon identifier or URL. */
1187
1208
  icon?: string | null;
1209
+ /** @description URL to the terms and conditions for this product. */
1210
+ termsUrl?: string | null;
1211
+ /** @description URL to the pricing page for this product. */
1212
+ pricingUrl?: string | null;
1213
+ /** @description URL to the product website. */
1214
+ websiteUrl?: string | null;
1188
1215
  /** @description Features available within this product. */
1189
1216
  features?: components["schemas"]["ProjectProductFeature"][];
1190
1217
  /** @description Available pricing tiers for this product. */
@@ -2418,6 +2445,36 @@ interface operations {
2418
2445
  };
2419
2446
  };
2420
2447
  };
2448
+ getProduct: {
2449
+ parameters: {
2450
+ query?: never;
2451
+ header?: never;
2452
+ path: {
2453
+ /** @description The product slug (e.g. voice, rooms, fleet, cortex). */
2454
+ slug: components["schemas"]["ProductSlug"];
2455
+ };
2456
+ cookie?: never;
2457
+ };
2458
+ requestBody?: never;
2459
+ responses: {
2460
+ /** @description Product details. */
2461
+ 200: {
2462
+ headers: {
2463
+ [name: string]: unknown;
2464
+ };
2465
+ content: {
2466
+ "application/json": components["schemas"]["ProjectProduct"];
2467
+ };
2468
+ };
2469
+ /** @description Product not found */
2470
+ 404: {
2471
+ headers: {
2472
+ [name: string]: unknown;
2473
+ };
2474
+ content?: never;
2475
+ };
2476
+ };
2477
+ };
2421
2478
  getProjectProducts: {
2422
2479
  parameters: {
2423
2480
  query?: never;
@@ -3164,6 +3221,13 @@ declare class PaymentClient {
3164
3221
  * @returns Array of available products with features and pricing
3165
3222
  */
3166
3223
  getProducts(): Promise<ProjectProduct[]>;
3224
+ /**
3225
+ * Get product details by slug.
3226
+ *
3227
+ * @param slug - The product slug (e.g. voice, rooms, fleet, cortex)
3228
+ * @returns Product details including features, pricing, and dependencies
3229
+ */
3230
+ getProduct(slug: ProductSlug): Promise<ProjectProduct>;
3167
3231
  /**
3168
3232
  * Get activated products for a project.
3169
3233
  *
package/dist/index.js CHANGED
@@ -404,6 +404,19 @@ var PaymentClient = class {
404
404
  if (error) this.handleError("get products", error);
405
405
  return data;
406
406
  }
407
+ /**
408
+ * Get product details by slug.
409
+ *
410
+ * @param slug - The product slug (e.g. voice, rooms, fleet, cortex)
411
+ * @returns Product details including features, pricing, and dependencies
412
+ */
413
+ async getProduct(slug) {
414
+ const { data, error } = await this.client.GET("/products/{slug}", {
415
+ params: { path: { slug } }
416
+ });
417
+ if (error) this.handleError("get product", error);
418
+ return data;
419
+ }
407
420
  /**
408
421
  * Get activated products for a project.
409
422
  *
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/errors.ts","../src/client.ts"],"names":[],"mappings":";;;;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EACtC,WAAA,CACE,OAAA,EACgB,UAAA,EACA,OAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAEZ,IAAA,IAAI,OAAO,KAAA,CAAM,iBAAA,KAAsB,UAAA,EAAY;AACjD,MAAA,KAAA,CAAM,iBAAA,CAAkB,MAAM,aAAY,CAAA;AAAA,IAC5C;AAAA,EACF;AACF;AAeO,IAAM,eAAA,GAAN,cAA8B,YAAA,CAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAA;AAAA,EAEhB,WAAA,CAAY,OAAA,EAAiB,IAAA,EAAc,UAAA,EAAoB;AAC7D,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,UAAA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/**\n * Payment SDK Error Classes\n *\n * Provides structured error handling for Payment API operations.\n */\n\n// V8-specific stack trace capture (available in Node.js, Chrome, etc.)\ndeclare const Error: ErrorConstructor & {\n captureStackTrace?(targetObject: object, constructorOpt?: Function): void;\n};\n\n/**\n * Base error class for all Payment SDK errors.\n */\nexport class PaymentError extends Error {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly details?: unknown\n ) {\n super(message);\n this.name = \"PaymentError\";\n // Maintains proper stack trace for where error was thrown (V8 engines)\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, PaymentError);\n }\n }\n}\n\n/**\n * Error thrown when the Payment API returns an application-level error\n * in its response envelope.\n *\n * The Payment API wraps all responses in an envelope:\n * ```json\n * { \"data\": T | null, \"error\": { \"code\": number, \"message\": string } }\n * ```\n *\n * A `PaymentApiError` is thrown when:\n * - `error.code !== 0` (application-level error, even if HTTP status is 200)\n * - `data` is `null` (legacy error pattern from before HTTP status codes were used)\n */\nexport class PaymentApiError extends PaymentError {\n /**\n * Application-level error code from the response envelope.\n * A value of `0` means no specific error code was returned (legacy null-data case).\n */\n public readonly code: number;\n\n /**\n * The HTTP status code of the response.\n * Note: This may be `200` even when there is an application error.\n */\n public readonly httpStatus: number;\n\n constructor(message: string, code: number, httpStatus: number) {\n super(message, httpStatus);\n this.name = \"PaymentApiError\";\n this.code = code;\n this.httpStatus = httpStatus;\n }\n}\n\n/**\n * Error thrown when authentication fails or is required.\n */\nexport class PaymentAuthError extends PaymentError {\n constructor(message = \"Authentication required. Please provide a valid session ID.\") {\n super(message, 401);\n this.name = \"PaymentAuthError\";\n }\n}\n\n/**\n * Error thrown when a requested resource is not found.\n */\nexport class PaymentNotFoundError extends PaymentError {\n constructor(resource: string, id: string) {\n super(`${resource} with ID ${id} not found`, 404);\n this.name = \"PaymentNotFoundError\";\n }\n}\n\n/**\n * Error thrown when request validation fails.\n */\nexport class PaymentValidationError extends PaymentError {\n constructor(message: string, details?: unknown) {\n super(message, 422, details);\n this.name = \"PaymentValidationError\";\n }\n}\n\n/**\n * Error thrown when the API rate limit is exceeded.\n */\nexport class PaymentRateLimitError extends PaymentError {\n constructor(retryAfter?: number) {\n super(\n retryAfter\n ? `Rate limit exceeded. Retry after ${retryAfter} seconds.`\n : \"Rate limit exceeded. Please try again later.\",\n 429,\n { retryAfter }\n );\n this.name = \"PaymentRateLimitError\";\n }\n}\n","/**\n * 4Players Payment API Client\n *\n * A type-safe client for the 4Players Payment API.\n * Works in browsers, Node.js, Deno, Bun, and edge runtimes.\n *\n * @example\n * ```typescript\n * import { PaymentClient } from '@4players/payment';\n *\n * const client = new PaymentClient({ sessionId: 'your-session-id' });\n *\n * const projects = await client.getProjects();\n * ```\n */\n\nimport createClient, { type Middleware } from \"openapi-fetch\";\nimport type { paths, components, operations } from \"./types.js\";\nimport {\n PaymentError,\n PaymentApiError,\n PaymentAuthError,\n PaymentNotFoundError,\n PaymentRateLimitError,\n} from \"./errors.js\";\n\nconst DEFAULT_BASE_URL = \"https://secure.4players.de/public/api/v1\";\n\n/**\n * Configuration options for the Payment client.\n */\nexport interface PaymentClientConfig {\n /** Fusion session ID for authentication (sent as fusion-sid header) */\n sessionId: string;\n /** Base URL for the Payment API (default: https://secure.4players.de/public/api/v1) */\n baseUrl?: string;\n /** Custom fetch implementation (useful for testing or special environments) */\n fetch?: typeof fetch;\n}\n\n// ==================== Entity types from components.schemas ====================\n\nexport type PaymentProject = components[\"schemas\"][\"PaymentProject\"];\nexport type BillingAccount = components[\"schemas\"][\"BillingAccount\"];\nexport type OdinAccessKey = components[\"schemas\"][\"OdinAccessKey\"];\nexport type OdinUserPermissions = components[\"schemas\"][\"OdinUserPermissions\"];\nexport type OdinUserRole = components[\"schemas\"][\"OdinUserRole\"];\nexport type TimeSeriesData = components[\"schemas\"][\"TimeSeriesData\"];\nexport type Subscription = components[\"schemas\"][\"Subscription\"];\nexport type Invoice = components[\"schemas\"][\"Invoice\"];\nexport type InvoicePosition = components[\"schemas\"][\"InvoicePosition\"];\nexport type Invoices = components[\"schemas\"][\"Invoices\"];\nexport type SubscriptionPosition = components[\"schemas\"][\"SubscriptionPosition\"];\nexport type TariffParams = components[\"schemas\"][\"TariffParams\"];\nexport type SetupSession = components[\"schemas\"][\"SetupSession\"];\nexport type PortalSession = components[\"schemas\"][\"PortalSession\"];\nexport type TokenPayload = components[\"schemas\"][\"TokenPayload\"];\nexport type BillingOptions = components[\"schemas\"][\"BillingOptions\"];\nexport type BillingChangeOptions = components[\"schemas\"][\"BillingChangeOptions\"];\nexport type BillingStateHistory = components[\"schemas\"][\"BillingStateHistory\"];\nexport type ResourcePackagePrice = components[\"schemas\"][\"ResourcePackagePrice\"];\nexport type SuccessResponse = components[\"schemas\"][\"SuccessResponse\"];\nexport type ProjectProduct = components[\"schemas\"][\"ProjectProduct\"];\nexport type ProjectProductFeature = components[\"schemas\"][\"ProjectProductFeature\"];\nexport type ProductPricing = components[\"schemas\"][\"ProductPricing\"];\nexport type ActivatedProduct = components[\"schemas\"][\"ActivatedProduct\"];\nexport type FeatureAvailability = components[\"schemas\"][\"FeatureAvailability\"];\nexport type ProductDependencyCheck = components[\"schemas\"][\"ProductDependencyCheck\"];\nexport type ProductDependencyStatus = components[\"schemas\"][\"ProductDependencyStatus\"];\n\n// Enum types\nexport type APIType = components[\"schemas\"][\"APIType\"];\nexport type BillingState = components[\"schemas\"][\"BillingState\"];\nexport type PermissionRole = components[\"schemas\"][\"PermissionRole\"];\nexport type UserStatus = components[\"schemas\"][\"UserStatus\"];\nexport type InvoiceStatus = components[\"schemas\"][\"InvoiceStatus\"];\nexport type ProductSlug = components[\"schemas\"][\"ProductSlug\"];\nexport type PricingType = components[\"schemas\"][\"PricingType\"];\n\n// ==================== Request/Payload types ====================\n\nexport type ActivateAPIPayload = components[\"schemas\"][\"ActivateAPIPayload\"];\nexport type AddUserToProjectPayload = components[\"schemas\"][\"AddUserToProjectPayload\"];\nexport type ChangeUserRolePayload = components[\"schemas\"][\"ChangeUserRolePayload\"];\nexport type CreateAccessKeyPayload = components[\"schemas\"][\"CreateAccessKeyPayload\"];\nexport type CreateBillingPortalSessionPayload = components[\"schemas\"][\"CreateBillingPortalSessionPayload\"];\nexport type CreateSetupSessionPayload = components[\"schemas\"][\"CreateSetupSessionPayload\"];\nexport type CreateTokenPayload = components[\"schemas\"][\"CreateTokenPayload\"];\nexport type EditAccessKeyPayload = components[\"schemas\"][\"EditAccessKeyPayload\"];\nexport type EditProjectPayload = components[\"schemas\"][\"EditProjectPayload\"];\nexport type ResourcePackagePricePayload = components[\"schemas\"][\"ResourcePackagePricePayload\"];\nexport type ResourcePackagePricesPayload = components[\"schemas\"][\"ResourcePackagePricesPayload\"];\nexport type RevokeUserPayload = components[\"schemas\"][\"RevokeUserPayload\"];\nexport type SetBillingAccountPayload = components[\"schemas\"][\"SetBillingAccountPayload\"];\nexport type ActivateProductPayload = components[\"schemas\"][\"ActivateProductPayload\"];\nexport type DeactivateProductPayload = components[\"schemas\"][\"DeactivateProductPayload\"];\n\n// ==================== Query parameter types ====================\n\nexport type GetProjectsQuery = operations[\"getProjects\"][\"parameters\"][\"query\"];\nexport type GetPeersOverTimeQuery = operations[\"getPeersOverTime\"][\"parameters\"][\"query\"];\nexport type GetRoomsOverTimeQuery = operations[\"getRoomsOverTime\"][\"parameters\"][\"query\"];\nexport type GetInstancesOverTimeQuery = operations[\"getInstancesOverTime\"][\"parameters\"][\"query\"];\nexport type GetInvoicesQuery = operations[\"getInvoices\"][\"parameters\"][\"query\"];\nexport type CheckFeatureQuery = operations[\"checkFeature\"][\"parameters\"][\"query\"];\nexport type CheckProductDependenciesQuery = operations[\"checkProductDependencies\"][\"parameters\"][\"query\"];\n\n/**\n * Response envelope used by the Payment API.\n */\ninterface PaymentEnvelope<T = unknown> {\n data: T | null;\n error: {\n code: number;\n message: string;\n };\n}\n\n/**\n * 4Players Payment API Client\n *\n * Provides a type-safe interface to the 4Players Payment REST API for managing\n * projects, billing, invoices, access keys, and user permissions.\n */\nexport class PaymentClient {\n private client: ReturnType<typeof createClient<paths>>;\n\n /**\n * Create a new Payment client instance.\n *\n * @param config - Client configuration\n * @throws {PaymentAuthError} If no session ID is provided\n *\n * @example\n * ```typescript\n * const client = new PaymentClient({\n * sessionId: 'your-fusion-sid'\n * });\n * ```\n */\n constructor(config: PaymentClientConfig) {\n if (!config.sessionId) {\n throw new PaymentAuthError(\"Session ID is required\");\n }\n\n this.client = createClient<paths>({\n baseUrl: config.baseUrl || DEFAULT_BASE_URL,\n headers: {\n \"fusion-sid\": config.sessionId,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n },\n fetch: config.fetch,\n });\n\n // Register the envelope-unwrapping middleware\n this.client.use(this.createEnvelopeMiddleware());\n }\n\n /**\n * Creates middleware that unwraps the Payment API response envelope.\n *\n * The Payment API wraps ALL responses in `{ data, error }`.\n * This middleware:\n * 1. Checks `error.code` — if non-zero, throws `PaymentApiError`\n * 2. Checks `data` — if null, throws `PaymentApiError` (legacy error pattern)\n * 3. Returns a new Response containing only the unwrapped `data`\n */\n private createEnvelopeMiddleware(): Middleware {\n return {\n async onResponse({ response }) {\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return response;\n }\n\n const text = await response.clone().text();\n let body: unknown;\n try {\n body = JSON.parse(text);\n } catch {\n return response;\n }\n\n if (\n body !== null &&\n typeof body === \"object\" &&\n \"error\" in body &&\n \"data\" in body\n ) {\n const envelope = body as PaymentEnvelope;\n\n // Application-level error (can happen even with HTTP 200!)\n if (envelope.error && envelope.error.code !== 0) {\n throw new PaymentApiError(\n envelope.error.message,\n envelope.error.code,\n response.status\n );\n }\n\n // Legacy error pattern: data is null with HTTP 200\n if (envelope.data === null || envelope.data === undefined) {\n throw new PaymentApiError(\n envelope.error?.message || \"Response data is null\",\n envelope.error?.code || 0,\n response.status\n );\n }\n\n // Return unwrapped data so openapi-fetch sees the schema-matching body\n return new Response(JSON.stringify(envelope.data), {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n }\n\n // Not an envelope — return as-is\n return response;\n },\n };\n }\n\n private handleError(operation: string, error: unknown): never {\n if (error && typeof error === \"object\") {\n const errorObj = error as Record<string, unknown>;\n\n if (errorObj.status === 401 || errorObj.status === 403) {\n throw new PaymentAuthError();\n }\n if (errorObj.status === 404) {\n throw new PaymentNotFoundError(operation, \"unknown\");\n }\n if (errorObj.status === 429) {\n throw new PaymentRateLimitError();\n }\n }\n\n throw new PaymentError(\n `Failed to ${operation}: ${JSON.stringify(error)}`,\n undefined,\n error\n );\n }\n\n // ==================== Fleet Apps ====================\n\n /**\n * Get all fleet apps the user has access to (projects with Fleet activated).\n *\n * @returns Array of payment projects with Fleet app IDs\n */\n async getFleetProjects(): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/apps\");\n if (error) this.handleError(\"get fleet projects\", error);\n return data!;\n }\n\n /**\n * Get the details of a specific fleet app including the payment project.\n *\n * @param appId - The ID of the fleet app to retrieve\n * @returns Payment project details\n */\n async getFleetProject(appId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/apps/{app_id}\", {\n params: { path: { app_id: appId } },\n });\n if (error) this.handleError(\"get fleet project\", error);\n return data!;\n }\n\n // ==================== Projects ====================\n\n /**\n * Get all projects the authenticated user has access to.\n *\n * @param query - Optional query parameters to filter by project type\n * @returns Array of payment projects\n */\n async getProjects(query?: GetProjectsQuery): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/projects\", {\n params: { query },\n });\n if (error) this.handleError(\"get projects\", error);\n return data!;\n }\n\n /**\n * Get a specific project by ID.\n *\n * @param projectId - The unique identifier of the project\n * @returns Project details\n */\n async getProject(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project\", error);\n return data!;\n }\n\n /**\n * Update a project's name, description, or peer limit.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Updated project fields\n * @returns Success response\n */\n async editProject(projectId: string, body: EditProjectPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"edit project\", error);\n return data!;\n }\n\n // ==================== Peers / Metrics ====================\n\n /**\n * Get peak peers over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required)\n * @returns Peers over time data\n */\n async getPeersOverTime(projectId: string, query: GetPeersOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/peers-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get peers over time\", error);\n return data!;\n }\n\n /**\n * Get room count over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of active rooms\n */\n async getRoomsOverTime(projectId: string, query: GetRoomsOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/rooms-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get rooms over time\", error);\n return data!;\n }\n\n /**\n * Get Fleet server instances over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of deployed server instances\n */\n async getInstancesOverTime(projectId: string, query: GetInstancesOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/instances-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get instances over time\", error);\n return data!;\n }\n\n // ==================== Billing ====================\n\n /**\n * Get all billing accounts for the current user.\n *\n * @returns Array of billing accounts\n */\n async getBillingAccounts(): Promise<BillingAccount[]> {\n const { data, error } = await this.client.GET(\"/billing\");\n if (error) this.handleError(\"get billing accounts\", error);\n return data!;\n }\n\n /**\n * Get a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Billing account details\n */\n async getBillingAccount(billingAccountId: string): Promise<BillingAccount> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account\", error);\n return data!;\n }\n\n /**\n * Get invoices for a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Array of invoices\n */\n async getBillingAccountInvoices(billingAccountId: string): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}/invoices\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account invoices\", error);\n return data!;\n }\n\n /**\n * Create a Stripe setup session for a new billing account.\n *\n * @param body - Setup session creation payload\n * @returns Setup session with redirect URL\n */\n async createSetupSession(body: CreateSetupSessionPayload): Promise<SetupSession> {\n const { data, error } = await this.client.POST(\"/billing/create-setup-session\", {\n body,\n });\n if (error) this.handleError(\"create setup session\", error);\n return data!;\n }\n\n /**\n * Create a Stripe billing portal session.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @param body - Portal session creation payload\n * @returns Portal session with redirect URL\n */\n async createBillingPortalSession(billingAccountId: string, body: CreateBillingPortalSessionPayload): Promise<PortalSession> {\n const { data, error } = await this.client.POST(\"/billing/{billingAccountId}/create-billing-portal-session\", {\n params: { path: { billingAccountId } },\n body,\n });\n if (error) this.handleError(\"create billing portal session\", error);\n return data!;\n }\n\n /**\n * Get billing options for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Billing options including current state and change options\n */\n async getBillingOptions(projectId: string): Promise<BillingOptions> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/get-billing-options\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get billing options\", error);\n return data!;\n }\n\n /**\n * Set a billing account on a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Billing account and state to set\n * @returns Success response\n */\n async setBillingAccount(projectId: string, body: SetBillingAccountPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/set-billing-account\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"set billing account\", error);\n return data!;\n }\n\n /**\n * Cancel billing for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Success response\n */\n async cancelBilling(projectId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/cancel-billing\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"cancel billing\", error);\n return data!;\n }\n\n // ==================== API Activation ====================\n\n /**\n * Activate an API for the specified project.\n *\n * @deprecated Use {@link activateProduct} instead.\n * @param projectId - The unique identifier of the project\n * @param body - The API slug to activate\n * @returns Success response\n */\n async activateAPI(projectId: string, body: ActivateAPIPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-api\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate API\", error);\n return data!;\n }\n\n // ==================== Products ====================\n\n /**\n * List all available products.\n *\n * @returns Array of available products with features and pricing\n */\n async getProducts(): Promise<ProjectProduct[]> {\n const { data, error } = await this.client.GET(\"/products\");\n if (error) this.handleError(\"get products\", error);\n return data!;\n }\n\n /**\n * Get activated products for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Array of activated products\n */\n async getProjectProducts(projectId: string): Promise<ActivatedProduct[]> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/products\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project products\", error);\n return data!;\n }\n\n /**\n * Activate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug and optional configuration\n * @returns Updated project\n */\n async activateProduct(projectId: string, body: ActivateProductPayload): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate product\", error);\n return data!;\n }\n\n /**\n * Deactivate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug to deactivate\n * @returns Success response\n */\n async deactivateProduct(projectId: string, body: DeactivateProductPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/deactivate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"deactivate product\", error);\n return data!;\n }\n\n /**\n * Check if a feature is available for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the feature slug to check\n * @returns Feature availability status\n */\n async checkFeature(projectId: string, query: CheckFeatureQuery): Promise<FeatureAvailability> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-feature\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check feature\", error);\n return data!;\n }\n\n /**\n * Check product dependencies for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the product slug to check\n * @returns Dependency check result with activation status of each dependency\n */\n async checkProductDependencies(projectId: string, query: CheckProductDependenciesQuery): Promise<ProductDependencyCheck> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-product-dependencies\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check product dependencies\", error);\n return data!;\n }\n\n // ==================== Invoices ====================\n\n /**\n * Get all invoices for the current user, optionally filtered by ID.\n *\n * @param query - Optional query parameters for filtering by invoice IDs\n * @returns Array of invoices\n */\n async getInvoices(query?: GetInvoicesQuery): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/invoices\", {\n params: { query },\n });\n if (error) this.handleError(\"get invoices\", error);\n return data!;\n }\n\n /**\n * Get a preview of the current month's invoice for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Invoice preview\n */\n async getInvoicePreview(projectId: string): Promise<Invoice> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/preview-invoice\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get invoice preview\", error);\n return data!;\n }\n\n // ==================== Access Keys ====================\n\n /**\n * Get a specific access key.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Access key details\n */\n async getAccessKey(accessKeyId: string): Promise<OdinAccessKey> {\n const { data, error } = await this.client.GET(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"get access key\", error);\n return data!;\n }\n\n /**\n * Create a new access key for a project.\n *\n * @param body - Access key creation payload\n * @returns Created access key (includes the key value only in this response)\n */\n async createAccessKey(body: CreateAccessKeyPayload): Promise<OdinAccessKey> {\n const { data, error } = await this.client.POST(\"/odin-access-keys/\", {\n body,\n });\n if (error) this.handleError(\"create access key\", error);\n return data!;\n }\n\n /**\n * Update an existing access key's name or description.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @param body - Updated access key fields\n * @returns Success response\n */\n async editAccessKey(accessKeyId: string, body: EditAccessKeyPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n body,\n });\n if (error) this.handleError(\"edit access key\", error);\n return data!;\n }\n\n /**\n * Delete an access key. This operation is irreversible.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Success response\n */\n async deleteAccessKey(accessKeyId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.DELETE(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"delete access key\", error);\n return data!;\n }\n\n // ==================== Project Members ====================\n\n /**\n * Add a user to a project with a specified role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - User email and role\n * @returns The created user role\n */\n async addProjectMember(projectId: string, body: AddUserToProjectPayload): Promise<OdinUserRole> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/add-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"add project member\", error);\n return data!;\n }\n\n /**\n * Revoke a user's permission from a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID to revoke\n * @returns Success response\n */\n async deleteProjectMember(projectId: string, body: RevokeUserPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"delete project member\", error);\n return data!;\n }\n\n /**\n * Change a project member's role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID and new role\n * @returns Success response\n */\n async changeMemberRole(projectId: string, body: ChangeUserRolePayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/change-user-role\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"change member role\", error);\n return data!;\n }\n\n // ==================== Tokens & Secrets ====================\n\n /**\n * Create an ODIN access token for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Token creation payload\n * @returns The created token\n */\n async createAccessToken(projectId: string, body: CreateTokenPayload): Promise<TokenPayload> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/create-token\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"create access token\", error);\n return data!;\n }\n\n /**\n * Revoke the secret for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Updated project with new secret\n */\n async revokeSecret(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-secret\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"revoke secret\", error);\n return data!;\n }\n\n // ==================== Resource Package Pricing ====================\n\n /**\n * Get the price for a single resource package in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package, region, and quantity\n * @returns Price information\n */\n async getResourcePackagePrice(projectId: string, body: ResourcePackagePricePayload): Promise<ResourcePackagePrice> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-price\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package price\", error);\n return data!;\n }\n\n /**\n * Get prices for multiple resource packages in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package IDs, region, and quantity\n * @returns Array of price information\n */\n async getResourcePackagePrices(projectId: string, body: ResourcePackagePricesPayload): Promise<ResourcePackagePrice[]> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-prices\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package prices\", error);\n return data!;\n }\n}\n\nexport default PaymentClient;\n"]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/client.ts"],"names":[],"mappings":";;;;;AAcO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,KAAA,CAAM;AAAA,EACtC,WAAA,CACE,OAAA,EACgB,UAAA,EACA,OAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGhB,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AAEZ,IAAA,IAAI,OAAO,KAAA,CAAM,iBAAA,KAAsB,UAAA,EAAY;AACjD,MAAA,KAAA,CAAM,iBAAA,CAAkB,MAAM,aAAY,CAAA;AAAA,IAC5C;AAAA,EACF;AACF;AAeO,IAAM,eAAA,GAAN,cAA8B,YAAA,CAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAA;AAAA,EAEhB,WAAA,CAAY,OAAA,EAAiB,IAAA,EAAc,UAAA,EAAoB;AAC7D,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AACF;AAKO,IAAM,gBAAA,GAAN,cAA+B,YAAA,CAAa;AAAA,EACjD,WAAA,CAAY,UAAU,6DAAA,EAA+D;AACnF,IAAA,KAAA,CAAM,SAAS,GAAG,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;AAKO,IAAM,oBAAA,GAAN,cAAmC,YAAA,CAAa;AAAA,EACrD,WAAA,CAAY,UAAkB,EAAA,EAAY;AACxC,I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;AAEA,IAAO,cAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * Payment SDK Error Classes\n *\n * Provides structured error handling for Payment API operations.\n */\n\n// V8-specific stack trace capture (available in Node.js, Chrome, etc.)\ndeclare const Error: ErrorConstructor & {\n captureStackTrace?(targetObject: object, constructorOpt?: Function): void;\n};\n\n/**\n * Base error class for all Payment SDK errors.\n */\nexport class PaymentError extends Error {\n constructor(\n message: string,\n public readonly statusCode?: number,\n public readonly details?: unknown\n ) {\n super(message);\n this.name = \"PaymentError\";\n // Maintains proper stack trace for where error was thrown (V8 engines)\n if (typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(this, PaymentError);\n }\n }\n}\n\n/**\n * Error thrown when the Payment API returns an application-level error\n * in its response envelope.\n *\n * The Payment API wraps all responses in an envelope:\n * ```json\n * { \"data\": T | null, \"error\": { \"code\": number, \"message\": string } }\n * ```\n *\n * A `PaymentApiError` is thrown when:\n * - `error.code !== 0` (application-level error, even if HTTP status is 200)\n * - `data` is `null` (legacy error pattern from before HTTP status codes were used)\n */\nexport class PaymentApiError extends PaymentError {\n /**\n * Application-level error code from the response envelope.\n * A value of `0` means no specific error code was returned (legacy null-data case).\n */\n public readonly code: number;\n\n /**\n * The HTTP status code of the response.\n * Note: This may be `200` even when there is an application error.\n */\n public readonly httpStatus: number;\n\n constructor(message: string, code: number, httpStatus: number) {\n super(message, httpStatus);\n this.name = \"PaymentApiError\";\n this.code = code;\n this.httpStatus = httpStatus;\n }\n}\n\n/**\n * Error thrown when authentication fails or is required.\n */\nexport class PaymentAuthError extends PaymentError {\n constructor(message = \"Authentication required. Please provide a valid session ID.\") {\n super(message, 401);\n this.name = \"PaymentAuthError\";\n }\n}\n\n/**\n * Error thrown when a requested resource is not found.\n */\nexport class PaymentNotFoundError extends PaymentError {\n constructor(resource: string, id: string) {\n super(`${resource} with ID ${id} not found`, 404);\n this.name = \"PaymentNotFoundError\";\n }\n}\n\n/**\n * Error thrown when request validation fails.\n */\nexport class PaymentValidationError extends PaymentError {\n constructor(message: string, details?: unknown) {\n super(message, 422, details);\n this.name = \"PaymentValidationError\";\n }\n}\n\n/**\n * Error thrown when the API rate limit is exceeded.\n */\nexport class PaymentRateLimitError extends PaymentError {\n constructor(retryAfter?: number) {\n super(\n retryAfter\n ? `Rate limit exceeded. Retry after ${retryAfter} seconds.`\n : \"Rate limit exceeded. Please try again later.\",\n 429,\n { retryAfter }\n );\n this.name = \"PaymentRateLimitError\";\n }\n}\n","/**\n * 4Players Payment API Client\n *\n * A type-safe client for the 4Players Payment API.\n * Works in browsers, Node.js, Deno, Bun, and edge runtimes.\n *\n * @example\n * ```typescript\n * import { PaymentClient } from '@4players/payment';\n *\n * const client = new PaymentClient({ sessionId: 'your-session-id' });\n *\n * const projects = await client.getProjects();\n * ```\n */\n\nimport createClient, { type Middleware } from \"openapi-fetch\";\nimport type { paths, components, operations } from \"./types.js\";\nimport {\n PaymentError,\n PaymentApiError,\n PaymentAuthError,\n PaymentNotFoundError,\n PaymentRateLimitError,\n} from \"./errors.js\";\n\nconst DEFAULT_BASE_URL = \"https://secure.4players.de/public/api/v1\";\n\n/**\n * Configuration options for the Payment client.\n */\nexport interface PaymentClientConfig {\n /** Fusion session ID for authentication (sent as fusion-sid header) */\n sessionId: string;\n /** Base URL for the Payment API (default: https://secure.4players.de/public/api/v1) */\n baseUrl?: string;\n /** Custom fetch implementation (useful for testing or special environments) */\n fetch?: typeof fetch;\n}\n\n// ==================== Entity types from components.schemas ====================\n\nexport type PaymentProject = components[\"schemas\"][\"PaymentProject\"];\nexport type BillingAccount = components[\"schemas\"][\"BillingAccount\"];\nexport type OdinAccessKey = components[\"schemas\"][\"OdinAccessKey\"];\nexport type OdinUserPermissions = components[\"schemas\"][\"OdinUserPermissions\"];\nexport type OdinUserRole = components[\"schemas\"][\"OdinUserRole\"];\nexport type TimeSeriesData = components[\"schemas\"][\"TimeSeriesData\"];\nexport type Subscription = components[\"schemas\"][\"Subscription\"];\nexport type Invoice = components[\"schemas\"][\"Invoice\"];\nexport type InvoicePosition = components[\"schemas\"][\"InvoicePosition\"];\nexport type Invoices = components[\"schemas\"][\"Invoices\"];\nexport type SubscriptionPosition = components[\"schemas\"][\"SubscriptionPosition\"];\nexport type TariffParams = components[\"schemas\"][\"TariffParams\"];\nexport type SetupSession = components[\"schemas\"][\"SetupSession\"];\nexport type PortalSession = components[\"schemas\"][\"PortalSession\"];\nexport type TokenPayload = components[\"schemas\"][\"TokenPayload\"];\nexport type BillingOptions = components[\"schemas\"][\"BillingOptions\"];\nexport type BillingChangeOptions = components[\"schemas\"][\"BillingChangeOptions\"];\nexport type BillingStateHistory = components[\"schemas\"][\"BillingStateHistory\"];\nexport type ResourcePackagePrice = components[\"schemas\"][\"ResourcePackagePrice\"];\nexport type SuccessResponse = components[\"schemas\"][\"SuccessResponse\"];\nexport type ProjectProduct = components[\"schemas\"][\"ProjectProduct\"];\nexport type ProjectProductFeature = components[\"schemas\"][\"ProjectProductFeature\"];\nexport type ProductPricing = components[\"schemas\"][\"ProductPricing\"];\nexport type ActivatedProduct = components[\"schemas\"][\"ActivatedProduct\"];\nexport type FeatureAvailability = components[\"schemas\"][\"FeatureAvailability\"];\nexport type ProductDependencyCheck = components[\"schemas\"][\"ProductDependencyCheck\"];\nexport type ProductDependencyStatus = components[\"schemas\"][\"ProductDependencyStatus\"];\n\n// Enum types\nexport type APIType = components[\"schemas\"][\"APIType\"];\nexport type BillingState = components[\"schemas\"][\"BillingState\"];\nexport type PermissionRole = components[\"schemas\"][\"PermissionRole\"];\nexport type UserStatus = components[\"schemas\"][\"UserStatus\"];\nexport type InvoiceStatus = components[\"schemas\"][\"InvoiceStatus\"];\nexport type ProductSlug = components[\"schemas\"][\"ProductSlug\"];\nexport type PricingType = components[\"schemas\"][\"PricingType\"];\n\n// ==================== Request/Payload types ====================\n\nexport type ActivateAPIPayload = components[\"schemas\"][\"ActivateAPIPayload\"];\nexport type AddUserToProjectPayload = components[\"schemas\"][\"AddUserToProjectPayload\"];\nexport type ChangeUserRolePayload = components[\"schemas\"][\"ChangeUserRolePayload\"];\nexport type CreateAccessKeyPayload = components[\"schemas\"][\"CreateAccessKeyPayload\"];\nexport type CreateBillingPortalSessionPayload = components[\"schemas\"][\"CreateBillingPortalSessionPayload\"];\nexport type CreateSetupSessionPayload = components[\"schemas\"][\"CreateSetupSessionPayload\"];\nexport type CreateTokenPayload = components[\"schemas\"][\"CreateTokenPayload\"];\nexport type EditAccessKeyPayload = components[\"schemas\"][\"EditAccessKeyPayload\"];\nexport type EditProjectPayload = components[\"schemas\"][\"EditProjectPayload\"];\nexport type ResourcePackagePricePayload = components[\"schemas\"][\"ResourcePackagePricePayload\"];\nexport type ResourcePackagePricesPayload = components[\"schemas\"][\"ResourcePackagePricesPayload\"];\nexport type RevokeUserPayload = components[\"schemas\"][\"RevokeUserPayload\"];\nexport type SetBillingAccountPayload = components[\"schemas\"][\"SetBillingAccountPayload\"];\nexport type ActivateProductPayload = components[\"schemas\"][\"ActivateProductPayload\"];\nexport type DeactivateProductPayload = components[\"schemas\"][\"DeactivateProductPayload\"];\n\n// ==================== Query parameter types ====================\n\nexport type GetProjectsQuery = operations[\"getProjects\"][\"parameters\"][\"query\"];\nexport type GetPeersOverTimeQuery = operations[\"getPeersOverTime\"][\"parameters\"][\"query\"];\nexport type GetRoomsOverTimeQuery = operations[\"getRoomsOverTime\"][\"parameters\"][\"query\"];\nexport type GetInstancesOverTimeQuery = operations[\"getInstancesOverTime\"][\"parameters\"][\"query\"];\nexport type GetInvoicesQuery = operations[\"getInvoices\"][\"parameters\"][\"query\"];\nexport type CheckFeatureQuery = operations[\"checkFeature\"][\"parameters\"][\"query\"];\nexport type CheckProductDependenciesQuery = operations[\"checkProductDependencies\"][\"parameters\"][\"query\"];\n\n/**\n * Response envelope used by the Payment API.\n */\ninterface PaymentEnvelope<T = unknown> {\n data: T | null;\n error: {\n code: number;\n message: string;\n };\n}\n\n/**\n * 4Players Payment API Client\n *\n * Provides a type-safe interface to the 4Players Payment REST API for managing\n * projects, billing, invoices, access keys, and user permissions.\n */\nexport class PaymentClient {\n private client: ReturnType<typeof createClient<paths>>;\n\n /**\n * Create a new Payment client instance.\n *\n * @param config - Client configuration\n * @throws {PaymentAuthError} If no session ID is provided\n *\n * @example\n * ```typescript\n * const client = new PaymentClient({\n * sessionId: 'your-fusion-sid'\n * });\n * ```\n */\n constructor(config: PaymentClientConfig) {\n if (!config.sessionId) {\n throw new PaymentAuthError(\"Session ID is required\");\n }\n\n this.client = createClient<paths>({\n baseUrl: config.baseUrl || DEFAULT_BASE_URL,\n headers: {\n \"fusion-sid\": config.sessionId,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n },\n fetch: config.fetch,\n });\n\n // Register the envelope-unwrapping middleware\n this.client.use(this.createEnvelopeMiddleware());\n }\n\n /**\n * Creates middleware that unwraps the Payment API response envelope.\n *\n * The Payment API wraps ALL responses in `{ data, error }`.\n * This middleware:\n * 1. Checks `error.code` — if non-zero, throws `PaymentApiError`\n * 2. Checks `data` — if null, throws `PaymentApiError` (legacy error pattern)\n * 3. Returns a new Response containing only the unwrapped `data`\n */\n private createEnvelopeMiddleware(): Middleware {\n return {\n async onResponse({ response }) {\n const contentType = response.headers.get(\"content-type\");\n if (!contentType?.includes(\"application/json\")) {\n return response;\n }\n\n const text = await response.clone().text();\n let body: unknown;\n try {\n body = JSON.parse(text);\n } catch {\n return response;\n }\n\n if (\n body !== null &&\n typeof body === \"object\" &&\n \"error\" in body &&\n \"data\" in body\n ) {\n const envelope = body as PaymentEnvelope;\n\n // Application-level error (can happen even with HTTP 200!)\n if (envelope.error && envelope.error.code !== 0) {\n throw new PaymentApiError(\n envelope.error.message,\n envelope.error.code,\n response.status\n );\n }\n\n // Legacy error pattern: data is null with HTTP 200\n if (envelope.data === null || envelope.data === undefined) {\n throw new PaymentApiError(\n envelope.error?.message || \"Response data is null\",\n envelope.error?.code || 0,\n response.status\n );\n }\n\n // Return unwrapped data so openapi-fetch sees the schema-matching body\n return new Response(JSON.stringify(envelope.data), {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n }\n\n // Not an envelope — return as-is\n return response;\n },\n };\n }\n\n private handleError(operation: string, error: unknown): never {\n if (error && typeof error === \"object\") {\n const errorObj = error as Record<string, unknown>;\n\n if (errorObj.status === 401 || errorObj.status === 403) {\n throw new PaymentAuthError();\n }\n if (errorObj.status === 404) {\n throw new PaymentNotFoundError(operation, \"unknown\");\n }\n if (errorObj.status === 429) {\n throw new PaymentRateLimitError();\n }\n }\n\n throw new PaymentError(\n `Failed to ${operation}: ${JSON.stringify(error)}`,\n undefined,\n error\n );\n }\n\n // ==================== Fleet Apps ====================\n\n /**\n * Get all fleet apps the user has access to (projects with Fleet activated).\n *\n * @returns Array of payment projects with Fleet app IDs\n */\n async getFleetProjects(): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/apps\");\n if (error) this.handleError(\"get fleet projects\", error);\n return data!;\n }\n\n /**\n * Get the details of a specific fleet app including the payment project.\n *\n * @param appId - The ID of the fleet app to retrieve\n * @returns Payment project details\n */\n async getFleetProject(appId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/apps/{app_id}\", {\n params: { path: { app_id: appId } },\n });\n if (error) this.handleError(\"get fleet project\", error);\n return data!;\n }\n\n // ==================== Projects ====================\n\n /**\n * Get all projects the authenticated user has access to.\n *\n * @param query - Optional query parameters to filter by project type\n * @returns Array of payment projects\n */\n async getProjects(query?: GetProjectsQuery): Promise<PaymentProject[]> {\n const { data, error } = await this.client.GET(\"/projects\", {\n params: { query },\n });\n if (error) this.handleError(\"get projects\", error);\n return data!;\n }\n\n /**\n * Get a specific project by ID.\n *\n * @param projectId - The unique identifier of the project\n * @returns Project details\n */\n async getProject(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project\", error);\n return data!;\n }\n\n /**\n * Update a project's name, description, or peer limit.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Updated project fields\n * @returns Success response\n */\n async editProject(projectId: string, body: EditProjectPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/projects/{projectId}\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"edit project\", error);\n return data!;\n }\n\n // ==================== Peers / Metrics ====================\n\n /**\n * Get peak peers over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required)\n * @returns Peers over time data\n */\n async getPeersOverTime(projectId: string, query: GetPeersOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/peers-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get peers over time\", error);\n return data!;\n }\n\n /**\n * Get room count over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of active rooms\n */\n async getRoomsOverTime(projectId: string, query: GetRoomsOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/rooms-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get rooms over time\", error);\n return data!;\n }\n\n /**\n * Get Fleet server instances over time for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query parameters (start timestamp is required, end is optional)\n * @returns Time-series data of deployed server instances\n */\n async getInstancesOverTime(projectId: string, query: GetInstancesOverTimeQuery): Promise<TimeSeriesData> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/instances-over-time\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"get instances over time\", error);\n return data!;\n }\n\n // ==================== Billing ====================\n\n /**\n * Get all billing accounts for the current user.\n *\n * @returns Array of billing accounts\n */\n async getBillingAccounts(): Promise<BillingAccount[]> {\n const { data, error } = await this.client.GET(\"/billing\");\n if (error) this.handleError(\"get billing accounts\", error);\n return data!;\n }\n\n /**\n * Get a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Billing account details\n */\n async getBillingAccount(billingAccountId: string): Promise<BillingAccount> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account\", error);\n return data!;\n }\n\n /**\n * Get invoices for a specific billing account.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @returns Array of invoices\n */\n async getBillingAccountInvoices(billingAccountId: string): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/billing/{billingAccountId}/invoices\", {\n params: { path: { billingAccountId } },\n });\n if (error) this.handleError(\"get billing account invoices\", error);\n return data!;\n }\n\n /**\n * Create a Stripe setup session for a new billing account.\n *\n * @param body - Setup session creation payload\n * @returns Setup session with redirect URL\n */\n async createSetupSession(body: CreateSetupSessionPayload): Promise<SetupSession> {\n const { data, error } = await this.client.POST(\"/billing/create-setup-session\", {\n body,\n });\n if (error) this.handleError(\"create setup session\", error);\n return data!;\n }\n\n /**\n * Create a Stripe billing portal session.\n *\n * @param billingAccountId - The unique identifier of the billing account\n * @param body - Portal session creation payload\n * @returns Portal session with redirect URL\n */\n async createBillingPortalSession(billingAccountId: string, body: CreateBillingPortalSessionPayload): Promise<PortalSession> {\n const { data, error } = await this.client.POST(\"/billing/{billingAccountId}/create-billing-portal-session\", {\n params: { path: { billingAccountId } },\n body,\n });\n if (error) this.handleError(\"create billing portal session\", error);\n return data!;\n }\n\n /**\n * Get billing options for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Billing options including current state and change options\n */\n async getBillingOptions(projectId: string): Promise<BillingOptions> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/get-billing-options\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get billing options\", error);\n return data!;\n }\n\n /**\n * Set a billing account on a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Billing account and state to set\n * @returns Success response\n */\n async setBillingAccount(projectId: string, body: SetBillingAccountPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/set-billing-account\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"set billing account\", error);\n return data!;\n }\n\n /**\n * Cancel billing for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Success response\n */\n async cancelBilling(projectId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/cancel-billing\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"cancel billing\", error);\n return data!;\n }\n\n // ==================== API Activation ====================\n\n /**\n * Activate an API for the specified project.\n *\n * @deprecated Use {@link activateProduct} instead.\n * @param projectId - The unique identifier of the project\n * @param body - The API slug to activate\n * @returns Success response\n */\n async activateAPI(projectId: string, body: ActivateAPIPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-api\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate API\", error);\n return data!;\n }\n\n // ==================== Products ====================\n\n /**\n * List all available products.\n *\n * @returns Array of available products with features and pricing\n */\n async getProducts(): Promise<ProjectProduct[]> {\n const { data, error } = await this.client.GET(\"/products\");\n if (error) this.handleError(\"get products\", error);\n return data!;\n }\n\n /**\n * Get product details by slug.\n *\n * @param slug - The product slug (e.g. voice, rooms, fleet, cortex)\n * @returns Product details including features, pricing, and dependencies\n */\n async getProduct(slug: ProductSlug): Promise<ProjectProduct> {\n const { data, error } = await this.client.GET(\"/products/{slug}\", {\n params: { path: { slug } },\n });\n if (error) this.handleError(\"get product\", error);\n return data!;\n }\n\n /**\n * Get activated products for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Array of activated products\n */\n async getProjectProducts(projectId: string): Promise<ActivatedProduct[]> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/products\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get project products\", error);\n return data!;\n }\n\n /**\n * Activate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug and optional configuration\n * @returns Updated project\n */\n async activateProduct(projectId: string, body: ActivateProductPayload): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/activate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"activate product\", error);\n return data!;\n }\n\n /**\n * Deactivate a product for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The product slug to deactivate\n * @returns Success response\n */\n async deactivateProduct(projectId: string, body: DeactivateProductPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/deactivate-product\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"deactivate product\", error);\n return data!;\n }\n\n /**\n * Check if a feature is available for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the feature slug to check\n * @returns Feature availability status\n */\n async checkFeature(projectId: string, query: CheckFeatureQuery): Promise<FeatureAvailability> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-feature\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check feature\", error);\n return data!;\n }\n\n /**\n * Check product dependencies for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param query - Query with the product slug to check\n * @returns Dependency check result with activation status of each dependency\n */\n async checkProductDependencies(projectId: string, query: CheckProductDependenciesQuery): Promise<ProductDependencyCheck> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/check-product-dependencies\", {\n params: { path: { projectId }, query },\n });\n if (error) this.handleError(\"check product dependencies\", error);\n return data!;\n }\n\n // ==================== Invoices ====================\n\n /**\n * Get all invoices for the current user, optionally filtered by ID.\n *\n * @param query - Optional query parameters for filtering by invoice IDs\n * @returns Array of invoices\n */\n async getInvoices(query?: GetInvoicesQuery): Promise<Invoice[]> {\n const { data, error } = await this.client.GET(\"/invoices\", {\n params: { query },\n });\n if (error) this.handleError(\"get invoices\", error);\n return data!;\n }\n\n /**\n * Get a preview of the current month's invoice for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Invoice preview\n */\n async getInvoicePreview(projectId: string): Promise<Invoice> {\n const { data, error } = await this.client.GET(\"/projects/{projectId}/preview-invoice\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"get invoice preview\", error);\n return data!;\n }\n\n // ==================== Access Keys ====================\n\n /**\n * Get a specific access key.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Access key details\n */\n async getAccessKey(accessKeyId: string): Promise<OdinAccessKey> {\n const { data, error } = await this.client.GET(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"get access key\", error);\n return data!;\n }\n\n /**\n * Create a new access key for a project.\n *\n * @param body - Access key creation payload\n * @returns Created access key (includes the key value only in this response)\n */\n async createAccessKey(body: CreateAccessKeyPayload): Promise<OdinAccessKey> {\n const { data, error } = await this.client.POST(\"/odin-access-keys/\", {\n body,\n });\n if (error) this.handleError(\"create access key\", error);\n return data!;\n }\n\n /**\n * Update an existing access key's name or description.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @param body - Updated access key fields\n * @returns Success response\n */\n async editAccessKey(accessKeyId: string, body: EditAccessKeyPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.PUT(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n body,\n });\n if (error) this.handleError(\"edit access key\", error);\n return data!;\n }\n\n /**\n * Delete an access key. This operation is irreversible.\n *\n * @param accessKeyId - The unique identifier of the access key\n * @returns Success response\n */\n async deleteAccessKey(accessKeyId: string): Promise<SuccessResponse> {\n const { data, error } = await this.client.DELETE(\"/odin-access-keys/{accessKeyId}\", {\n params: { path: { accessKeyId } },\n });\n if (error) this.handleError(\"delete access key\", error);\n return data!;\n }\n\n // ==================== Project Members ====================\n\n /**\n * Add a user to a project with a specified role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - User email and role\n * @returns The created user role\n */\n async addProjectMember(projectId: string, body: AddUserToProjectPayload): Promise<OdinUserRole> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/add-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"add project member\", error);\n return data!;\n }\n\n /**\n * Revoke a user's permission from a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID to revoke\n * @returns Success response\n */\n async deleteProjectMember(projectId: string, body: RevokeUserPayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-user-permission\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"delete project member\", error);\n return data!;\n }\n\n /**\n * Change a project member's role.\n *\n * @param projectId - The unique identifier of the project\n * @param body - The permission ID and new role\n * @returns Success response\n */\n async changeMemberRole(projectId: string, body: ChangeUserRolePayload): Promise<SuccessResponse> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/change-user-role\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"change member role\", error);\n return data!;\n }\n\n // ==================== Tokens & Secrets ====================\n\n /**\n * Create an ODIN access token for a project.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Token creation payload\n * @returns The created token\n */\n async createAccessToken(projectId: string, body: CreateTokenPayload): Promise<TokenPayload> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/create-token\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"create access token\", error);\n return data!;\n }\n\n /**\n * Revoke the secret for a project.\n *\n * @param projectId - The unique identifier of the project\n * @returns Updated project with new secret\n */\n async revokeSecret(projectId: string): Promise<PaymentProject> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/revoke-secret\", {\n params: { path: { projectId } },\n });\n if (error) this.handleError(\"revoke secret\", error);\n return data!;\n }\n\n // ==================== Resource Package Pricing ====================\n\n /**\n * Get the price for a single resource package in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package, region, and quantity\n * @returns Price information\n */\n async getResourcePackagePrice(projectId: string, body: ResourcePackagePricePayload): Promise<ResourcePackagePrice> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-price\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package price\", error);\n return data!;\n }\n\n /**\n * Get prices for multiple resource packages in a specific region.\n *\n * @param projectId - The unique identifier of the project\n * @param body - Resource package IDs, region, and quantity\n * @returns Array of price information\n */\n async getResourcePackagePrices(projectId: string, body: ResourcePackagePricesPayload): Promise<ResourcePackagePrice[]> {\n const { data, error } = await this.client.POST(\"/projects/{projectId}/resource-package-prices\", {\n params: { path: { projectId } },\n body,\n });\n if (error) this.handleError(\"get resource package prices\", error);\n return data!;\n }\n}\n\nexport default PaymentClient;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4players/payment",
3
- "version": "1.0.2-beta.2",
3
+ "version": "1.0.2-beta.3",
4
4
  "description": "Official TypeScript SDK for the 4Players Payment API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",