UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

1,653 lines (1,651 loc) 914 kB
// Generated by dts-bundle-generator v6.12.0 import { IToolDescriptor } from '@cognigy/extension-tools'; import { AxiosResponseHeaders } from 'axios'; export declare type Options = { [key: string]: unknown; }; export declare type ApiExtension = { [key: string]: any; }; export declare type TestPlugin = (instance: Base, options: Options) => ApiExtension | undefined; export declare type Constructor<T> = new (...args: any[]) => T; /** * @author https://stackoverflow.com/users/2887218/jcalz * @see https://stackoverflow.com/a/50375286/10325032 */ export declare type UnionToIntersection<Union> = (Union extends any ? (argument: Union) => void : never) extends (argument: infer Intersection) => void ? Intersection : never; export declare type AnyFunction = (...args: any) => any; export declare type ReturnTypeOf<T extends AnyFunction | AnyFunction[]> = T extends AnyFunction ? ReturnType<T> : T extends AnyFunction[] ? UnionToIntersection<ReturnType<T[number]>> : never; declare class Base { static plugins: TestPlugin[]; static plugin<S extends Constructor<any> & { plugins: any[]; }, T extends TestPlugin | TestPlugin[]>(this: S, plugin: T): { new (...args: any[]): { [x: string]: any; }; plugins: any[]; } & S & Constructor<ReturnTypeOf<T>>; static defaults<S extends Constructor<any>>(this: S, defaults: Options): { new (...args: any[]): { [x: string]: any; }; } & S; constructor(options?: Options); options: Options; } export interface IApiKeyAuthentication { type: "ApiKey"; apiKey: string; } export interface IBasicAuthentication { type: "Basic"; username: string; password: string; } export interface IOAuth2Authentication { type: "OAuth2"; /** * The clientId of the client * * @see https://tools.ietf.org/html/rfc6749#section-2.2 */ clientId: string; /** * The clientId of the client * * @see https://tools.ietf.org/html/rfc6749#section-2.2 */ clientSecret: string; } export interface IJwtTokenAuthentication { type: "JWT"; token: string; } export declare type TAuthenticationCredentials = IApiKeyAuthentication | IBasicAuthentication | IOAuth2Authentication | IJwtTokenAuthentication; export interface ILoginByPasswordParameters { type: "password"; /** * The username for the Password Grant * * @see https://tools.ietf.org/html/rfc6749#section-1.3.3 */ username: string; /** * The password for the Password Grant * * @see https://tools.ietf.org/html/rfc6749#section-1.3.3 */ password: string; /** * If rememberMe is set to true, you get a long lived refreshToken, default * 30 days. If rememberMe is set to false, you get a short lived refreshToken. * * @default false */ rememberMe: boolean; /** * Organisation ID of the login user * Required if the user is part of multiple organisation * This is passed in the request header */ organisationId?: string; } export interface ILoginByRefreshTokenParameters { type: "refreshToken"; /** * The refreshToken is used for the Refresh Token Grant * * @see https://tools.ietf.org/html/rfc6749#section-1.5 */ refreshToken?: string; } export interface IAuthenticationAdapter { getAuthenticationHeaders: () => Promise<{ [key: string]: string; }>; login?: ({ username, password }: { username: any; password: any; }) => Promise<void>; logout?: () => Promise<void>; } export interface IHttpProgressEvent { loaded: number; total: number; } export declare type TMethod = "get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH"; export interface IHttpRequest extends IHttpRequestOptions { /** * The server URL that will be used for the request. */ url: string; /** * The request method to be used when making the request */ method: TMethod; /** * baseURL will be prepended to url unless url is absolute. */ baseUrl?: string; /** * The body of the request. */ data?: any; } export interface IHttpRequestOptions { /** * Custom headers to be sent. */ headers?: { [key: string]: string; }; /** * Should add Authentication-information to the request. * @default true */ withAuthentication?: boolean; /** * Should send credentials to the request. * @default false */ withCredentials?: boolean; /** * Specifies the number of milliseconds before the request times out. */ timeout?: number; /** * Defines if the timeout should be reset between retries * @default false */ shouldResetTimeout?: boolean; /** * The number of times to retry the before failing. * @default 3 */ maxRetries?: number; /** * A callback to further control if a request should be retried. * @default isNetworkOrIdempotentRequestError */ retryCondition?: (error: Error) => boolean; /** * A callback to further control the delay between retried requests. By * default there is no delay between retries. Another option is * exponentialDelay. The function is passed retryCount and error. * @default exponentialDelay */ retryDelay?: (retryNumber?: number, error?: Error) => number; /** * A progress-Handler. */ onProgress?: (progressEvent: IHttpProgressEvent) => void; } export declare type TRestAPIOperation<Data = void, ReturnValue = void> = Data extends void ? (options?: IHttpRequestOptions) => Promise<ReturnValue> : Data extends TRestAPIOptionalParameter<infer T> ? (args?: T, options?: IHttpRequestOptions) => Promise<ReturnValue> : (args: Data, options?: IHttpRequestOptions) => Promise<ReturnValue>; export declare type TRestAPIOptionalParameter<Data> = { optional: Data; }; /** * @openapi * components: * parameters: * webfingerResourceQueryParam: * in: query * name: resource * required: true * schema: * type: string * format: uri * webfingerRelQueryParam: * in: query * name: rel * schema: * type: array * items: * $ref: '#/components/schemas/TRelType' */ export interface IWebfingerRestDataQuery { resource: string; rel?: TRelType[]; } /** * @openapi * components: * schemas: * TRelType: * type: array * items: * type: string * enum: * - idp */ export declare type TRelType = "idp"; export interface IWebfingerRestData extends IWebfingerRestDataQuery { } /** * @openapi * components: * schemas: * IWebfingerRestReturnValue: * type: object * properties: * subject: * type: string * example: org:5ce7c2d833ea1e04d7e6c432 * links: * type: array * items: * $ref: '#/components/schemas/TRel' */ export interface IWebfingerRestReturnValue { subject: string; links: TRel[]; } /** * @openapi * components: * schemas: * TRel: * type: object * allOf: * - $ref: '#/components/schemas/IIdpRel' */ export declare type TRel = IIdpRel; /** * @openapi * components: * schemas: * IIdpRel: * type: object * properties: * rel: * type: string * enum: * - idp * properties: * $ref: '#/components/schemas/TIdpWebfingerProperties' */ export interface IIdpRel { rel: "idp"; properties: TIdpWebfingerProperties; } /** * @openapi * components: * schemas: * TIdpWebfingerProperties: * type: object * oneOf: * - $ref: '#/components/schemas/INoneIdpWebfingerProperties' * - $ref: '#/components/schemas/IOidcIdpWebfingerProperties' * - $ref: '#/components/schemas/ISamlIdpWebfingerProperties' */ export declare type TIdpWebfingerProperties = INoneIdpWebfingerProperties | IOidcIdpWebfingerProperties | ISamlIdpWebfingerProperties; /** * @openapi * components: * schemas: * INoneIdpWebfingerProperties: * type: object * properties: * idp:type: * type: string * enum: * - none */ export interface INoneIdpWebfingerProperties { "idp:type": "none"; } /** * @openapi * components: * schemas: * IOidcIdpWebfingerProperties: * type: object * properties: * idp:type: * type: string * enum: * - oidc * idp:callback: * type: string * format: url * idp:login: * type: string * format: url * idp:logout: * type: string * format: url * idp:logout:fc: * type: string * format: url */ export interface IOidcIdpWebfingerProperties { "idp:type": "oidc"; "idp:callback": string; "idp:login": string; "idp:logout": string; "idp:logout:fc": string; } /** * @openapi * components: * schemas: * ISamlIdpWebfingerProperties: * type: object * properties: * idp:type: * type: string * enum: * - oidc * idp:login: * type: string * format: url * idp:logout: * type: string * format: url */ export interface ISamlIdpWebfingerProperties { "idp:type": "saml"; "idp:login": string; "idp:logout": string; } export interface IGetRealtimeTokenRestReturnValue { token: string; } export interface ILoginByAuthorizationCodeParameters { type: "authorizationCode"; /** * The authorization code to exchange for a token * * @see https://tools.ietf.org/html/rfc6749#section-1.3.1 */ code: string; /** * The redirect URI that was used when the code was generated * * @see https://tools.ietf.org/html/rfc6749#section-1.3.1 */ redirectUri: string; /** * Optional state value to pass around in the requests. * * @see https://tools.ietf.org/html/rfc6749#section-10.12 */ state?: string; /** * Required for client "cognigy-live-agent". * The code verifier for authentication using authorization code with PKCE */ codeVerifier?: string; /** * If rememberMe is set to true, you get a long lived refreshToken, default * 7 days. If rememberMe is set to false, you get a short lived refreshToken valid only for 24 hours. * * @default false */ rememberMe: boolean; } export interface IGetAuthorizationCodeParameters { /** * The username for the Authorization Code Grant */ username: string; /** * The password for the Authorization Code Grant */ password: string; /** * The URI to redirect to with the generated authorization code * * @see https://tools.ietf.org/html/rfc6749#section-1.3.1 */ redirectUri?: string; /** * Optional state value to pass around in the requests. * * @see https://tools.ietf.org/html/rfc6749#section-10.12 */ state?: string; /** * Organisation ID of the login user * Required if the user is part of multiple organisation * This is passed in the request header */ organisationId?: string; /** * Required for client "cognigy-live-agent". * The code challenge for authentication using * authorization code with PKCE */ codeChallenge?: string; /** * Required for client "cognigy-live-agent". * The code challenge method to be used for authentication using * authorization code with PKCE */ codeChallengeMethod?: string; } declare const organisationWidePermissions: readonly [ "analyticsOdata", "apiKeys", "auditEvents", "assignProject", "liveAgentAccount", "projects", "userDetails", "users", "voiceGatewayAccount", "opsCenter" ]; export declare type TOrganisationWidePermissions = typeof organisationWidePermissions[number]; declare const projectWidePermissions: readonly [ "agentAssistConfigs", "aiAgents", "analytics", "connections", "contactProfiles", "conversationHistory", "endpoints", "extensions", "extensionsTrust", "flowNodeComments", "flowNodeDescription", "flowNodes", "functions", "flows", "followUser", "intents", "largeLanguageModels", "knowledgeStores", "lexicons", "liveAgentInbox", "locales", "logs", "memberDetails", "members", "goals", "handoverProviders", "nluConnectors", "packages", "playbooks", "proactive", "project", "projectSettings", "snapshots", "states", "tasks", "tokens", "yesNoIntents", "dataPrivacySettings", "simulator" ]; export declare type TProjectWidePermissions = typeof projectWidePermissions[number]; export declare type TMongoId = string; /** * @openapi * components: * schemas: * TTimestamp: * type: integer * description: Unix-timestamp * example: 1694518620 * minimum: 0 * maximum: 2147483647 */ export declare type TTimestamp = number; /** * @openapi * components: * schemas: * IEntityMeta: * description: > * The IEntityMeta defines meta information every entity within the system * has. These are dates when a resource was created and modified as well as information * about the user who initially created a resource and who modified it the last time. * type: object * properties: * _id: * $ref: '#/components/schemas/TMongoId' * createdAt: * $ref: '#/components/schemas/TTimestamp' * lastChanged: * $ref: '#/components/schemas/TTimestamp' * createdBy: * $ref: '#/components/schemas/TMongoId' * lastChangedBy: * $ref: '#/components/schemas/TMongoId' */ export interface IEntityMeta { /** The Mongo id of the entity */ _id: TMongoId; /** Unix-timestamp when the entity was created initially */ createdAt: TTimestamp; /** Unix-timestamp when the entity was changed last time */ lastChanged: TTimestamp; /** The mongoId of the user who created the entity initially */ createdBy: TMongoId; /** The mongoId of the user who did the last modification */ lastChangedBy: TMongoId; } declare const entityMetaKeys: ReadonlyArray<keyof IEntityMeta>; export declare type TEntityMetaKeys = typeof entityMetaKeys[number]; export declare enum ErrorCode { BAD_REQUEST = 400, UNAUTHORIZED_ERROR = 401, PAYMENT_REQUIRED_ERROR = 402, FORBIDDEN_ERROR = 403, NOT_FOUND = 404, PAYLOAD_TOO_LARGE_ERROR = 413, TOO_MANY_REQUESTS_ERROR = 429, BAD_GATEWAY = 502, SERVICE_UNAVAILABLE_ERROR = 503, GATEWAY_TIMEOUT_ERROR = 504, NETWORK_ERROR = 666, MISSING_ARGUMENT_ERROR = 1000, DATABASE_WRITE_ERROR = 1001, RESOURCE_NOT_FOUND_ERROR = 1002, DATABASE_READ_ERROR = 1003, CONFLICT_ERROR = 1004, INVALID_ARGUMENT_ERROR = 1005, IMPORT_ERROR = 1006, EXPORT_ERROR = 1007, INTERNAL_SERVER_ERROR = 1008, NOT_IMPLEMENTED_ERROR = 1009, PROCESS_ERROR = 1010, FILE_READ_ERROR = 1011, FILE_WRITE_ERROR = 1012, METHOD_NOT_ALLOWED_ERROR = 1013, SMTP_CONNECT_ERROR = 1999, DATABASE_CONNECT_ERROR = 2000, DATABASE_QUERY_ERROR = 2001, INPUT_OUTPUT_ERROR = 3000, TIMEOUT_ERROR = 8001 } export interface ISuggestedMetaInfo { organisationId?: string; userId?: string; projectId?: string; flowId?: string; /** Name of the file */ module?: string; /** Name of the function */ function?: string; /** Originally thrown error to capture the stacktrace and other info*/ originalError?: { [key: string]: any; }; /** Database query used */ query?: { [key: string]: any; }; /** For other keys */ [key: string]: any; } declare const logLevels: readonly [ "fatal", "error", "warn", "info", "debug", "trace" ]; export declare type TLogLevel = typeof logLevels[number]; export interface ILoggerStack { /** A traceId represents one particular trace for one request. */ traceId?: string; disableSensitiveLogging?: boolean; } /** * RFC 7807 conform ErrorResponse * * @see https://tools.ietf.org/html/rfc7807 */ export interface IErrorResponse { /** * A URI reference [RFC3986] that identifies the * problem type. This specification encourages that, when * dereferenced, it provide human-readable documentation for the * problem type (e.g., using HTML [W3C.REC-html5-20141028]). When * this member is not present, its value is assumed to be * "about:blank". */ type?: string; /** * A short, human-readable summary of the problem * type. It SHOULD NOT change from occurrence to occurrence of the * problem, except for purposes of localization (e.g., using * proactive content negotiation; see [RFC7231], Section 3.4). */ title?: string; /** * The HTTP status code ([RFC7231], Section 6) * generated by the origin server for this occurrence of the problem. */ status?: number; /** * A human-readable explanation specific to this * occurrence of the problem. */ detail?: string; /** * A URI reference that identifies the specific * occurrence of the problem. It may or may not yield further * information if dereferenced. */ instance?: string; code: number; traceId?: ILoggerStack["traceId"]; [key: string]: any; } export interface IBaseErrorConstructorOptions { name: string; message: string; code: ErrorCode; httpStatusCode: number; httpStatusText: string; stack: ILoggerStack; meta?: ISuggestedMetaInfo; /** `logLevel` parameter indicates the overriding log level for the errors. * For eg: `ResourceNotFound` scenario is not actually an error in the * system, so this parameter will allow us to log them as info/debug level, * but do not change the actual error respose in any way. */ logLevel?: TLogLevel; details: { [key: string]: any; }; } export interface IOriginalErrorDetails { message: string; stack?: string; name: string; code?: any; data?: any; path?: any; } export interface IErrorLogDetails { name: string; code: string | number; httpStatusCode: number; httpStatusText: string; loggerstack: ILoggerStack; details: { [key: string]: any; }; meta: { [key: string]: any; }; originalError: IOriginalErrorDetails; stack: string; } declare class BaseError extends Error { code: ErrorCode; readonly httpStatusCode: number; readonly httpStatusText: string; readonly loggerstack: ILoggerStack; readonly meta: { [key: string]: any; }; readonly details: { [key: string]: any; }; readonly originalErrorDetails: IOriginalErrorDetails; private readonly logLevel; constructor({ name, message, code, httpStatusCode, httpStatusText, stack, meta, details, logLevel }: IBaseErrorConstructorOptions); private parseOriginalError; toErrorLogDetails(): IErrorLogDetails; toResponse(): IErrorHandler; toRFC7807Response(data?: { path?: string; traceId?: string; }): IErrorResponse; } declare class BadGatewayError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class BadRequestError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class ConflictError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class DatabaseConnectError extends BadGatewayError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class InternalServerError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class DatabaseQueryError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class DatabaseReadError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class DatabaseWriteError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class ExportError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class FileReadError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class FileWriteError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class ForbiddenError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class GatewayTimeoutError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } export interface IImportErrorDetails { duplicateSynonyms?: string[][]; duplicateKeyphrases?: string[][]; invalidEntries?: string[][]; reservedTags?: string[][]; } declare class ImportError extends InternalServerError { readonly details: IImportErrorDetails; constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: IImportErrorDetails, logLevel?: TLogLevel); } declare class InputOutputError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class InvalidArgumentError extends BadRequestError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); toRFC7807Response(data?: { path?: string; traceId?: string; }): IErrorResponse; } declare class MethodNotAllowedError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class MissingArgumentError extends BadRequestError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); toRFC7807Response(data?: { path?: string; traceId?: string; }): IErrorResponse; } declare class NetworkError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class NotImplementedError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class PayloadTooLargeError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class PaymentRequiredError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class ProcessError extends InternalServerError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class ResourceNotFoundError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class SMTPConnectError extends BadGatewayError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class TimeoutError extends GatewayTimeoutError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class TooManyRequestsError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class UnauthorizedError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } declare class ServiceUnavailableError extends BaseError { constructor(message: string, stack?: ILoggerStack, meta?: ISuggestedMetaInfo, details?: { [key: string]: any; }, logLevel?: TLogLevel); } export interface IErrorCollection { [ErrorCode.UNAUTHORIZED_ERROR]: typeof UnauthorizedError; [ErrorCode.BAD_GATEWAY]: typeof BadGatewayError; [ErrorCode.BAD_REQUEST]: typeof BadRequestError; [ErrorCode.CONFLICT_ERROR]: typeof ConflictError; [ErrorCode.DATABASE_CONNECT_ERROR]: typeof DatabaseConnectError; [ErrorCode.DATABASE_QUERY_ERROR]: typeof DatabaseQueryError; [ErrorCode.DATABASE_READ_ERROR]: typeof DatabaseReadError; [ErrorCode.DATABASE_WRITE_ERROR]: typeof DatabaseWriteError; [ErrorCode.EXPORT_ERROR]: typeof ExportError; [ErrorCode.FILE_READ_ERROR]: typeof FileReadError; [ErrorCode.FILE_WRITE_ERROR]: typeof FileWriteError; [ErrorCode.FORBIDDEN_ERROR]: typeof ForbiddenError; [ErrorCode.GATEWAY_TIMEOUT_ERROR]: typeof GatewayTimeoutError; [ErrorCode.IMPORT_ERROR]: typeof ImportError; [ErrorCode.INPUT_OUTPUT_ERROR]: typeof InputOutputError; [ErrorCode.INTERNAL_SERVER_ERROR]: typeof InternalServerError; [ErrorCode.INVALID_ARGUMENT_ERROR]: typeof InvalidArgumentError; [ErrorCode.METHOD_NOT_ALLOWED_ERROR]: typeof MethodNotAllowedError; [ErrorCode.MISSING_ARGUMENT_ERROR]: typeof MissingArgumentError; [ErrorCode.NOT_FOUND]: typeof ResourceNotFoundError; [ErrorCode.NETWORK_ERROR]: typeof NetworkError; [ErrorCode.NOT_IMPLEMENTED_ERROR]: typeof NotImplementedError; [ErrorCode.PAYLOAD_TOO_LARGE_ERROR]: typeof PayloadTooLargeError; [ErrorCode.PROCESS_ERROR]: typeof ProcessError; [ErrorCode.RESOURCE_NOT_FOUND_ERROR]: typeof ResourceNotFoundError; [ErrorCode.SERVICE_UNAVAILABLE_ERROR]: typeof ServiceUnavailableError; [ErrorCode.SMTP_CONNECT_ERROR]: typeof SMTPConnectError; [ErrorCode.TIMEOUT_ERROR]: typeof TimeoutError; [ErrorCode.TOO_MANY_REQUESTS_ERROR]: typeof TooManyRequestsError; [ErrorCode.PAYMENT_REQUIRED_ERROR]: typeof PaymentRequiredError; } export declare const ErrorCollection: IErrorCollection; export interface IErrorHandler { error?: { code: number; message: string; loggerstack?: ILoggerStack; meta?: ISuggestedMetaInfo; details?: { [key: string]: any; }; logLevel?: TLogLevel; }; } export interface IBasicPayload { type: string; data: any; } export interface IPayloadBaseMetaData { traceId: string; disableSensitiveLogging: boolean; } export declare type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]>; }; export interface IPayloadBasePropertiesData<T, OmittedKeys extends keyof any = keyof IEntityMeta> { properties: Partial<Omit<Partial<T>, OmittedKeys>>; } export declare type IFilterQuery<T> = Partial<{ [P in keyof T]: T[P] extends boolean ? T[P] : T[P] | T[P][]; }>; declare const referenceKeys: readonly [ "analyticsStepReference", "chartReference", "dataReference", "extensionReference", "fallbackLocaleReference", "flowReference", "functionReference", "handoverRequestReference", "intentReference", "intentTrainGroupReference", "lexiconEntryReference", "lexiconReference", "localeReference", "nodeDescriptorReference", "nodeDescriptorSetReference", "nodeReference", "organisationReference", "primaryLocaleReference", "projectReference", "resourceReference", "snapshotReference", "subResourceReference", "connectorReference", "storeReference", "sourceReference" ]; export declare type TReferenceKeys = (typeof referenceKeys)[number]; export declare type TReferenceAndEntityMetaKeys = TReferenceKeys | TEntityMetaKeys | "referenceId"; export declare type TNonQueriableKeys<T> = TReferenceKeys; declare const arrayTResourceType: readonly [ "agentassistconfig", "agentSettings", "chart", "connection", "connectionSchema", "endpoint", "endpointApiKey", "extension", "file", "flow", "flowSettings", "flowState", "function", "handoverProvider", "intent", "intentDefaultReply", "intentLearningSentence", "intentRelation", "intentSentence", "intentTrainGroup", "largeLanguageModel", "knowledgeStore", "knowledgeSource", "knowledgeChunk", "knowledgeConnector", "lexicon", "lexiconEntry", "lexiconKeyphrase", "lexiconSlot", "locale", "goal", "nluconnector", "nodeData", "nodeDescriptorSet", "package", "playbook", "playbookRun", "slotFiller", "snapshot", "snippet", "aiAgent", "simulation", "evalProfile", "scheduler", "personaGeneration" ]; export declare type TResourceType = (typeof arrayTResourceType)[number]; declare const arrayTChartableResourceType: readonly [ "flow" ]; export declare type TChartableResourceType = (typeof arrayTChartableResourceType)[number]; declare const searchableResourceTypes: readonly [ "endpoint", "extension", "flow", "function", "largeLanguageModel", "lexicon", "goal", "nluconnector", "playbook", "project", "snapshot", "simulation", "evalProfile" ]; export declare type TSearchableResourceType = (typeof searchableResourceTypes)[number]; declare const pinnableResourceTypes: readonly [ "project" ]; /** * @openapi * components: * schemas: * TPinnableResourceType: * type: string * description: The type of a pinnable resource * example: project * enum: * - project */ export declare type TPinnableResourceType = (typeof pinnableResourceTypes)[number]; declare const organisationWideRoles: readonly [ "admin", "apiKeys", "base_role", "basicSupportUser", "fullSupportUser", "liveAgentAdmin", "liveAgentAgent", "liveAgentSupervisor", "livechat", "odata", "projectAssigner", "projectManager", "userManager", "userDetailsViewer", "voiceGatewayUser", "autoDialerUser", "opsCenterUser" ]; export declare type TOrganisationWideRole = typeof organisationWideRoles[number]; declare const projectWideRoles: readonly [ "agentAssistConfigAdmin", "agentAssistConfigViewer", "analytics", "basic", "connection_admin", "contact_profile_admin", "contact_profile_editor", "contact_profile_viewer", "conversationHistory", "developer", "endpoint_admin", "extension_admin", "extension_editor", "extension_trust_admin", "flowEditor", "flowNodeComments", "flowNodeDescriptions", "followUser", "function_admin", "function_editor", "handoverProviderAdmin", "intents", "knowledgeAdmin", "large_language_model_admin", "lexicon_admin", "lexicon_editor", "localesAdmin", "logs", "memberManager", "nlu_connector_admin", "packages_admin", "playbook_admin", "playbook_editor", "projectAdmin", "snapshot_admin", "tokenAdmin", "tokenEditor", "data_privacy_admin", "data_privacy_editor", "data_privacy_viewer", "simulator_admin" ]; export declare type TProjectWideRole = typeof projectWideRoles[number]; /** * @openapi * * components: * schemas: * ICrudPermissions: * type: object * properties: * create: * type: boolean * read: * type: boolean * update: * type: boolean * delete: * type: boolean */ export interface ICrudPermissions { create: boolean; read: boolean; update: boolean; delete: boolean; } /** * @openapi * * components: * schemas: * IOrganisationWideAcl: * type: object * properties: * rights: * type: object * properties: * analyticsOdata: * $ref: '#/components/schemas/ICrudPermissions' * apiKeys: * $ref: '#/components/schemas/ICrudPermissions' * auditEvents: * $ref: '#/components/schemas/ICrudPermissions' * liveAgentAccount: * $ref: '#/components/schemas/ICrudPermissions' * projects: * $ref: '#/components/schemas/ICrudPermissions' * userDetails: * $ref: '#/components/schemas/ICrudPermissions' * users: * $ref: '#/components/schemas/ICrudPermissions' * connections: * $ref: '#/components/schemas/ICrudPermissions' * contactProfiles: * $ref: '#/components/schemas/ICrudPermissions' * conversationHistory: * $ref: '#/components/schemas/ICrudPermissions' * endpoints: * $ref: '#/components/schemas/ICrudPermissions' * extensions: * $ref: '#/components/schemas/ICrudPermissions' * flowNodeComments: * $ref: '#/components/schemas/ICrudPermissions' * flowNodeDescription: * $ref: '#/components/schemas/ICrudPermissions' * flowNodes: * $ref: '#/components/schemas/ICrudPermissions' * flows: * $ref: '#/components/schemas/ICrudPermissions' * intents: * $ref: '#/components/schemas/ICrudPermissions' * knowledgeStores: * $ref: '#/components/schemas/ICrudPermissions' * lexicons: * $ref: '#/components/schemas/ICrudPermissions' * liveAgentInbox: * $ref: '#/components/schemas/ICrudPermissions' * locales: * $ref: '#/components/schemas/ICrudPermissions' * logs: * $ref: '#/components/schemas/ICrudPermissions' * memberDetails: * $ref: '#/components/schemas/ICrudPermissions' * members: * $ref: '#/components/schemas/ICrudPermissions' * goals: * $ref: '#/components/schemas/ICrudPermissions' * nluConnectors: * $ref: '#/components/schemas/ICrudPermissions' * playbooks: * $ref: '#/components/schemas/ICrudPermissions' * project: * $ref: '#/components/schemas/ICrudPermissions' * projectSettings: * $ref: '#/components/schemas/ICrudPermissions' * snapshots: * $ref: '#/components/schemas/ICrudPermissions' * states: * $ref: '#/components/schemas/ICrudPermissions' * tasks: * $ref: '#/components/schemas/ICrudPermissions' * tokens: * $ref: '#/components/schemas/ICrudPermissions' * voiceGatewayAccount: * $ref: '#/components/schemas/ICrudPermissions' * roles: * type: array * items: * $ref: '#/components/schemas/TOrganisationWideRole' */ /** ACL properties organisation-wide */ export interface IOrganisationWideAcl { rights: { [P in TOrganisationWidePermissions]: ICrudPermissions; }; roles: TOrganisationWideRole[]; } /** * @openapi * * components: * schemas: * IProjectWideAcl: * type: object * properties: * rights: * type: object * properties: * agentAssistConfigs: * $ref: '#/components/schemas/ICrudPermissions' * analytics: * $ref: '#/components/schemas/ICrudPermissions' * connections: * $ref: '#/components/schemas/ICrudPermissions' * contactProfiles: * $ref: '#/components/schemas/ICrudPermissions' * conversationHistory: * $ref: '#/components/schemas/ICrudPermissions' * endpoints: * $ref: '#/components/schemas/ICrudPermissions' * extensions: * $ref: '#/components/schemas/ICrudPermissions' * extensionsTrust: * $ref: '#/components/schemas/ICrudPermissions' * flowNodeComments: * $ref: '#/components/schemas/ICrudPermissions' * flowNodeDescription: * $ref: '#/components/schemas/ICrudPermissions' * flowNodes: * $ref: '#/components/schemas/ICrudPermissions' * flows: * $ref: '#/components/schemas/ICrudPermissions' * handoverProviders: * $ref: '#/components/schemas/ICrudPermissions' * intents: * $ref: '#/components/schemas/ICrudPermissions' * largeLanguageModels: * $ref: '#/components/schemas/ICrudPermissions' * knowledgeStores: * $ref: '#/components/schemas/ICrudPermissions' * lexicons: * $ref: '#/components/schemas/ICrudPermissions' * liveAgentInbox: * $ref: '#/components/schemas/ICrudPermissions' * locales: * $ref: '#/components/schemas/ICrudPermissions' * logs: * $ref: '#/components/schemas/ICrudPermissions' * memberDetails: * $ref: '#/components/schemas/ICrudPermissions' * members: * $ref: '#/components/schemas/ICrudPermissions' * goals: * $ref: '#/components/schemas/ICrudPermissions' * nluConnectors: * $ref: '#/components/schemas/ICrudPermissions' * playbooks: * $ref: '#/components/schemas/ICrudPermissions' * project: * $ref: '#/components/schemas/ICrudPermissions' * projectSettings: * $ref: '#/components/schemas/ICrudPermissions' * snapshots: * $ref: '#/components/schemas/ICrudPermissions' * states: * $ref: '#/components/schemas/ICrudPermissions' * tasks: * $ref: '#/components/schemas/ICrudPermissions' * tokens: * $ref: '#/components/schemas/ICrudPermissions' * analyticsOdata: * $ref: '#/components/schemas/ICrudPermissions' * apiKeys: * $ref: '#/components/schemas/ICrudPermissions' * projects: * $ref: '#/components/schemas/ICrudPermissions' * userDetails: * $ref: '#/components/schemas/ICrudPermissions' * users: * $ref: '#/components/schemas/ICrudPermissions' * simulator: * $ref: '#/components/schemas/ICrudPermissions' * additionalProperties: * $ref: '#/components/schemas/ICrudPermissions' * roles: * type: array * items: * $ref: '#/components/schemas/TProjectWideRole' * allowedLocales: * type: array * items: * $ref: '#/components/schemas/IAllowedLocale' */ /** ACL properties project-wide */ export interface IProjectWideAcl { rights: { [P in TProjectWidePermissions | TOrganisationWidePermissions]: ICrudPermissions; }; roles: TProjectWideRole[]; allowedLocales: IAllowedLocale[]; } /** * @openapi * * components: * schemas: * IAllowedLocale: * type: object * properties: * localeId: * $ref: '#/components/schemas/TMongoId' * primary: * type: boolean */ export interface IAllowedLocale { localeId: TMongoId; primary?: boolean; } /** * @openapi * * components: * schemas: * ISamlIdentityProviderData: * type: object * properties: * idpType: * type: string * enum: * - saml * idpIssuer: * type: string * description: The value that will be in the issuer field in the SAML request. * format: url * idpLoginEndpoint: * type: string * description: The URL to use to login in the IDP. Used in the SP initiated Flow. * format: url * idpLogoutEndpoint: * type: string * description: The URL to send SLO requests against. Not all identity providers support this. * format: url * idpCertificate: * type: string * description: The certificate from the ID used to sign the SAML requests. It is base64 encoded. * wantAuthnResponseSigned: * type: boolean * description: If the SAML authentification response should be signed, not all providers support this. * decryptionPrivateKey: * type: string * description: An optional decryption key. This is necessary if the SAML request is encoded. * idpDisableRequestedAuthnContext: * type: boolean * description: For some providers, e.g. Azure on-prem, it might be necessary to disable the authn context field in the SAML request. * default: false */ export interface ISamlIdentityProvider { _id: TMongoId; idpType: "saml"; /** * The value that will be in the issuer field in the SAML request. * E.g. https://cognigy.okta.com/home/cognigy_cognigy_1/0oa7t4vrgbbBV6ujF356/aln7t9avrJOKuoj9l356 */ idpIssuer: string; /** * The URL to use to login in the IDP. Used in the SP initiated Flow. */ idpLoginEndpoint: string; /** * The URL to send SLO requests against. Not all identity providers support * this. */ idpLogoutEndpoint: string; /** * The certificate from the ID used to sign the SAML requests. * * Base64 encoded **/ idpCertificate: string; /** * An optional decryption key. This is necessary if the SAML request is * encoded. * * Base64 encoded **/ decryptionPrivateKey: string; /** * For some providers, e.g. Azure on-prem, it might be necessary to disable * the authn context field in the SAML request. */ idpDisableRequestedAuthnContext: boolean; /** * Reference the organisation this identity provider belongs to. */ organisationReference: TMongoId; /** * If the SAML authentification response should be signed, * not all providers support this. */ wantAuthnResponseSigned?: boolean; } declare const idpTokenEndpointAuthMethods: readonly [ "client_secret_basic", "client_secret_post", "client_secret_jwt", "private_key_jwt", "tls_client_auth", "self_signed_tls_client_auth", "none" ]; export declare type TIdpTokenEndpointAuthMethod = typeof idpTokenEndpointAuthMethods[number]; declare const idpIdTokenSignedResponseAlgs: readonly [ "RS256", "RS384", "RS512", "HS256", "HS384", "HS512" ]; export declare type TIdpIdTokenSignedResponseAlg = typeof idpIdTokenSignedResponseAlgs[number]; /** * @openapi * * components: * schemas: * IOidcIdentityProviderData: * type: object * properties: * idpType: * type: string * enum: * - oidc * idpIssuer: * type: string * description: The URL of the OIDC identity provider. Must include `https://` to ensure a secure connection. Example `https://accounts.google.com`. * format: url * idpClientId: * type: string * description: | * The client identifier issued to the client during * the registration process. * * The authorization server issues the registered client a client * identifier -- a unique string representing the registration * information provided by the client. The client identifier is not * a secret; it is exposed to the resource owner and MUST NOT be * used alone for client authentication. * * The client identifier is unique to the authorization server. * * https://tools.ietf.org/html/rfc6749#section-2.3.1 * idpClientSecret: * type: string * description: | * This value is used by Confidential Clients to authenticate to the * Token Endpoint, as described in Section 2.3.1 of OAuth 2.0, and * for the derivation of symmetric encryption key values, as * described in Section 10.2 of OpenID Connect Core 1.0 * [OpenID.Core]. * * https://tools.ietf.org/html/rfc6749#section-2.3.1 * https://openid.net/specs/openid-connect-core-1_0.html#Encryption * idpAdditionalScope: * type: string * default: openid profile email offline_access * description: | * The scopes associated with Access Tokens determine what resources * will be available when they are used to access OAuth 2.0 * protected endpoints. * For OpenID Connect, scopes can be used to request that specific * sets of information be made available as Claim Values. * The scopes openid, profile, email and offline_access are always * requested. * idpFrontChannelLogoutUrl: * type: string * format: url * idpIdTokenSignedResponseAlg: * $ref: '#/components/schemas/TIdpIdTokenSignedResponseAlg' * idpTokenEndpointAuthMethod: * $ref: '#/components/schemas/TIdpTokenEndpointAuthMethod' */ export interface IOidcIdentityProvider { _id: TMongoId; idpType: "oidc"; /** * The openId-Connect baseUrl */ idpIssuer: string; /** * The client identifier issued to the client during the registration * process. * * The authorization server issues the registered client a client identifier * -- a unique string representing the registration information provided by * the client. The client identifier is not a secret; it is exposed to the * resource owner and MUST NOT be used alone for client authentication. * * The client identifier is unique to the authorization server. * * @see https://tools.ietf.org/html/rfc6749#section-2.3.1 */ idpClientId: string; /** * This value is used by Confidential Clients to authenticate to the Token * Endpoint, as described in Section 2.3.1 of OAuth 2.0, and for the * derivation of symmetric encryption key values, as described in Section * 10.2 of OpenID Connect Core 1.0 [OpenID.Core]. * * @see https://tools.ietf.org/html/rfc6749#section-2.3.1 * @see https://openid.net/specs/openid-connect-core-1_0.html#Encryption */ idpClientSecret: string; /** * The Algorithm used to sign the ID Token issued to this Client. */ idpIdTokenSignedResponseAlg: TIdpIdTokenSignedResponseAlg; /** * Requested Client Authentication method for the Token Endpoint. * * @see https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication */ idpTokenEndpointAuthMethod: TIdpTokenEndpointAuthMethod; /** * The scopes associated with Access Tokens determine what resources will be * available when they are used to access OAuth 2.0 protected endpoints. For * OpenID Connect, scopes can be used to request that specific sets of * information be made available as Claim Values. * * The scopes openid profile email offline_access are always requested. */ idpAdditionalScope: string; /** * The url to the FrontChannel Logout */ idpFrontChannelLogoutUrl: string; /** * Reference the organisation this identity provider belongs to. */ organisationReference: TMongoId; } /** * @openapi * * components: * schemas: * IIdentityProviderData: * type: object * oneOf: * - $ref: '#/components/schemas/ISamlIdentityProviderData' * - $ref: '#/components/schemas/IOidcIdentityProviderData' */ export declare type IIdentityProvider = IOidcIdentityProvider | ISamlIdentityProvider; export interface IOrganisationScope { organisationId: TMongoId; } /** * @openapi * components: * parameters: * projectQueryParam: * in: query * name: projectId * description: The unique identifier for the Project. * required: false * schema: * $ref: '#/components/schemas/TMongoId' * schemas: * IProjectScope: * type: object * properties: * projectId: * $ref: '#/components/schemas/TMongoId' * description: The unique identifier for the Project. */ export interface IProjectScope { projectId: TMongoId; } export interface IGetAuthorizationCodeResponse { code: string; redirect_uri: string; expires_in: number; expires_at?: string; } export interface ILoginByClientCredentialsParameters { type: "clientCredentials"; /** * The scope of the token * * @see https://tools.ietf.org/html/rfc6749#section-3.3 */ scope: string; } export interface IExchangeOneTimeTokenForRefreshTokenRestDataQuery_2_0 { loginToken: string; } export interface IExchangeOneTimeTokenForRefreshTokenRestData_2_0 extends IExchangeOneTimeTokenForRefreshTokenRestDataQuery_2_0 { } /** * @openapi * * components: * schemas: * IExchangeOneTimeTokenForRefreshTokenRestReturnValue_2_0: * type: object * properties: * refreshToken: * type: string */ export interface IExchangeOneTimeTokenForRefreshTokenRestReturnValue_2_0 { refreshToken: string; } /** * @openapi * * components: * schemas: * IExchangeCXoneTokenRestReturnValue_2_0: * type: object * properties: * refreshToken: * type: string */ export interface IExchangeCXoneTokenRestReturnValue_2_0 { refreshToken: string; } export interface AuthenticationAPI { authenticationHandler?: IAuthenticationAdapter; setCredentials: (credentials: TAuthenticationCredentials) => void; login?: (data: ILoginByPasswordParameters | ILoginByRefreshTokenParameters | ILoginByAuthorizationCodeParameters | ILoginByClientCredentialsParameters) => Promise<void>; logout?: () => Promise<void>; isLoggedIn?: () => Promise<boolean>; getAccessToken: () => Promise<string>; getRefreshToken?: () => string; getRealtimeToken: TRestAPIOperation<void, IGetRealtimeTokenRestReturnValue>; w