// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as EventsAPI from './events'; import * as CountByAPI from './count-by'; import * as FilterNextAPI from './filter-next'; import * as FilterAPI from './filter/filter'; export class Events extends APIResource { countBy: CountByAPI.CountBy = new CountByAPI.CountBy(this._client); filter: FilterAPI.Filter = new FilterAPI.Filter(this._client); filterNext: FilterNextAPI.FilterNext = new FilterNextAPI.FilterNext(this._client); /** * Record a batch of Events */ create(params: EventCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { body, 'x-prefect-api-version': xPrefectAPIVersion } = params; return this._client.post('/api/events', { body: body, ...options, headers: { Accept: '*/*', ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } } /** * The count of events with the given filter value */ export interface EventCount { /** * The count of matching events */ count: number; /** * The end time of this group of events */ end_time: string; /** * The value to display for this count */ label: string; /** * The start time of this group of events */ start_time: string; /** * The value to use for filtering */ value: string; } /** * A single page of events returned from the API, with an optional link to the next * page of results */ export interface EventPage { /** * The Events matching the query */ events: Array; /** * The URL for the next page of results, if there are more */ next_page: string | null; /** * The total number of matching Events */ total: number; } export namespace EventPage { /** * The server-side view of an event that has happened to a Resource after it has * been received by the server */ export interface Event { /** * The client-provided identifier of this event */ id: string; /** * The name of the event that happened */ event: string; /** * When the event happened from the sender's perspective */ occurred: string; /** * The primary Resource this event concerns */ resource: Record; /** * The ID of an event that is known to have occurred prior to this one. If set, * this may be used to establish a more precise ordering of causally-related events * when they occur close enough together in time that the system may receive them * out-of-order. */ follows?: string | null; /** * An open-ended set of data describing what happened */ payload?: unknown; /** * When the event was received by Prefect Cloud */ received?: string; /** * A list of additional Resources involved in this event */ related?: Array>; } } export interface EventCreateParams { /** * Body param: */ body: Array; /** * Header param: */ 'x-prefect-api-version'?: string; } export namespace EventCreateParams { /** * The client-side view of an event that has happened to a Resource */ export interface Body { /** * The client-provided identifier of this event */ id: string; /** * The name of the event that happened */ event: string; /** * When the event happened from the sender's perspective */ occurred: string; /** * The primary Resource this event concerns */ resource: Record; /** * The ID of an event that is known to have occurred prior to this one. If set, * this may be used to establish a more precise ordering of causally-related events * when they occur close enough together in time that the system may receive them * out-of-order. */ follows?: string | null; /** * An open-ended set of data describing what happened */ payload?: unknown; /** * A list of additional Resources involved in this event */ related?: Array>; } } export namespace Events { export import EventCount = EventsAPI.EventCount; export import EventPage = EventsAPI.EventPage; export import EventCreateParams = EventsAPI.EventCreateParams; export import CountBy = CountByAPI.CountBy; export import CountByCreateResponse = CountByAPI.CountByCreateResponse; export import CountByCreateParams = CountByAPI.CountByCreateParams; export import Filter = FilterAPI.Filter; export import FilterCreateParams = FilterAPI.FilterCreateParams; export import FilterNext = FilterNextAPI.FilterNext; }