// 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 InputAPI from './input'; import * as FlowRunsAPI from './flow-runs'; export class Input extends APIResource { /** * Create a key/value input for a flow run. */ create(id: string, params: InputCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { 'x-prefect-api-version': xPrefectAPIVersion, ...body } = params; return this._client.post(`/api/flow_runs/${id}/input`, { body, ...options, headers: { ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } /** * Create a value from a flow run input */ retrieve( id: string, key: string, params?: InputRetrieveParams, options?: Core.RequestOptions, ): Core.APIPromise; retrieve(id: string, key: string, options?: Core.RequestOptions): Core.APIPromise; retrieve( id: string, key: string, params: InputRetrieveParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { if (isRequestOptions(params)) { return this.retrieve(id, key, {}, params); } const { 'x-prefect-api-version': xPrefectAPIVersion } = params; return this._client.get(`/api/flow_runs/${id}/input/${key}`, { ...options, headers: { ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } /** * Delete a flow run input */ delete( id: string, key: string, params?: InputDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise; delete(id: string, key: string, options?: Core.RequestOptions): Core.APIPromise; delete( id: string, key: string, params: InputDeleteParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { if (isRequestOptions(params)) { return this.delete(id, key, {}, params); } const { 'x-prefect-api-version': xPrefectAPIVersion } = params; return this._client.delete(`/api/flow_runs/${id}/input/${key}`, { ...options, headers: { Accept: '*/*', ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } /** * Filter flow run inputs by key prefix */ filter( id: string, params: InputFilterParams, options?: Core.RequestOptions, ): Core.APIPromise { const { 'x-prefect-api-version': xPrefectAPIVersion, ...body } = params; return this._client.post(`/api/flow_runs/${id}/input/filter`, { body, ...options, headers: { ...(xPrefectAPIVersion != null ? { 'x-prefect-api-version': xPrefectAPIVersion } : undefined), ...options?.headers, }, }); } } export type InputCreateResponse = unknown; export type InputRetrieveResponse = unknown; export type InputFilterResponse = Array; export interface InputCreateParams { /** * Body param: The input key */ key: string; /** * Body param: The value of the input */ value: Core.Uploadable; /** * Body param: The sender of the input */ sender?: string | null; /** * Header param: */ 'x-prefect-api-version'?: string; } export interface InputRetrieveParams { 'x-prefect-api-version'?: string; } export interface InputDeleteParams { 'x-prefect-api-version'?: string; } export interface InputFilterParams { /** * Body param: The input key prefix */ prefix: string; /** * Body param: Exclude inputs with these keys */ exclude_keys?: Array; /** * Body param: The maximum number of results to return */ limit?: number; /** * Header param: */ 'x-prefect-api-version'?: string; } export namespace Input { export import InputCreateResponse = InputAPI.InputCreateResponse; export import InputRetrieveResponse = InputAPI.InputRetrieveResponse; export import InputFilterResponse = InputAPI.InputFilterResponse; export import InputCreateParams = InputAPI.InputCreateParams; export import InputRetrieveParams = InputAPI.InputRetrieveParams; export import InputDeleteParams = InputAPI.InputDeleteParams; export import InputFilterParams = InputAPI.InputFilterParams; }