import { APIResource } from "../../../resource.js"; import * as Core from "../../../core.js"; import * as SpendingLimitAPI from "./spending-limit.js"; import { SpendingLimit, SpendingLimitCreateParams, SpendingLimitCreateResponse, SpendingLimitDeleteParams, SpendingLimitDeleteResponse, SpendingLimitGetParams, SpendingLimitGetResponse } from "./spending-limit.js"; import * as TopupAPI from "./topup/topup.js"; import { Topup, TopupCreateParams, TopupCreateResponse, TopupStatusParams, TopupStatusResponse } from "./topup/topup.js"; export declare class Billing extends APIResource { topup: TopupAPI.Topup; spendingLimit: SpendingLimitAPI.SpendingLimit; /** * Retrieve the current credit balance, payment method info, and top-up * configuration. * * @example * ```ts * const response = * await client.aiGateway.billing.creditBalance({ * account_id: 'account_id', * }); * ``` */ creditBalance(params: BillingCreditBalanceParams, options?: Core.RequestOptions): Core.APIPromise; /** * Retrieve a list of past invoices with pagination, optionally filtered by type. * * @example * ```ts * const response = * await client.aiGateway.billing.invoiceHistory({ * account_id: 'account_id', * }); * ``` */ invoiceHistory(params: BillingInvoiceHistoryParams, options?: Core.RequestOptions): Core.APIPromise; /** * Retrieve a preview of the upcoming invoice including line items and tax. * * @example * ```ts * const response = * await client.aiGateway.billing.invoicePreview({ * account_id: 'account_id', * }); * ``` */ invoicePreview(params: BillingInvoicePreviewParams, options?: Core.RequestOptions): Core.APIPromise; /** * Retrieve aggregated usage meter event summaries for the given time range. * * @example * ```ts * const response = * await client.aiGateway.billing.usageHistory({ * account_id: 'account_id', * value_grouping_window: 'day', * }); * ``` */ usageHistory(params: BillingUsageHistoryParams, options?: Core.RequestOptions): Core.APIPromise; } export interface BillingCreditBalanceResponse { balance: number; has_default_payment_method: boolean; payment_method: BillingCreditBalanceResponse.PaymentMethod | null; topup_config: BillingCreditBalanceResponse.TopupConfig; first_topup_success?: boolean; } export declare namespace BillingCreditBalanceResponse { interface PaymentMethod { brand?: string; last4?: string; } interface TopupConfig { amount: number | null; disabledReason: string | null; error: string | null; lastFailedAt: number | null; threshold: number | null; } } export interface BillingInvoiceHistoryResponse { invoices: Array; pagination: BillingInvoiceHistoryResponse.Pagination; } export declare namespace BillingInvoiceHistoryResponse { interface Invoice { amount_due: number; amount_paid: number; amount_remaining: number; currency: string; id?: string | null; attempt_count?: number; attempted?: boolean; auto_advance?: boolean | null; created?: number; created_by?: string; description?: string | null; invoice_origin?: string; invoice_pdf?: string | null; status?: string | null; } interface Pagination { has_more: boolean; page: number; per_page: number; total_count: number; } } export interface BillingInvoicePreviewResponse { id: string; amount_due: number; amount_paid: number; amount_remaining: number; currency: string; invoice_lines: Array; period_end: number; period_start: number; status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void'; } export declare namespace BillingInvoicePreviewResponse { interface InvoiceLine { amount: number; currency: string; description: string | null; period: InvoiceLine.Period; pricing: InvoiceLine.Pricing; quantity: number; pretax_credit_amounts?: Array; } namespace InvoiceLine { interface Period { end: number; start: number; } interface Pricing { unit_amount_decimal: string | null; } interface PretaxCreditAmount { amount: number; type: string; credit_balance_transaction?: string | null; discount?: string | null; } } } export interface BillingUsageHistoryResponse { history: Array; } export declare namespace BillingUsageHistoryResponse { interface History { id: string; aggregated_value: number; end_time: number; start_time: number; } } export interface BillingCreditBalanceParams { /** * Cloudflare account ID. */ account_id: string; } export interface BillingInvoiceHistoryParams { /** * Path param: Cloudflare account ID. */ account_id: string; /** * Query param: Filter invoice type: auto, manual, or all. */ type?: 'auto' | 'all' | 'manual'; } export interface BillingInvoicePreviewParams { /** * Cloudflare account ID. */ account_id: string; } export interface BillingUsageHistoryParams { /** * Path param: Cloudflare account ID. */ account_id: string; /** * Query param: Grouping window for usage data. */ value_grouping_window: 'day' | 'hour'; /** * Query param: End time as Unix timestamp in milliseconds. */ end_time?: number | null; /** * Query param: Start time as Unix timestamp in milliseconds. */ start_time?: number | null; } export declare namespace Billing { export { type BillingCreditBalanceResponse as BillingCreditBalanceResponse, type BillingInvoiceHistoryResponse as BillingInvoiceHistoryResponse, type BillingInvoicePreviewResponse as BillingInvoicePreviewResponse, type BillingUsageHistoryResponse as BillingUsageHistoryResponse, type BillingCreditBalanceParams as BillingCreditBalanceParams, type BillingInvoiceHistoryParams as BillingInvoiceHistoryParams, type BillingInvoicePreviewParams as BillingInvoicePreviewParams, type BillingUsageHistoryParams as BillingUsageHistoryParams, }; export { Topup as Topup, type TopupCreateResponse as TopupCreateResponse, type TopupStatusResponse as TopupStatusResponse, type TopupCreateParams as TopupCreateParams, type TopupStatusParams as TopupStatusParams, }; export { SpendingLimit as SpendingLimit, type SpendingLimitCreateResponse as SpendingLimitCreateResponse, type SpendingLimitDeleteResponse as SpendingLimitDeleteResponse, type SpendingLimitGetResponse as SpendingLimitGetResponse, type SpendingLimitCreateParams as SpendingLimitCreateParams, type SpendingLimitDeleteParams as SpendingLimitDeleteParams, type SpendingLimitGetParams as SpendingLimitGetParams, }; } //# sourceMappingURL=billing.d.ts.map