import { channelIdSelectOrFilter, channelIdType, IMayHaveChannelId } from "./channel"; import { EnumBooleanStringified, EnumCurrency } from "../@types"; import { SystemMessageKey } from "./systemmessagekey"; import { IBACKENDPAYLOAD } from "./backend"; import { ACTION } from "./command/action"; import { baseParamsType } from "./command/baseparams"; import { ICOMMAND, IKeyMaybeValue, IRESPONSE, RESULT } from "./command/icommand"; import { ChannelMediaLinkState, MayHaveChannelId } from "./media"; import { clientID } from "./clivechat"; import { chatIdType } from "./chatstate"; export declare enum MessageFlags { "canDeleted" = 0, "isDeleted" = 1 } export declare enum EnumMessageFlagValue { NO = "0", YES = "1" } export declare enum EnumMessageType { MAIL = "mail", CHAT = "chat", MESSENGER = "msn", SYSTEM = "sys" } export declare enum EnumMessageDirection { IN = "in", OUT = "out" } export declare enum EnumMediaType { BITMAP = "Bitmap", AUDIO = "Audio", VIDEO = "Video", /** * @deprecated/obsolete */ TICKET_SHOW = "TicketShow" } export declare enum EnumMediaState { UPLOAD = "uploaded", OK = "ok", TRANSCODING = "transcode", ERROR = "error", TRANSCODING_ERROR = "transcodeError" } export declare enum EnumTicketType { TicketShow = "ticketShow" } export declare enum EnumMessageStyle { GUEST = "g" /** depretacted */, SYSTEM = "s" /** depretacted */, INFO = "info", WARN = "warn", ERROR = "error", INFO_HIGHLIGHT = "InfoHighlight" } export declare type Currency = { currency?: EnumCurrency; }; export declare type Chargeable = { isChargeable?: EnumBooleanStringified; }; /** message params */ export declare type MessageParams = IMayHaveChannelId & { messageId?: string; /** your uniq key for message */ messageKey?: SystemMessageKey | string; /** chat id */ chatID?: string; /** text-message */ text?: string; /** tip, euro cent */ tip?: string; /** gift ids, coma separated */ gift?: string; /** currency, todo: */ currency?: EnumCurrency; link?: string; clientData?: string; isBulk?: EnumBooleanStringified; /** reaction */ reaction?: string; reactionTime?: string; /** template*/ templateId?: string; caption?: string; }; export declare type MediaMd5 = { mediaMd5?: string; }; export declare type MediaInfo = MediaMd5 & { /** the media attached */ mediaType?: EnumMediaType | string; /** state of media attached */ mediaState?: EnumMediaState | string; /** datetime of media*/ mediaCreated?: string; linkState?: ChannelMediaLinkState; linkDate?: string; umaId?: string; isCustomContent?: EnumBooleanStringified; }; export declare type MediaPrice = Currency & { mediaPrice?: string; }; export declare type MediaOffer = Chargeable & MediaPrice; export declare type ImageFile = MediaInfo & { /** Bitmap media*/ imgSrc?: string; imgSrcSet?: string; imgHeight?: string; imgWidth?: string; imgSrcBlurred?: string; imgSrcSetBlurred?: string; }; export declare type AudioFile = MediaInfo & { /** Audio media*/ audioMp3?: string; audioM4a?: string; audioOgg?: string; audioDuration?: string; }; export declare type VideoFile = MediaInfo & { /**Video media */ videoPoster?: string; videoPosterBlurred?: string; videoFileUrl?: string; videoHls?: string; videoHeight?: string; videoWidth?: string; videoDuration?: string; }; export declare type MediaFile = ImageFile | AudioFile | VideoFile; /** id of the message */ export declare type MessageId = { messageId: string; }; export declare type RelationId = { /** messageId of related message */ relationId?: string; relationText?: string; relationMediaType?: string; }; /** more message params, readonly (set by server, ignored if set by client) */ export declare type MessageReadOnlyParams = { /** the uniq message id */ messageId?: string; /** source of the message IN CMDP_MSG, writable for B2B session */ msgType?: EnumMessageType; /** sent time */ time?: string; /** timeSeen */ timeSeen?: string; /** direction */ direction?: EnumMessageDirection; /** sound name */ sound?: string; /** Will be present for paid message **/ priceCode?: string; /** the message was bought by the opponent*/ isPaid?: EnumBooleanStringified.TRUE; /** * coma separated MessageFlags, const flags = cmd.params.flags ? cmd.params.flags.split(',').map((flag: string) =\> flag.trim()) : []; * ignored IN CMDP_MSG */ isLocked?: EnumBooleanStringified.TRUE; flags?: string | ""; previewRun?: "1" | "0" | string; canDelete?: EnumBooleanStringified.TRUE; isDeleted?: EnumBooleanStringified.TRUE; /** message style/importance */ style?: EnumMessageStyle; } & RelationId & MediaFile & MediaOffer; /** * Command for transport of MessageType */ export declare class CMDC_CMSG implements ICOMMAND { action: ACTION; params: MessageParams & MessageReadOnlyParams & MediaFile & MediaOffer & MayHaveChannelId & IKeyMaybeValue; } /** * send message */ export declare class CMDP_MSG implements ICOMMAND, IBACKENDPAYLOAD { action: ACTION; params: baseParamsType & MessageParams & channelIdSelectOrFilter; /** if jwt-session, any json-payload for transport to backend */ payload?: unknown; } /** * Response command for CMDP_MSG */ export declare class CMDP_MSG_RESPONSE extends CMDP_MSG implements IRESPONSE { result: RESULT; /** unused */ commands: ICOMMAND[]; /** unused */ values: IKeyMaybeValue; /** if jwt-session, any json-payload for transport to client */ payload?: unknown; } /** * send chat message */ export declare class CMDP_CMSG implements ICOMMAND { action: ACTION; params: baseParamsType & MessageParams & clientID & chatIdType; /** if jwt-session, any json-payload for transport to backend */ payload?: unknown; } /** * Response command for CMDP_CMSG */ export declare class CMDP_CMSG_RESPONSE extends CMDP_CMSG implements IRESPONSE { result: RESULT; /** unused */ commands: ICOMMAND[]; /** unused */ values: IKeyMaybeValue; /** if jwt-session, any json-payload for transport to client */ payload?: unknown; } /** * delete of message * your message will be deleted on your and partner side, partner message will be deleted only on your side */ export declare class CMDP_MSGDELETE implements ICOMMAND { action: ACTION; params: baseParamsType & channelIdType & Partial; } /** * Response for CMDP_MSGDELETE */ export declare class CMDP_MSGDELETE_RESPONSE extends CMDP_MSGDELETE implements IRESPONSE { result: RESULT; /** unused */ commands: ICOMMAND[]; /** unused */ values: IKeyMaybeValue; } /** * reaction to message. s. IReaction and CMDP_SINIT.values.reactions * CMDC_CMSG will be sent by backend to update the message */ export declare class CMDP_SMSGREACTION implements ICOMMAND { action: ACTION; params: baseParamsType & channelIdType & MessageId & { text?: string; /** if the text is empty or not set, the code musst be set to one of CMDP_SINIT.values.reactions */ code?: string; /** reset reaction, if true then text & code are ignored */ reset?: EnumBooleanStringified; }; } /** * Response for CMDP_MSGDELETE */ export declare class CMDP_SMSGREACTION_RESPONSE extends CMDP_SMSGREACTION implements IRESPONSE { result: RESULT; /** unused */ commands: ICOMMAND[]; /** unused */ values: IKeyMaybeValue; } /** * Estimate sending message. get count of possible recipients */ export declare class CMDP_SMSGESTIMATE implements ICOMMAND { action: ACTION; params: baseParamsType & channelIdSelectOrFilter & { withMedia?: EnumBooleanStringified; mediaMd5?: string; countOnly?: EnumBooleanStringified; }; } /** * Response for CMDP_SMSGESTIMATE */ export declare class CMDP_SMSGESTIMATE_RESPONSE extends CMDP_SMSGESTIMATE implements IRESPONSE { result: RESULT; commands: ICOMMAND[]; values: { channelCount: string; canReceiveCount: string; canReceiveChannels: string; canPurchaseCount: string; canPurchaseChannels?: string; hasPurchasedCount: string; hasPurchasedChannels?: string; }; }