export type AddAccountRelatedProfileRequest = {userProfileId?: number | undefined, isDefault?: boolean | undefined}; export type CreateApiV1AccountsAccountIdProfilesArgs = {accountId: number, body: AddAccountRelatedProfileRequest}; export type CreateApiV1AccountsAccountIdProfilesOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add group to account. Enables group to access account * * POST /v1/Accounts/{accountId}/profiles */ export const createApiV1AccountsAccountIdProfiles = async (args: CreateApiV1AccountsAccountIdProfilesArgs, options: CreateApiV1AccountsAccountIdProfilesOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json-patch+json; x-api-version=1.0") if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/Accounts/${encodeURIComponent(String(args.accountId))}/profiles${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 };