export type GetApiScrapecreatorsV1PinterestPinArgs = {url: string, trim?: boolean | undefined}; export type GetApiScrapecreatorsV1PinterestPinOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pin * * GET /scrapecreators/v1/pinterest/pin */ export const getApiScrapecreatorsV1PinterestPin = async (args: GetApiScrapecreatorsV1PinterestPinArgs, options?: GetApiScrapecreatorsV1PinterestPinOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.url != null) query.append("url", String(args.url)) if (args.trim != null) query.append("trim", String(args.trim)) const url = `${baseUrl.replace(/\/+$/, '')}/scrapecreators/v1/pinterest/pin${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 };