export type GraphAttributes = {[key: string]: unknown} | null; export type ManageAssociationsGroup = {id: string, op: 'add' | 'remove' | 'update', attributes?: GraphAttributes | undefined, type: 'organization'}; export type CreateApiProvidersProviderIdSystemgroupsGroupIdAssociationsArgs = {body: ManageAssociationsGroup}; export type CreateApiProvidersProviderIdSystemgroupsGroupIdAssociationsOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Manage System Group Associations for Provider * * POST /providers/{provider_id}/systemgroups/{group_id}/associations */ export const createApiProvidersProviderIdSystemgroupsGroupIdAssociations = async (args: CreateApiProvidersProviderIdSystemgroupsGroupIdAssociationsArgs, options?: CreateApiProvidersProviderIdSystemgroupsGroupIdAssociationsOptions) => { const {baseUrl = "https://console.jumpcloud.com/api/v2", fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/providers/${encodeURIComponent(String(args.provider_id))}/systemgroups/${encodeURIComponent(String(args.group_id))}/associations${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 };