// 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 FlowRunStatesAPI from './flow-run-states'; import * as Shared from './shared'; export class FlowRunStates extends APIResource { /** * Get a flow run state by id. */ retrieve( id: string, params?: FlowRunStateRetrieveParams, options?: Core.RequestOptions, ): Core.APIPromise; retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise; retrieve( id: string, params: FlowRunStateRetrieveParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { if (isRequestOptions(params)) { return this.retrieve(id, {}, params); } const { 'x-prefect-api-version': xPrefectAPIVersion } = params; return this._client.get(`/api/flow_run_states/${id}`, { ...options, headers: { ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } /** * Get states associated with a flow run. */ list( params: FlowRunStateListParams, options?: Core.RequestOptions, ): Core.APIPromise { const { 'x-prefect-api-version': xPrefectAPIVersion, ...query } = params; return this._client.get('/api/flow_run_states/', { query, ...options, headers: { ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } } export type FlowRunStateListResponse = Array; export interface FlowRunStateRetrieveParams { 'x-prefect-api-version'?: string; } export interface FlowRunStateListParams { /** * Query param: */ flow_run_id: string; /** * Header param: */ 'x-prefect-api-version'?: string; } export namespace FlowRunStates { export import FlowRunStateListResponse = FlowRunStatesAPI.FlowRunStateListResponse; export import FlowRunStateRetrieveParams = FlowRunStatesAPI.FlowRunStateRetrieveParams; export import FlowRunStateListParams = FlowRunStatesAPI.FlowRunStateListParams; }