// Code generated by @openmeter/typespec-typescript. DO NOT EDIT. import { type Client } from '../core.js' import { unwrap, type RequestOptions } from '../lib/types.js' import { paginatePages } from '../lib/paginate.js' import { listBillingProfiles, createBillingProfile, getBillingProfile, updateBillingProfile, deleteBillingProfile, } from '../funcs/billing.js' import type { ListBillingProfilesRequest, ListBillingProfilesResponse, CreateBillingProfileRequest, CreateBillingProfileResponse, GetBillingProfileRequest, GetBillingProfileResponse, UpdateBillingProfileRequest, UpdateBillingProfileResponse, DeleteBillingProfileRequest, DeleteBillingProfileResponse, } from '../models/operations/billing.js' import type { Profile } from '../models/types.js' export class Billing { constructor(private readonly _client: Client) {} /** * List billing profiles * * List billing profiles. * * GET /openmeter/profiles */ async listProfiles( request?: ListBillingProfilesRequest, options?: RequestOptions, ): Promise { return unwrap(await listBillingProfiles(this._client, request, options)) } /** * List billing profiles * * List billing profiles. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/profiles */ listProfilesAll( request?: ListBillingProfilesRequest, options?: RequestOptions, ): AsyncIterable { return paginatePages( (req, opts) => listBillingProfiles(this._client, req, opts), request ?? {}, options, ) } /** * Create a new billing profile * * Create a new billing profile. * * Billing profiles contain the settings for billing and controls invoice * generation. An organization can have multiple billing profiles defined. A * billing profile is linked to a specific app. This association is established * during the billing profile's creation and remains immutable. * * POST /openmeter/profiles */ async createProfile( request: CreateBillingProfileRequest, options?: RequestOptions, ): Promise { return unwrap(await createBillingProfile(this._client, request, options)) } /** * Get a billing profile * * Get a billing profile. * * GET /openmeter/profiles/{id} */ async getProfile( request: GetBillingProfileRequest, options?: RequestOptions, ): Promise { return unwrap(await getBillingProfile(this._client, request, options)) } /** * Update a billing profile * * Update a billing profile. * * PUT /openmeter/profiles/{id} */ async updateProfile( request: UpdateBillingProfileRequest, options?: RequestOptions, ): Promise { return unwrap(await updateBillingProfile(this._client, request, options)) } /** * Delete a billing profile * * Delete a billing profile. * * Only such billing profiles can be deleted that are: * * - not the default profile * - not pinned to any customer using customer overrides * - only have finalized invoices * * DELETE /openmeter/profiles/{id} */ async deleteProfile( request: DeleteBillingProfileRequest, options?: RequestOptions, ): Promise { return unwrap(await deleteBillingProfile(this._client, request, options)) } }