export type VariableGroupsSchemasAdvancedSecuritySchema = {enabled: boolean, selected_apps: Array}; export type UpdateGroupSchema = {name?: (string | null) | undefined, advanced_security?: (VariableGroupsSchemasAdvancedSecuritySchema | null) | undefined}; export type PatchApiApiV3VariableGroupsVariableGroupIdArgs = {variable_group_id: string, body: UpdateGroupSchema}; export type PatchApiApiV3VariableGroupsVariableGroupIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Change group name and settings * * PATCH /api/v3/variable-groups/{variable_group_id} */ export const patchApiApiV3VariableGroupsVariableGroupId = async (args: PatchApiApiV3VariableGroupsVariableGroupIdArgs, options?: PatchApiApiV3VariableGroupsVariableGroupIdOptions) => { 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))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };