export type CreateApiMgGenagentV1DisengageArgs = {body: {namespace?: 'amazonconnect' | undefined, guid?: string | undefined}}; export type CreateApiMgGenagentV1DisengageOptions = {baseUrl?: string | undefined, APIID?: string | undefined, APISecret?: string | undefined, fetch?: typeof fetch | undefined}; /** * Disengage Genagent from conversation. * * POST /mg-genagent/v1/disengage */ export const createApiMgGenagentV1Disengage = async (args: CreateApiMgGenagentV1DisengageArgs, options?: CreateApiMgGenagentV1DisengageOptions) => { const {baseUrl = "https://api.sandbox.asapp.com", fetch: fetchFn = fetch, APIID, APISecret} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (APIID !== undefined) headers.set("asapp-api-id", APIID) if (APISecret !== undefined) headers.set("asapp-api-secret", APISecret) const url = `${baseUrl.replace(/\/+$/, '')}/mg-genagent/v1/disengage${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 };