export type GroupOrUserSourceEnum = 'rivery' | 'active_directory'; export type UserUpdateSourceInput = {source: GroupOrUserSourceEnum}; export type CreateApiV1AccountsAccountIdUsersUserIdSourceArgs = {user_id: string, account_id: string, body: UserUpdateSourceInput}; export type CreateApiV1AccountsAccountIdUsersUserIdSourceOptions = {baseUrl?: string | undefined, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update User Source * * POST /v1/accounts/{account_id}/users/{user_id}/source */ export const createApiV1AccountsAccountIdUsersUserIdSource = async (args: CreateApiV1AccountsAccountIdUsersUserIdSourceArgs, options?: CreateApiV1AccountsAccountIdUsersUserIdSourceOptions) => { const {baseUrl = "https://api.rivery.io", fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/accounts/${encodeURIComponent(String(args.account_id))}/users/${encodeURIComponent(String(args.user_id))}/source${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 };