export type GraphAttributes = {[key: string]: unknown} | null; export type ManageAssociationsGSuiteAccount = {id: string, op: 'add' | 'remove' | 'update', attributes?: GraphAttributes | undefined, type: 'organization'}; export type CreateApiProvidersProviderIdGSuitesGsuiteIdAssociationsArgs = {body: ManageAssociationsGSuiteAccount}; export type CreateApiProvidersProviderIdGSuitesGsuiteIdAssociationsOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Manage GSuite account Associations for Provider * * POST /providers/{provider_id}/g_suites/{gsuite_id}/associations */ export const createApiProvidersProviderIdGSuitesGsuiteIdAssociations = async (args: CreateApiProvidersProviderIdGSuitesGsuiteIdAssociationsArgs, options?: CreateApiProvidersProviderIdGSuitesGsuiteIdAssociationsOptions) => { 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))}/g_suites/${encodeURIComponent(String(args.gsuite_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 };