Leon4gr45's picture
Upload folder using huggingface_hub (part 2)
1477a90 verified
Raw
History Blame Contribute Delete
1.76 kB
// 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<ListMeteringEventsResponse> {
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<IngestedEvent> {
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<IngestMeteringEventsResponse> {
return unwrap(await ingestMeteringEvents(this._client, request, options))
}
}