export type GraphAttributes = {[key: string]: unknown} | null; export type GraphOperationSystemGroup = {id: string, op: 'add' | 'remove' | 'update', attributes?: GraphAttributes | undefined, type: 'command' | 'policy' | 'policy_group' | 'radius_server' | 'user' | 'user_group'}; export type CreateApiApiV2SystemgroupsGroupIdAssociationsArgs = {'x-org-id'?: string | undefined, body: GraphOperationSystemGroup}; export type CreateApiApiV2SystemgroupsGroupIdAssociationsOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Manage the associations of a System Group * * POST /api/v2/systemgroups/{group_id}/associations */ export const createApiApiV2SystemgroupsGroupIdAssociations = async (args: CreateApiApiV2SystemgroupsGroupIdAssociationsArgs, options?: CreateApiApiV2SystemgroupsGroupIdAssociationsOptions) => { const {baseUrl = "https://console.jumpcloud.com", fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-org-id'] != null) headers.set("x-org-id", String(args['x-org-id'])) if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/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 };