export type CreateApiV1ExternalSupportProjectIdConversationsCloseArgs = {projectId: string, body: {botId: string, userId: string, redirectPayload?: ({type?: string | undefined, text?: string | undefined}) | undefined}}; export type CreateApiV1ExternalSupportProjectIdConversationsCloseOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Close Conversation * * POST /v1/external-support/{projectId}/conversations/close */ export const createApiV1ExternalSupportProjectIdConversationsClose = async (args: CreateApiV1ExternalSupportProjectIdConversationsCloseArgs, options?: CreateApiV1ExternalSupportProjectIdConversationsCloseOptions) => { const {baseUrl = "https://api.jelou.ai", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("x-api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/external-support/${encodeURIComponent(String(args.projectId))}/conversations/close${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 };