/** * @module Channels */ import { Channel, ChannelRB } from '../models/channel.model'; import { Subscription } from "rxjs"; import { User } from '../models/user.model'; import { RBEvent } from '../models/event.model'; /** * @internal * maximum number of images that can inserted in a post. */ export declare const CHANNEL_POST_MAX_IMAGES = 10; /** * @internal * maximum number of files that can attached to a post. */ export declare const CHANNEL_POST_MAX_ATTACHMENTS = 10; /** * @eventProperty * Channel post instance specific events. * Can listen to it via `ChannelPost.subscribe()` API */ export declare enum ChannelPostEvents { /** * @eventProperty * This `RBEvent` is sent when the connected user updates its reaction to a channel post . */ ON_CONNECTED_USER_REACTION_UPDATED = "ON_CONNECTED_USER_REACTION_UPDATED", /** * @eventProperty * This `RBEvent` event is sent when the post already published in the channel has been modified. */ ON_POST_UPDATED = "ON_POST_UPDATED" } /** * Possible format for a post channel */ export declare enum ChannelPostMessageFormat { /** Simple text message */ BASIC = "urn:xmpp:channels:basic", /** Message in HTML format*/ HTML = "urn:xmpp:channels:html", /** Message in MARKDOWN format*/ MARKDOWN = "urn:xmpp:channels:markdown" } /** * Possible reactions from users on a post channel */ export declare enum ChannelPostReaction { /** No reaction */ NONE = "none", /** The traditional Like */ LIKE = "like", /** Fan and happy about the publication */ LOVE = "happy", /** Applause used for example as congratulations */ APPLAUSE = "applause", /** Fantastic, amazing... */ FANTASTIC = "fantastic", /** Intrigued by the publication */ CURIOUS = "doubt" } /** * Represents the reaction data for a post. * Each property corresponds to a specific reaction type, and its value indicates the number of times that reaction has been expressed. */ type ReactionData = Record; /** * Represents a reaction to a post made by a user. */ export interface ChannelPostUserReactions { /** * The reaction to a post. * @readonly */ reaction: ChannelPostReaction; /** * The user who posted this reaction * @readonly */ user: User; } /** * @internal */ export declare class ChannelPostComment { static create(id: string, from: User, message: string): ChannelPostComment; private constructor(); id: string; message: string; from?: User; } export interface ChannelPostFileDocument { /** * The unique identifier associated to a channel image or attachment document. */ id: string; } export interface ChannelPostVideoDocument { /** * The unique identifier(ID) associated to a channel video document. * This ID is a unique string of characters found in the video's URL used to uniquely identify each video on the platform. * This ID allows you to find the video in the YouTube database and access it directly to watch it. */ id: string; /** * Video provider (e.g. “YouTube” for a Web provider). */ provider: string; } /** * Interface dedicated to publishing a new post or modifying an existing post. * In the case of a new post, this information does not need to be provided. * However, if an existing post is being modified, its id must be specified. * Only information that can be included in a post for publication is displayed in this interface. * Additional information such as that associated with the publisher, reactions... are only available * via the 'ChannelPost' interface once the post has been added/modified. * */ export interface ChannelPostPublication { /** * The channel post unique identifier. */ id?: string; /** * The title of the post. */ title?: string; /** * The format of the message. */ format?: ChannelPostMessageFormat; /** * The text message included in the post. */ message?: string; /** * List of images inserted in the post. */ images?: ChannelPostFileDocument[]; /** * List of documents (of any kind) attached in the post. */ attachments?: ChannelPostFileDocument[]; /** * Video attached in the post. */ video?: ChannelPostVideoDocument; } export interface ChannelPost { /** * The channel post unique identifier. * @readonly */ id: string; /** * Date when the post was published or modified. * @readonly */ timestamp: number; /** * Indicates whether it is a new post in the channel. * This status can be managed by an SDK client to indicate, for example, that the post has been seen or read by a user. * @readonly */ isNew: boolean; /** * Indicates whether the post has been modified after publication. * @readonly */ isModified: boolean; /** * The title of the post. */ title: string; /** * The format of the message. */ format: ChannelPostMessageFormat; /** * The text message included in the post. */ message: string; /** * List of images inserted in the post. */ images: ChannelPostFileDocument[]; /** * Maximum number of images that can be inserted into the post */ readonly maxImages: number; /** * List of documents (of any kind) attached in the post. */ attachments: ChannelPostFileDocument[]; /** * Maximum number of documents that can be attached in the post */ readonly maxAttachments: number; /** * Video attached in the post. */ video: ChannelPostVideoDocument; /** * The reaction of the connected user on the post. * Reactions allow the user to express a more precise feeling/emotion about what he think of the post! */ reaction: ChannelPostReaction; /** * Represents all the reaction(s) on the post. * For each reaction type, the number of times that reaction has been expressed is provided * but NOT the information about which user. * @readonly */ reactionCounters: ReactionData; /** * The channel in which the post was published. * @readonly */ channel: Channel; /** * The publisher of the post. * @readonly */ publisher: User; /** * Allows ChannelPostEvents events to be sent. * Such events can be listened via channelMessage.subscribe() API * @param name - the name of the event * @param data - optionally, data associated with the event to be sent (as an object) */ sendEvent(name: ChannelPostEvents, data?: any): void; /** * Subscribe to channel post updates, all events are of RBEvent * @param callback - The callback function that will be called when events are received * @param eventNames - (optional) A list of event names that the user wants to receive when subscribing (used as filter) */ subscribe(callback: (event: RBEvent) => any, eventNames?: ChannelPostEvents[]): Subscription; /** * Update the reaction of the connected user to the current channel post. * This includes adding, updating and removing a reaction. * @param reactionType - The user whose role will be changed. */ reactToPost(reactionType: ChannelPostReaction): Promise; /** * Get all user reactions or a specific reaction to the current message on the channel. * @param reaction - Optional filter by reaction type. If no filter is specified, all reactions will be returned. */ getPostUserReactions(reaction?: ChannelPostReaction): Promise; /** * Delete the channel post. * This operation is only authorized the owner of the publication, i.e. the author. */ delete(): Promise; /** * Method to return a simplified JSON representation of a Channel post object */ toJSON(): any; } /** * @internal */ export declare class ChannelMessage implements ChannelPost { private logger; private errorHelperService; private channelService?; private contactService?; readonly maxImages: number; readonly maxAttachments: number; id: string; format: ChannelPostMessageFormat; title: string; message: string; timestamp: number; images: any[]; attachments: any[]; video: any; isModified: boolean; isNew: boolean; reaction: ChannelPostReaction; reactionCounters: ReactionData; publisherId: string; publisher: User; channel: ChannelRB; type: string; timestampDisplay: any; tags: string[]; comments: ChannelPostComment[]; private rxSubject; constructor(); sendEvent(name: ChannelPostEvents, data?: any): void; subscribe(callback: (event: RBEvent) => any, eventNames?: ChannelPostEvents | ChannelPostEvents[]): Subscription; static createFromData(channel: ChannelRB, data: any): Promise; static updateFromData(channel: ChannelRB, currentPost: any, updatedPost: any): ChannelMessage; delete(): Promise; reactToPost(reactionType: ChannelPostReaction): Promise; getPostUserReactions(reactionType?: ChannelPostReaction): Promise; toJSON(): any; } export {}; //# sourceMappingURL=channelMessage.model.d.ts.map