// Code generated by @openmeter/typespec-typescript. DO NOT EDIT. import { type Client } from '../core.js' import { unwrap, type RequestOptions } from '../lib/types.js' import { paginateCursor } from '../lib/paginate.js' import { listMeteringEvents, ingestMeteringEvents } from '../funcs/events.js' import type { ListMeteringEventsRequest, ListMeteringEventsResponse, IngestMeteringEventsRequest, IngestMeteringEventsResponse, } from '../models/operations/events.js' import type { IngestedEvent } from '../models/types.js' export class Events { constructor(private readonly _client: Client) {} /** * List metering events * * List ingested events. * * GET /openmeter/events */ async list( request?: ListMeteringEventsRequest, options?: RequestOptions, ): Promise { return unwrap(await listMeteringEvents(this._client, request, options)) } /** * List metering events * * List ingested events. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/events */ listAll( request?: ListMeteringEventsRequest, options?: RequestOptions, ): AsyncIterable { return paginateCursor( (req, opts) => listMeteringEvents(this._client, req, opts), request ?? {}, options, ) } /** * Ingest metering events * * Ingests an event or batch of events following the CloudEvents specification. * * POST /openmeter/events */ async ingest( request: IngestMeteringEventsRequest, options?: RequestOptions, ): Promise { return unwrap(await ingestMeteringEvents(this._client, request, options)) } }