| |
|
|
| import { type Client } from '../core.js' |
| import { unwrap, type RequestOptions } from '../lib/types.js' |
| import { paginatePages } from '../lib/paginate.js' |
| import { createSubscriptionAddon } from '../funcs/subscriptions.js' |
| import { |
| listInvoices, |
| getInvoice, |
| updateInvoice, |
| deleteInvoice, |
| advanceInvoice, |
| approveInvoice, |
| retryInvoice, |
| snapshotQuantitiesInvoice, |
| } from '../funcs/invoices.js' |
| import { |
| listCurrencies, |
| createCustomCurrency, |
| listCostBases, |
| createCostBasis, |
| } from '../funcs/currencies.js' |
| import { queryGovernanceAccess } from '../funcs/governance.js' |
| import type { |
| CreateSubscriptionAddonRequest, |
| CreateSubscriptionAddonResponse, |
| } from '../models/operations/subscriptions.js' |
| import type { |
| ListInvoicesRequest, |
| ListInvoicesResponse, |
| GetInvoiceRequest, |
| GetInvoiceResponse, |
| UpdateInvoiceRequest, |
| UpdateInvoiceResponse, |
| DeleteInvoiceRequest, |
| DeleteInvoiceResponse, |
| AdvanceInvoiceRequest, |
| AdvanceInvoiceResponse, |
| ApproveInvoiceRequest, |
| ApproveInvoiceResponse, |
| RetryInvoiceRequest, |
| RetryInvoiceResponse, |
| SnapshotQuantitiesInvoiceRequest, |
| SnapshotQuantitiesInvoiceResponse, |
| } from '../models/operations/invoices.js' |
| import type { |
| ListCurrenciesRequest, |
| ListCurrenciesResponse, |
| CreateCustomCurrencyRequest, |
| CreateCustomCurrencyResponse, |
| ListCostBasesRequest, |
| ListCostBasesResponse, |
| CreateCostBasisRequest, |
| CreateCostBasisResponse, |
| } from '../models/operations/currencies.js' |
| import type { |
| QueryGovernanceAccessRequest, |
| QueryGovernanceAccessResponse, |
| } from '../models/operations/governance.js' |
| import type { CostBasis, Currency, Invoice } from '../models/types.js' |
|
|
| |
| |
| |
| |
| |
| export class Internal { |
| constructor(private readonly _client: Client) {} |
|
|
| private _subscriptions?: InternalSubscriptions |
| get subscriptions(): InternalSubscriptions { |
| return (this._subscriptions ??= new InternalSubscriptions(this._client)) |
| } |
|
|
| private _invoices?: InternalInvoices |
| get invoices(): InternalInvoices { |
| return (this._invoices ??= new InternalInvoices(this._client)) |
| } |
|
|
| private _currencies?: InternalCurrencies |
| get currencies(): InternalCurrencies { |
| return (this._currencies ??= new InternalCurrencies(this._client)) |
| } |
|
|
| private _governance?: InternalGovernance |
| get governance(): InternalGovernance { |
| return (this._governance ??= new InternalGovernance(this._client)) |
| } |
| } |
|
|
| export class InternalSubscriptions { |
| constructor(private readonly _client: Client) {} |
|
|
| |
| |
| |
| |
| |
| |
| |
| async createAddon( |
| request: CreateSubscriptionAddonRequest, |
| options?: RequestOptions, |
| ): Promise<CreateSubscriptionAddonResponse> { |
| return unwrap(await createSubscriptionAddon(this._client, request, options)) |
| } |
| } |
|
|
| export class InternalInvoices { |
| constructor(private readonly _client: Client) {} |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async list( |
| request?: ListInvoicesRequest, |
| options?: RequestOptions, |
| ): Promise<ListInvoicesResponse> { |
| return unwrap(await listInvoices(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| listAll( |
| request?: ListInvoicesRequest, |
| options?: RequestOptions, |
| ): AsyncIterable<Invoice> { |
| return paginatePages( |
| (req, opts) => listInvoices(this._client, req, opts), |
| request ?? {}, |
| options, |
| ) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async get( |
| request: GetInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<GetInvoiceResponse> { |
| return unwrap(await getInvoice(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async update( |
| request: UpdateInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<UpdateInvoiceResponse> { |
| return unwrap(await updateInvoice(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async delete( |
| request: DeleteInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<DeleteInvoiceResponse> { |
| return unwrap(await deleteInvoice(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async advance( |
| request: AdvanceInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<AdvanceInvoiceResponse> { |
| return unwrap(await advanceInvoice(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async approve( |
| request: ApproveInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<ApproveInvoiceResponse> { |
| return unwrap(await approveInvoice(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async retry( |
| request: RetryInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<RetryInvoiceResponse> { |
| return unwrap(await retryInvoice(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async snapshotQuantities( |
| request: SnapshotQuantitiesInvoiceRequest, |
| options?: RequestOptions, |
| ): Promise<SnapshotQuantitiesInvoiceResponse> { |
| return unwrap( |
| await snapshotQuantitiesInvoice(this._client, request, options), |
| ) |
| } |
| } |
|
|
| export class InternalCurrencies { |
| constructor(private readonly _client: Client) {} |
|
|
| |
| |
| |
| |
| |
| |
| |
| async list( |
| request?: ListCurrenciesRequest, |
| options?: RequestOptions, |
| ): Promise<ListCurrenciesResponse> { |
| return unwrap(await listCurrencies(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| listAll( |
| request?: ListCurrenciesRequest, |
| options?: RequestOptions, |
| ): AsyncIterable<Currency> { |
| return paginatePages( |
| (req, opts) => listCurrencies(this._client, req, opts), |
| request ?? {}, |
| options, |
| ) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| async createCustomCurrency( |
| request: CreateCustomCurrencyRequest, |
| options?: RequestOptions, |
| ): Promise<CreateCustomCurrencyResponse> { |
| return unwrap(await createCustomCurrency(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| async listCostBases( |
| request: ListCostBasesRequest, |
| options?: RequestOptions, |
| ): Promise<ListCostBasesResponse> { |
| return unwrap(await listCostBases(this._client, request, options)) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| listCostBasesAll( |
| request: ListCostBasesRequest, |
| options?: RequestOptions, |
| ): AsyncIterable<CostBasis> { |
| return paginatePages( |
| (req, opts) => listCostBases(this._client, req, opts), |
| request, |
| options, |
| ) |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| async createCostBasis( |
| request: CreateCostBasisRequest, |
| options?: RequestOptions, |
| ): Promise<CreateCostBasisResponse> { |
| return unwrap(await createCostBasis(this._client, request, options)) |
| } |
| } |
|
|
| export class InternalGovernance { |
| constructor(private readonly _client: Client) {} |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| async queryAccess( |
| request: QueryGovernanceAccessRequest, |
| options?: RequestOptions, |
| ): Promise<QueryGovernanceAccessResponse> { |
| return unwrap(await queryGovernanceAccess(this._client, request, options)) |
| } |
| } |
|
|