export type CreateApiAiagentsSendImageArgs = {threadId: string, setupId?: number | undefined, body: BodyInit}; export type CreateApiAiagentsSendImageOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sends an image to the specified thread. * This method ensures that the image content is delivered * according to the provided parameters, including thread and image data. * * POST /aiagents/SendImage */ export const createApiAiagentsSendImage = async (args: CreateApiAiagentsSendImageArgs, options?: CreateApiAiagentsSendImageOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.threadId != null) query.append("threadId", String(args.threadId)) if (args.setupId != null) query.append("setupId", String(args.setupId)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/aiagents/SendImage${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };