export type DeleteApiV4UsersUserIdArgs = {user_id: string | string, transferToUserId: string | string}; export type DeleteApiV4UsersUserIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete user from team and transfer their content to another team member * * DELETE /v4/users/{user_id} */ export const deleteApiV4UsersUserId = async (args: DeleteApiV4UsersUserIdArgs, options: DeleteApiV4UsersUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.transferToUserId != null) query.append("transferToUserId", String(args.transferToUserId)) const url = `${baseUrl.replace(/\/+$/, '')}/v4/users/${encodeURIComponent(String(args.user_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };