import { ComaSeparatedValues } from "./sessionstate"; import { chatIdType } from "./chatstate"; import { EnumBooleanStringified, EnumBooleanStringifiedExtended, EnumChannelFlags } from "../@types"; import { IBACKENDPAYLOAD } from "./backend"; import { ACTION } from "./command/action"; import { baseParamsType } from "./command/baseparams"; import { ICOMMAND, IKeyMaybeValue, IKeyValue, IRESPONSE, RESULT, StringBasedType } from "./command/icommand"; import { CMDC_CMSG, EnumMediaType, EnumMessageDirection, EnumMessageType } from "./message"; import { IB2BUserInfo, IB2BUserInfoVOne } from "./b2b/b2buserinfo"; import { EnumBadge } from "./channelinfo"; import { ChannelMediaLinkState } from "./media"; /** * channelId has Format "usrId.usrKey-partnerId.partnerKey" * userPoolId - business id in messenger system, number\{10,0\} * usrKey - key of your customer in your sytem, string(36 bytes), "." and "-" are not allowed * partnerId - userPoolId of your partner in messenger system, number\{10,0\} * partnerKey - key of partner customer, string(36 bytes), "." and "-" are not allowed */ /** * Type that definitely has `channelId` field */ export declare type channelIdType = { channelId: string; }; /** * Type that may or may not have `channelId` field * ONLY channel ID, not other fields! */ export interface IMayHaveChannelId { channelId?: string; } export declare type usrKeyType = { /** key of your customer. obligatory param for b2b session */ usrKey?: string; }; export declare type partnerIdKeyType = { /** id of your business partner in messenger system */ partnerId?: string; /** key of partners customer */ partnerKey?: string; }; /** mind one of both, please */ export declare type channelIdOrChatId = channelIdType | chatIdType; /** * channel */ export declare class ChannelType implements IKeyValue { [key: string]: StringBasedType; /** channel id */ channelId: string; /** your business usrId in messenger system */ usrId: string; /** the key of your customer */ usrKey: string; /** id of your business partner in messenger system */ partnerId: string; /** key of partner customer */ partnerKey: string; /** time of last incoming message */ lastTimeIn: string; /** time of last outgoing message */ lastTimeOut: string; /** creation time*/ created: string; /** number of unseen messages */ unseen: string; /** update spam serial */ serial: string; /** @see EnumChannelFlags */ flags?: ComaSeparatedValues | EnumChannelFlags; /** the weight of the channel*/ weight?: string; nextTimeOut?: string; } /** * the command for delivery channel info */ export declare class CMDC_CHANNEL implements ICOMMAND { action: ACTION; params: ChannelType; } /** * create new channel. the channel must be created before send of message */ export declare class CMDP_NEWCHANNEL implements ICOMMAND { action: ACTION; params: baseParamsType & usrKeyType & partnerIdKeyType & (IB2BUserInfo | IB2BUserInfoVOne); } /** * response for CMDP_NEWCHANNEL */ export declare class CMDP_NEWCHANNEL_RESPONSE extends CMDP_NEWCHANNEL implements IRESPONSE { result: RESULT; /** the created channel */ commands: CMDC_CHANNEL[]; /** deprecated. the created channel, values is ChannelType */ values: ChannelType; } /** * Get the ChannelInfo. this command works with channelId and will be reflected to backend. */ export declare class CMDP_GETCHANNEL implements ICOMMAND, IBACKENDPAYLOAD { action: ACTION; params: baseParamsType & channelIdType; payload?: unknown; } /** * response for CMDP_GETCHANNEL */ export declare class CMDP_GETCHANNEL_RESPONSE extends CMDP_GETCHANNEL implements IRESPONSE, IBACKENDPAYLOAD { result: RESULT; /** the channel info */ commands: CMDC_CHANNEL[]; /** unused, empty */ values: IKeyMaybeValue; /** the backend info to the channel */ payload?: unknown; } /** * 8320 only. */ export declare class CMDP_SGETCHANNEL extends CMDP_GETCHANNEL { action: ACTION; } /** * 8320 only */ export declare class CMDP_SGETCHANNEL_RESPONSE extends CMDP_SGETCHANNEL { action: ACTION; } export declare enum EnumSortOrder { ASC = "ASC", DESC = "DESC" } export declare enum EnumChannelFilterValues { ANY = "any", ONLY = "only", EXCLUDE = "exclude" } export declare enum EnumProductId { Default = "1", PARTNER = "3", MSNVIP = "5" } /** channel selector type */ export declare type channelIdSelector = { channelId?: ComaSeparatedValues | string; selectActive?: EnumBooleanStringified; selectRegularCustomer?: EnumBooleanStringified; selectAdvertised?: EnumBooleanStringified; selectPinned?: EnumBooleanStringified; selectGroupId?: ComaSeparatedValues | string; selectBadges?: ComaSeparatedValues | string; selectFollowMe?: EnumBooleanStringified; selectOnline?: EnumBooleanStringified; selectProductId?: ComaSeparatedValues | string; /** * @deprecated * use selectGroupId */ groupId?: ComaSeparatedValues | string; /** * @deprecated/ignored */ selectVip?: EnumBooleanStringified; selectYoung?: EnumBooleanStringified; selectEmptyInOut?: EnumBooleanStringified; }; export declare type channelIdFilter = { /** search for contact-name, default empty, any lenght */ filterContactName?: string; /** filter channels without incoming messages, default any */ filterEmptyIn?: EnumChannelFilterValues; /** filter channels without outgoing messages, default any */ filterEmptyOut?: EnumChannelFilterValues; /** filter channels without any messages, default any */ filterEmptyInOut?: EnumChannelFilterValues; /** filter archived channels, default any */ filterArchived?: EnumChannelFilterValues; /** 8320 only , default any */ filterAdvertised?: EnumChannelFilterValues; /** filter by favorite flag, default any */ filterRegularCustomer?: EnumChannelFilterValues; /** filter by favorite flag, default any */ filterFollowMe?: EnumChannelFilterValues; /** filter by unseen, default any */ filterUnseen?: EnumChannelFilterValues; /** filter by unanswered, default any */ filterUnAnswered?: EnumChannelFilterValues; /** filter by pinned, default any */ filterPinned?: EnumChannelFilterValues; /** filter by muted, default any */ filterMuted?: EnumChannelFilterValues; /** filter by VIP status, default any */ filterVIP?: EnumChannelFilterValues; /** was in video chat flag*/ filterVideoChat?: EnumChannelFilterValues; /** has a session */ filterOnline?: EnumChannelFilterValues; /** cant sent message*/ filterBlockedOutbound?: EnumChannelFilterValues; /** filter by product id, default empty*/ filterProductId?: ComaSeparatedValues; /** filter by banned */ filterBanned?: EnumChannelFilterValues; /** media filter */ filterCanReceiveImage?: EnumChannelFilterValues; filterCanReceiveAudio?: EnumChannelFilterValues; filterCanReceiveVideo?: EnumChannelFilterValues; filterCanSendMedia?: EnumChannelFilterValues; filterCanReceiveMedia?: EnumChannelFilterValues; /** media purchasing filter */ filterCanPurchaseMedia?: EnumChannelFilterValues; /** filter by group id, coma separated */ filterGroupId?: string; /** filter by badges */ filterBadges?: ComaSeparatedValues | string; /** filterActive */ filterActive?: EnumChannelFilterValues; /** filter channels to exclude */ filterExcludeChannelId?: ComaSeparatedValues | string; /** filter by weight */ filterMinWeight?: string; filterMaxWeight?: string; filterShadowban?: EnumChannelFilterValues; filterYoung?: EnumChannelFilterValues; /** service channels*/ filterService?: EnumChannelFilterValues; }; export declare type channelIdSelectOrFilter = channelIdSelector & channelIdFilter; export declare type getChannelsParamsType = { /** from serial, default = 0 */ serial?: string; /** query offset */ skip?: string; /** limit, default is 1000 */ limit?: string; /** * @deprecated/obsolete, ignored */ sort?: EnumSortOrder; /** get CMDC_CONTACTNOTE in commands, default 0, deprecated */ contactNote?: EnumBooleanStringifiedExtended; /** get CMDC_CONTACTINFO in commands, default 0, allowed for b2b session only */ contactInfo?: EnumBooleanStringifiedExtended; /** get CMDC_CHANNELINFO in commands, default 0 */ channelInfo?: EnumBooleanStringifiedExtended; /** get CMDC_ONLINESTATE in commands */ onlineState?: EnumBooleanStringifiedExtended; /** get CMDC_CHANNELGROUP in commands */ groupInfo?: EnumBooleanStringifiedExtended; }; /** * Query for ChannelList */ export declare class CMDP_GETCHANNELS implements ICOMMAND { action: ACTION; params: baseParamsType & getChannelsParamsType & channelIdSelectOrFilter & { countOnly?: EnumBooleanStringified; }; } /** * Response for CMDP_GETCHANNELS */ export declare class CMDP_GETCHANNELS_RESPONSE extends CMDP_GETCHANNELS implements IRESPONSE { result: RESULT; /** channels & channel infos, if countOnly omited or "false" */ commands: ICOMMAND[]; values: IKeyMaybeValue & { channelCount?: string; channelTotal?: string; }; } /** synonym, 8320 only */ export declare class CMDP_SGETCHANNELS extends CMDP_GETCHANNELS { action: ACTION; } /** synonym, 8320 only */ export declare class CMDP_SGETCHANNELS_RESPONSE extends CMDP_GETCHANNELS_RESPONSE { action: ACTION; } /** searchAfter must be used together */ export declare type IMayHaveSearchAfter = { /** filter for datetime, value like CMDC_CMSG.param.timeSent (unix time stamp in ms)*/ searchAfterTime?: string; searchAfterId?: string; }; export declare type getHistoryParamsType = IMayHaveChannelId & IMayHaveSearchAfter & { /** filter for msgType. coma separated */ filterMessageType?: EnumMessageType | string; filterSysMessageKey?: ComaSeparatedValues; /** filter for isDeleted*/ filterDeleted?: EnumChannelFilterValues; filterMediaType?: ComaSeparatedValues; filterLinkState?: ComaSeparatedValues; filterDirection?: EnumMessageDirection; /** number of messages, max & default is 100 */ limit?: string; /** sort by sent, default is DESC */ sort?: EnumSortOrder; /** deprecated */ keys?: EnumBooleanStringifiedExtended; }; /** * Get messages history for channel * Multichannel command */ export declare class CMDP_GETHISTORY implements ICOMMAND { action: ACTION; params: baseParamsType & getHistoryParamsType & { getUnseenButDeleted?: EnumBooleanStringified; }; } /** * Response for CMDP_GETHISTORY */ export declare class CMDP_GETHISTORY_RESPONSE extends CMDP_GETHISTORY implements IRESPONSE { result: RESULT; /** found messages */ commands: CMDC_CMSG[]; /** unused */ values: IKeyMaybeValue; } export declare enum EnumLimitType { TOTAL = "total", separately = "separately" } /** * Get messages history for channel * Multichannel command */ export declare class CMDP_SGETMESSAGEHISTORY implements ICOMMAND { action: ACTION; params: baseParamsType & getHistoryParamsType & { /** chat id list, coma separated */ chatIDs?: string; /** limit type, default total */ limitType?: EnumLimitType; fetchReactionsFirst?: EnumBooleanStringified; }; } /** * Response for CMDP_GETHISTORY */ export declare class CMDP_SGETMESSAGEHISTORY_RESPONSE extends CMDP_SGETMESSAGEHISTORY implements IRESPONSE { result: RESULT; /** found messages */ commands: CMDC_CMSG[]; /** unused */ values: IKeyMaybeValue; } export declare type channelSeenParamsType = channelIdType & { /** last seen messageId, by default all messages marked as seen */ messageId?: string; }; export declare class CMDP_SGETCHANNELMESSAGE implements ICOMMAND { action: ACTION; params: baseParamsType & { channelId: string; messageId: string; }; } export declare class CMDP_SGETCHANNELMESSAGE_RESPONSE extends CMDP_SGETCHANNELMESSAGE implements IRESPONSE { result: RESULT; /** found message */ commands: CMDC_CMSG[]; /** unused */ values: IKeyMaybeValue; } /** * Mark messages as seen */ export declare class CMDP_CHANNELSEEN implements ICOMMAND { action: ACTION; params: baseParamsType & channelSeenParamsType; } /** alias, 8320 only */ export declare class CMDP_SCHANNELSEEN extends CMDP_CHANNELSEEN { action: ACTION; } /** alias, 8320 only */ export declare class CMDP_CHANNELSEEN_RESPONSE extends CMDP_SCHANNELSEEN implements IRESPONSE { result: RESULT; /** unused */ commands: ICOMMAND[]; /** unused */ values: IKeyMaybeValue; } /** alias, 8320 only */ export declare class CMDP_SCHANNELSEEN_RESPONSE extends CMDP_CHANNELSEEN_RESPONSE { action: ACTION; } export declare enum EnumUpdateChannelPropertyName { ARCHIVED = "archived", REGULAR_CUSTOMER = "regularCustomer", UNANSWERED = "unanswered", PINNED = "pinned", MUTED = "muted", BANNED = "banned", BLOCKED_INBOUND = "blockedInbound", BLOCKED_OUTBOUND = "blockedOutbound" } export declare class updateChannelParamsType { /** flag name */ propertyName: EnumUpdateChannelPropertyName; /** flag value */ propertyValue: EnumBooleanStringified; } /** * Set Flag on Channel * @deprecated use CMDP_SETCHANNELINFO */ export declare class CMDP_UPDATECHANNEL implements ICOMMAND, IBACKENDPAYLOAD { action: ACTION; params: baseParamsType & updateChannelParamsType & IKeyMaybeValue; payload?: unknown; } /** * Response for CMDP_UPDATECHANNEL */ export declare class CMDP_UPDATECHANNEL_RESPONSE extends CMDP_UPDATECHANNEL implements IRESPONSE, IBACKENDPAYLOAD { result: RESULT; /** unused */ commands: ICOMMAND[]; /** unused */ values: IKeyMaybeValue; payload?: unknown; } /** * channel summary info */ export declare type channelSummaryInfo = { [key: string]: string; /** product*/ productId?: ComaSeparatedValues; /** your business id */ usrId: string; /** usrKey of your user */ usrKey: string; /** number of channel */ channels: string; /** number of unseen messages */ unseen: string; /** number of unused CHANNELS*/ unusedIn: string; unusedOut: string; unusedInOut: string; /** number of unseen messages */ unseenWithoutArchived: string; /** number of unseen channels */ unseenChannels: string; /** number of unseen channels without archived*/ unseenChannelsWithoutArchived: string; /** number of unanswered channels */ unanswered: string; /** number of unanswered channels */ unansweredWithoutArchived: string; /** last time of incoming message */ lastTimeIn: string; /** last time of outgoing message */ lastTimeOut: string; /** number of archived channels */ archived: string; /** number of advertised channels */ advertised: string; /** number of regular channels */ regular: string; /** number of pinned channels */ pinned: string; /** number of muted channels */ muted: string; /** number of banned channels */ banned: string; /** number of vip channels */ vip: string; /** number of online channels */ online: string; /** number of active channels */ active: string; /** number of young channels */ young: string; /** number of follower */ followMe: string; /** primary */ product1: string; /** partner */ product3: string; /** vip */ product5: string; }; /** * channel summary */ export declare class CMDC_CHANNELSUMMARY implements ICOMMAND { action: ACTION; params: channelSummaryInfo; } /** * Query the summary info about all channels */ export declare class CMDP_CHANNELSSUMMARY implements ICOMMAND { action: ACTION; params: baseParamsType & usrKeyType; } /** * Response for CMDP_CHANNELSSUMMARY */ export declare class CMDP_CHANNELSSUMMARY_RESPONSE extends CMDP_CHANNELSSUMMARY implements IRESPONSE { result: RESULT; /** unused */ commands: ICOMMAND[]; /** the summary info */ values: channelSummaryInfo; } /** * channel summary */ export declare class CMDC_PRODUCTCHANNELSSUMMARY implements ICOMMAND { action: ACTION; params: channelSummaryInfo; } /** * Query the summary info about all channels */ export declare class CMDP_PRODUCTCHANNELSSUMMARY implements ICOMMAND { action: ACTION; params: baseParamsType & usrKeyType & { productId: string; }; } /** * Response for CMDP_CHANNELSSUMMARY */ export declare class CMDP_PRODUCTCHANNELSSUMMARY_RESPONSE extends CMDP_PRODUCTCHANNELSSUMMARY implements IRESPONSE { result: RESULT; /** unused */ commands: CMDC_PRODUCTCHANNELSSUMMARY[]; /** the summary info */ values: IKeyMaybeValue; }