export type GraphOperationSystem = {id: string, op: 'add' | 'remove' | 'update', attributes?: ({sudo?: ({enabled: boolean, withoutPassword: boolean} | null) | undefined} | {[key: string]: unknown} | null) | undefined, type: 'command' | 'policy' | 'policy_group' | 'user' | 'user_group'}; export type CreateApiSystemsSystemIdAssociationsArgs = {Date?: string | undefined, Authorization?: string | undefined, 'x-org-id'?: string | undefined, body: GraphOperationSystem}; export type CreateApiSystemsSystemIdAssociationsOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Manage associations of a System * * POST /systems/{system_id}/associations */ export const createApiSystemsSystemIdAssociations = async (args: CreateApiSystemsSystemIdAssociationsArgs, options?: CreateApiSystemsSystemIdAssociationsOptions) => { 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 (args.Date != null) headers.set("Date", String(args.Date)) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) 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(/\/+$/, '')}/systems/${encodeURIComponent(String(args.system_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 };