export type NewEnvironmentVariableSchema = {name: string, value: string}; export type VariableGroupsSchemasBulkImportSchema = {secure: boolean, variables: Array}; export type CreateApiApiV3VariableGroupsVariableGroupIdVariablesArgs = {variable_group_id: string, body: VariableGroupsSchemasBulkImportSchema}; export type CreateApiApiV3VariableGroupsVariableGroupIdVariablesOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bulk import variables to the group * * POST /api/v3/variable-groups/{variable_group_id}/variables */ export const createApiApiV3VariableGroupsVariableGroupIdVariables = async (args: CreateApiApiV3VariableGroupsVariableGroupIdVariablesArgs, options?: CreateApiApiV3VariableGroupsVariableGroupIdVariablesOptions) => { const {baseUrl = "https://codemagic.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("x-auth-token", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v3/variable-groups/${encodeURIComponent(String(args.variable_group_id))}/variables${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 };