/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { eventsGetEvent } from "../funcs/events-get-event.js"; import { eventsGetHuggingfaceInferenceData } from "../funcs/events-get-huggingface-inference-data.js"; import { eventsGetUsageAnalytics } from "../funcs/events-get-usage-analytics.js"; import { eventsGetUsageByMeter } from "../funcs/events-get-usage-by-meter.js"; import { eventsGetUsageStatistics } from "../funcs/events-get-usage-statistics.js"; import { eventsIngestEvent } from "../funcs/events-ingest-event.js"; import { eventsIngestEventsBulk } from "../funcs/events-ingest-events-bulk.js"; import { eventsListRawEvents } from "../funcs/events-list-raw-events.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { unwrapAsync } from "../types/fp.js"; import * as models from "./models/index.js"; export class Events extends ClientSDK { /** * Ingest event * * @remarks * Use when sending a single usage event from your app (e.g. one API call or one GB stored). Events are processed asynchronously; returns 202 with event_id. */ async ingestEvent( request: models.IngestEventRequest, options?: RequestOptions, ): Promise<{ [k: string]: string }> { return unwrapAsync(eventsIngestEvent( this, request, options, )); } /** * Get usage analytics * * @remarks * Use when building analytics views (e.g. usage by feature or customer over time). Supports filtering, grouping, and time-series breakdown. */ async getUsageAnalytics( request: models.GetUsageAnalyticsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(eventsGetUsageAnalytics( this, request, options, )); } /** * Bulk ingest events * * @remarks * Use when batching usage events (e.g. backfill or high-volume ingestion). More efficient than single event calls; returns 202 when accepted. */ async ingestEventsBulk( request: models.BulkIngestEventRequest, options?: RequestOptions, ): Promise<{ [k: string]: string }> { return unwrapAsync(eventsIngestEventsBulk( this, request, options, )); } /** * Get Hugging Face inference data * * @remarks * Use when fetching Hugging Face inference usage or billing data (e.g. for HF-specific reporting or reconciliation). Reads the meter-usage pipeline. */ async getHuggingfaceInferenceData( request: models.GetHuggingFaceBillingDataRequest, options?: RequestOptions, ): Promise { return unwrapAsync(eventsGetHuggingfaceInferenceData( this, request, options, )); } /** * Get event * * @remarks * Use when debugging a specific event (e.g. why it failed or how it was aggregated). Reads the meter-usage pipeline; includes processing status and step-by-step debug tracker when unprocessed. Uses ?id= query param because event IDs can contain "/". */ async getEvent( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(eventsGetEvent( this, id, options, )); } /** * List raw events * * @remarks * Use when debugging ingestion or exporting raw event data (e.g. support or audit). Returns a paginated list; supports time range and sorting. */ async listRawEvents( request: models.GetEventsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(eventsListRawEvents( this, request, options, )); } /** * Get usage statistics * * @remarks * Use when building usage reports or dashboards across events. Supports filters and grouping; defaults to last 7 days if no range provided. */ async getUsageStatistics( request: models.GetUsageRequest, options?: RequestOptions, ): Promise { return unwrapAsync(eventsGetUsageStatistics( this, request, options, )); } /** * Get usage by meter * * @remarks * Use when showing usage for a specific meter (e.g. dashboard or overage check). Supports time range, filters, and grouping by customer or subscription. */ async getUsageByMeter( request: models.GetUsageByMeterRequest, options?: RequestOptions, ): Promise { return unwrapAsync(eventsGetUsageByMeter( this, request, options, )); } }