export type GetApiScrapecreatorsV1TwitterUserTweetsArgs = {handle: string, trim?: string | undefined}; export type GetApiScrapecreatorsV1TwitterUserTweetsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * User Tweets * * GET /scrapecreators/v1/twitter/user-tweets */ export const getApiScrapecreatorsV1TwitterUserTweets = async (args: GetApiScrapecreatorsV1TwitterUserTweetsArgs, options?: GetApiScrapecreatorsV1TwitterUserTweetsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.handle != null) query.append("handle", String(args.handle)) if (args.trim != null) query.append("trim", String(args.trim)) const url = `${baseUrl.replace(/\/+$/, '')}/scrapecreators/v1/twitter/user-tweets${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 };