export type CreateApiAccountsAccountIdTeamsTeamIdUsersArgs = {'X-PhraseApp-OTP'?: string | undefined, account_id: string, team_id: string, body: {id: string}}; export type CreateApiAccountsAccountIdTeamsTeamIdUsersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add User * * POST /accounts/{account_id}/teams/{team_id}/users */ export const createApiAccountsAccountIdTeamsTeamIdUsers = async (args: CreateApiAccountsAccountIdTeamsTeamIdUsersArgs, options?: CreateApiAccountsAccountIdTeamsTeamIdUsersOptions) => { const {baseUrl = "https://eu.phrase.com/control-hub", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-PhraseApp-OTP'] != null) headers.set("X-PhraseApp-OTP", String(args['X-PhraseApp-OTP'])) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.account_id))}/teams/${encodeURIComponent(String(args.team_id))}/users${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 };