export type CreateApiFiberV1SocialMediaLookupTriggerArgs = {body: {person: Record, platforms?: Array | undefined, overallContext?: string | undefined}}; export type CreateApiFiberV1SocialMediaLookupTriggerOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Find social media profiles (Twitter, Instagram) for a person. Async: poll with /social-media-lookup/polling. * * POST /fiber/v1/social-media-lookup/trigger */ export const createApiFiberV1SocialMediaLookupTrigger = async (args: CreateApiFiberV1SocialMediaLookupTriggerArgs, options?: CreateApiFiberV1SocialMediaLookupTriggerOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/fiber/v1/social-media-lookup/trigger${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };