export type GraphAttributes = {[key: string]: unknown} | null; export type ManageAssociationsGroup = {id: string, op: 'add' | 'remove' | 'update', attributes?: GraphAttributes | undefined, type: 'organization'}; export type CreateApiApiV2ProvidersProviderIdPolicygroupsGroupIdAssociationsArgs = {body: ManageAssociationsGroup}; export type CreateApiApiV2ProvidersProviderIdPolicygroupsGroupIdAssociationsOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Manage Policy Group Associations for Provider * * POST /api/v2/providers/{provider_id}/policygroups/{group_id}/associations */ export const createApiApiV2ProvidersProviderIdPolicygroupsGroupIdAssociations = async (args: CreateApiApiV2ProvidersProviderIdPolicygroupsGroupIdAssociationsArgs, options?: CreateApiApiV2ProvidersProviderIdPolicygroupsGroupIdAssociationsOptions) => { 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 (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/providers/${encodeURIComponent(String(args.provider_id))}/policygroups/${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 };