export type GraphAttributes = {[key: string]: unknown} | null; export type GraphOperationIDPRoutingPolicy = {id: string, op: 'add' | 'remove' | 'update', attributes?: GraphAttributes | undefined, type: 'user' | 'user_group'}; export type CreateApiIdentityProviderPoliciesIdpRoutingPolicyIdAssociationsArgs = {'x-org-id'?: string | undefined, body: GraphOperationIDPRoutingPolicy}; export type CreateApiIdentityProviderPoliciesIdpRoutingPolicyIdAssociationsOptions = {baseUrl?: string | undefined, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Manage the associations of a routing policy * * POST /identity-provider/policies/{idp_routing_policy_id}/associations */ export const createApiIdentityProviderPoliciesIdpRoutingPolicyIdAssociations = async (args: CreateApiIdentityProviderPoliciesIdpRoutingPolicyIdAssociationsArgs, options?: CreateApiIdentityProviderPoliciesIdpRoutingPolicyIdAssociationsOptions) => { 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['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(/\/+$/, '')}/identity-provider/policies/${encodeURIComponent(String(args.idp_routing_policy_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 };