export type CreateApiManagementV20SystemCreatesystemmessageArgs = {Accept?: ('application/json' | 'application/hal+json' | 'application/xml' | 'text/xml' | 'text/csv') | undefined, body: {until: number, message: string, showOnLogin?: boolean | undefined}}; export type CreateApiManagementV20SystemCreatesystemmessageOptions = {baseUrl?: string | undefined, BasicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Create a System Message * * POST /management/v2.0/system/createsystemmessage */ export const createApiManagementV20SystemCreatesystemmessage = async (args: CreateApiManagementV20SystemCreatesystemmessageArgs, options?: CreateApiManagementV20SystemCreatesystemmessageOptions) => { const {baseUrl = "https://api-trial.cognigy.ai/testing", fetch: fetchFn = fetch, BasicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (BasicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${BasicAuth.username}:${BasicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/management/v2.0/system/createsystemmessage${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 };