// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; import * as FilterAPI from './filter'; import * as EventsAPI from '../events'; import * as NextAPI from './next'; export class Filter extends APIResource { next: NextAPI.Next = new NextAPI.Next(this._client); /** * Queries for Events matching the given filter criteria in the given Account. * Returns the first page of results, and the URL to request the next page (if * there are more results). */ create(params?: FilterCreateParams, options?: Core.RequestOptions): Core.APIPromise; create(options?: Core.RequestOptions): Core.APIPromise; create( params: FilterCreateParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { if (isRequestOptions(params)) { return this.create({}, params); } const { 'x-prefect-api-version': xPrefectAPIVersion, ...body } = params; return this._client.post('/api/events/filter', { body, ...options, headers: { ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } } export interface FilterCreateParams { /** * Body param: Additional optional filter criteria to narrow down the set of Events */ filter?: FilterCreateParams.Filter | null; /** * Body param: The number of events to return with each page */ limit?: number; /** * Header param: */ 'x-prefect-api-version'?: string; } export namespace FilterCreateParams { /** * Additional optional filter criteria to narrow down the set of Events */ export interface Filter { /** * Filter criteria for the events' ID */ id?: Filter.ID; /** * Filter criteria for any resource involved in the event */ any_resource?: Filter.AnyResource | null; /** * Filter criteria for the event name */ event?: Filter.Event | null; /** * Filter criteria for when the events occurred */ occurred?: Filter.Occurred; /** * The order to return filtered events */ order?: 'ASC' | 'DESC'; /** * Filter criteria for the related resources of the event */ related?: Filter.Related | null; /** * Filter criteria for the resource of the event */ resource?: Filter.Resource | null; } export namespace Filter { /** * Filter criteria for the events' ID */ export interface ID { /** * Only include events with one of these IDs */ id?: Array | null; } /** * Filter criteria for any resource involved in the event */ export interface AnyResource { /** * Only include events for resources with these IDs */ id?: Array | null; /** * Only include events for resources with IDs starting with these prefixes */ id_prefix?: Array | null; /** * Only include events for related resources with these labels */ labels?: Record> | null; } /** * Filter criteria for the event name */ export interface Event { /** * Exclude events matching one of these names exactly */ exclude_name?: Array | null; /** * Exclude events matching one of these prefixes */ exclude_prefix?: Array | null; /** * Only include events matching one of these names exactly */ name?: Array | null; /** * Only include events matching one of these prefixes */ prefix?: Array | null; } /** * Filter criteria for when the events occurred */ export interface Occurred { /** * Only include events after this time (inclusive) */ since?: string; /** * Only include events prior to this time (inclusive) */ until?: string; } /** * Filter criteria for the related resources of the event */ export interface Related { /** * Only include events for related resources with these IDs */ id?: Array | null; /** * Only include events for related resources with these labels */ labels?: Record> | null; /** * Only include events with specific related resources in specific roles */ resources_in_roles?: Array> | null; /** * Only include events for related resources in these roles */ role?: Array | null; } /** * Filter criteria for the resource of the event */ export interface Resource { /** * Only include events for resources with these IDs */ id?: Array | null; /** * Only include events for distinct resources */ distinct?: boolean; /** * Only include events for resources with IDs starting with these prefixes. */ id_prefix?: Array | null; /** * Only include events for resources with these labels */ labels?: Record> | null; } } } export namespace Filter { export import FilterCreateParams = FilterAPI.FilterCreateParams; export import Next = NextAPI.Next; export import NextListParams = NextAPI.NextListParams; }