export type CreateApiPipelineContainerIdSourceSourceIdSampleArgs = {container_id: string, source_id: string | 'transform-group-input-source-id', body: {title?: (string | null) | undefined, version?: 'v2' | undefined, container_type?: ('pipeline' | 'transform_group') | undefined}}; export type CreateApiPipelineContainerIdSourceSourceIdSampleOptions = {baseUrl?: string | undefined, PipelineServiceKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create data sample * * POST /pipeline/{container_id}/source/{source_id}/sample */ export const createApiPipelineContainerIdSourceSourceIdSample = async (args: CreateApiPipelineContainerIdSourceSourceIdSampleArgs, options?: CreateApiPipelineContainerIdSourceSourceIdSampleOptions) => { 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.container_id))}/source/${encodeURIComponent(String(args.source_id))}/sample${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 };