export type CreateApiPipelinePipelineIdTapComponentIdArgs = {pipeline_id: string, component_id: string, body: {limit?: number | undefined, timeout?: number | undefined, edge_id?: string | undefined, filter: unknown}}; export type CreateApiPipelinePipelineIdTapComponentIdOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start pipeline tap * * POST /pipeline/{pipeline_id}/tap/{component_id} */ export const createApiPipelinePipelineIdTapComponentId = async (args: CreateApiPipelinePipelineIdTapComponentIdArgs, options?: CreateApiPipelinePipelineIdTapComponentIdOptions) => { const {baseUrl = "https://api.mezmo.com/v3", fetch: fetchFn = fetch, PipelineServiceKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (PipelineServiceKey !== undefined) headers.set("Authorization", PipelineServiceKey) const url = `${baseUrl.replace(/\/+$/, '')}/pipeline/${encodeURIComponent(String(args.pipeline_id))}/tap/${encodeURIComponent(String(args.component_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };