export type GetApiUsersSocialLoginArgs = {type: unknown}; export type GetApiUsersSocialLoginOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * User social login for Twitter * * GET /users/social_login */ export const getApiUsersSocialLogin = async (args: GetApiUsersSocialLoginArgs, options: GetApiUsersSocialLoginOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.type != null) query.append("type", String(args.type)) const url = `${baseUrl.replace(/\/+$/, '')}/users/social_login${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };