export type CreateApiRunnersVariablesProjectsProjectIdVariableSetsVariableSetIdAttachArgs = {projectId: string, variableSetId: string, body: {consume: boolean}}; export type CreateApiRunnersVariablesProjectsProjectIdVariableSetsVariableSetIdAttachOptions = {baseUrl?: string | undefined, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Attach a variable set to a project * * POST /runners/variables/projects/{projectId}/variable-sets/{variableSetId}/attach */ export const createApiRunnersVariablesProjectsProjectIdVariableSetsVariableSetIdAttach = async (args: CreateApiRunnersVariablesProjectsProjectIdVariableSetsVariableSetIdAttachArgs, options?: CreateApiRunnersVariablesProjectsProjectIdVariableSetsVariableSetIdAttachOptions) => { const {baseUrl = "https://api.firefly.ai/v2", fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/runners/variables/projects/${encodeURIComponent(String(args.projectId))}/variable-sets/${encodeURIComponent(String(args.variableSetId))}/attach${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 };