export type GetApiApiTwitterProfileUsersArgs = {dscvrPks: Array}; export type GetApiApiTwitterProfileUsersOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /api/twitter/profile/users */ export const getApiApiTwitterProfileUsers = async (args: GetApiApiTwitterProfileUsersArgs, options: GetApiApiTwitterProfileUsersOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.dscvrPks ?? []) query.append("dscvrPks", String(item)) const url = `${baseUrl.replace(/\/+$/, '')}/api/twitter/profile/users${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 };