import { C11nEnv } from '../interpreter/c11n-env'; /** * @description Use the APIs in the FeedUtils class to handle the feeds of a case. */ declare class FeedUtils { mentionsTagsCancelTokenSource: any; mentions: any; constructor(); /** * Obtains the feeds for a given context. * @function * @static * @example In this example, the API obtains the feed of a context whose feedID is pyDashboardFeed. * PCore.getFeedUtils().getFeeds('DATA-PORTAL $EngPMF', 'pyDashboardFeed','class',[{id: 'All', label: 'All', on: false, disabled: false}],[], getPConnect(), true) * .then(feedResponse => { * // feedResponse array * }).catch(err => { * // errors * }); * @example In this example, the API obtains the feed of a context whose feedID is pyCaseFeed. * PCore.getFeedUtils().getFeeds('PEGAPROJMGMT-WORK TASK-100', 'pyCaseFeed','class',[{id: 'All', label: 'All', on: false, disabled: false}],[], getPConnect(), true) * .then(feedResponse => { * // feedResponse array * }).catch(err => { * // errors * }); * * @param pulseContext The name of the application context or case context for which the feed must be fetched. * @param feedID The ID of the feed that must be fetched. * FeedID of the Pulse widget, when configured on the Home page, is known as "pyDashboardFeed" * and when used within a case view, it is known as "pyCaseFeed." * @param feedClass The class associated with the feed to be fetched. * @param feedFilters The list of conditions through which the feed to be fetched is filtered. * It is an array comprising objects, with each object containing four distinct properties. * id and label values for the filter options are available in pyDashboardFeed and pyCaseFeed rules. * Extra filter options if needed can be configured in the same rules. * @param {string} feedFilters.id The unique identifier for the feed source * @param {string} feedFilters.label The title of the feed source * @param {boolean} feedFilters.disabled This can be used to deactivate the filter (with a default value of false) * @param {boolean} feedFilters.on This provides information regarding whether the filter is currently selected.(with a default value of false i.e., not selected) * @param fetchFeedsCancelTokenSource The list of API requests for fetching the feed. * @param c11nEnv The name of the context where the API is being called. * @param isLoadMore The flag that determines if the next set of feeds should be loaded. * The default value is false. Set isLoadMore to true if you want to load the next set of feeds. * @returns A Promise that resolves to an object. */ getFeeds: (pulseContext: string, feedID: string, feedClass: string, feedFilters: [any], fetchFeedsCancelTokenSource: [any], c11nEnv: C11nEnv, isLoadMore: boolean) => Promise; /** * Posts a message to the given context. * @function * @static * @example In this example, the API adds the post along with attachment to the given context. * PCore.getFeedUtils().postMessage('DATA-PORTAL $appName','test message', [{"type":"File","category":"File","fileName":"attachment.png","ID":"459c"}], false, getPConnect()) * .then(() => { * // success * }).catch(err => { * // Error handling * }); * @example In this example, the API adds the reply to the post along with attachment to the provided context. * PCore.getFeedUtils().postMessage('PEGASOCIAL M-214007','test reply message', [{"type":"File","category":"File","fileName":"attachment.png","ID":"459c"}], true, getPConnect()) * .then(() => { * // success * }).catch(err => { * // Error handling * }); * @param pulseContext The name of the application context or case context for which the message must be posted. * @param message The message that needs to be posted. * @param attachmentIDs The metadata of the attachments that need to be posted along with the message. * @param isReply The flag that determines if you want to post a message or a reply to a message.The default value is false. Set isReply to true if you want to post a reply to a message. Set isReply to false if you want to post a message. * @param c11nEnv The name of the context where the API is being called. * @returns A Promise that resolves to an object. */ postMessage: (pulseContext: string, message: string, attachmentIDs: any[] | undefined, isReply: boolean | undefined, c11nEnv: C11nEnv) => Promise; /** * Modifies a message associated with the given context. * @function * @static * @example In this example, the API edits the post whose messageID is PEGASOCIAL M-100 * const payload = { * messageID:'PEGASOCIAL M-100', * parentMessageID:'PEGASOCIAL M-100', * message:'test message', * isReply:false, * c11nEnv: getPConnect() * } * PCore.getFeedUtils().editMessage(payload) * .then(() => { * // success * }).catch(err => { * // Error handling * }); * @example In this example, the API edits the reply to the post whose messageID is PEGASOCIAL M-101 and the parentMessageID is PEGASOCIAL M-100 * const payload = { * messageID:'PEGASOCIAL M-101', * parentMessageID:'PEGASOCIAL M-100', * message:'test reply message', * isReply:true, * c11nEnv: getPConnect() * } * PCore.getFeedUtils().editMessage(payload) * .then(() => { * // success * }).catch(err => { * // Error handling * }); * @param param The object that contains the required data to edit a message. * @param param.messageID The unique identifier(pzInsKey) of the message that needs to be edited. * @param param.parentMessageID The unique identifier(pzInsKey) of the parent message that needs to be edited. * @param param.message The new message that replaces the existing message. * @param param.c11nEnv The name of the context where the API is being called. * @param param.isReply The flag that determines if you want to post a message or a reply to a message. * The default value is false. Set isReply to true if you want to edit a reply for a message. * Set isReply to false if you want to edit a message. * @returns A Promise that resolves to an object. */ editMessage: ({ messageID, parentMessageID, message, c11nEnv, isReply }: { messageID: string; parentMessageID: string; message: string; c11nEnv: C11nEnv; isReply: boolean; }) => Promise; /** * @private * @param messageData The object that contains the newly added/edited message details. * @param isReply The flag that determines if you want to post/edit a message or a reply to a message. * @param c11nEnv The name of the context where the API is being called. * @param hasAttachment The flag that determines if you have an attachment for a message. * @returns MessageObject The messageObject */ buildMessageObject: (messageData: any, isReply: boolean, c11nEnv: C11nEnv, hasAttachment?: boolean) => any; /** * @private * @param array This param carries the list of mention objects * @returns The list of mention objects excluding the user mentions and duplicates */ getCaseMentions: (array: any[]) => any[]; /** * Like or unlike a message. * @function * @static * @example In this example, the API likes the message whose messageID is PEGASOCIAL M-100. * const payload = { * pulseContext:'PEGAPROJMGMT-WORK TASK-100', * likedBy: false, * messageID:'PEGASOCIAL M-100', * isReply: false, * c11nEnv: getPConnect() * } * PCore.getFeedUtils().likeMessage(payload) * .then(() => { * // success * }).catch(err => { * // errors * }); * @example In this example, the API dislikes the message whose messageID is PEGASOCIAL M-100. * const payload = { * pulseContext:'PEGAPROJMGMT-WORK TASK-100', * likedBy: true, * messageID:'PEGASOCIAL M-100', * isReply: false, * c11nEnv: getPConnect() * } * PCore.getFeedUtils().likeMessage(payload) * .then(() => { * // success * }).catch(err => { * // errors * }); * @example In this example, the API likes the reply whose messageID is PEGASOCIAL M-100. * const payload = { * pulseContext:'PEGAPROJMGMT-WORK TASK-100', * likedBy: false, * messageID:'PEGASOCIAL M-100', * isReply: true, * c11nEnv: getPConnect() * } * PCore.getFeedUtils().likeMessage(payload) * .then(() => { * // success * }).catch(err => { * // errors * }); * @example In this example, the API dislikes the reply whose messageID is PEGASOCIAL M-100. * const payload = { * pulseContext:'PEGAPROJMGMT-WORK TASK-100', * likedBy: true, * messageID:'PEGASOCIAL M-100', * isReply: true, * c11nEnv: getPConnect() * } * PCore.getFeedUtils().likeMessage(payload) * .then(() => { * // success * }).catch(err => { * // errors * }); * @param param The object that contains all the required data to like or unlike a specific message. * @param param.pulseContext The name of the application context or case context for which the feed must be fetched. * @param param.likedBy The value that determines whether to like or unlike the message. * @param param.messageID The ID(pzInsKey) of the message that needs to be liked or unlike. * @param param.isReply The flag that determines whether the number of likes must be obtained for a message or a reply to a message. * @param param.c11nEnv The name of the context where the API is being called. */ likeMessage: ({ pulseContext, likedBy: unLiked, messageID, isReply, c11nEnv }: { pulseContext: string; likedBy: boolean; messageID: string; isReply: boolean; c11nEnv: C11nEnv; }) => void; /** * Deletes a message from a given context. * @function * @static * @example In this example, the API removes the reply whose ID is PEGASOCIAL M-101 from a message whose ID is PEGASOCIAL M-100. * PCore.getFeedUtils().deleteMessage('PEGASOCIAL M-100', true, 'PEGASOCIAL M-101', getPConnect()) * .then(() => { * // success * }).catch(err => { * // errors * }); * @example In this example, the API removes the message whose messageID is PEGASOCIAL M-100 * PCore.getFeedUtils().deleteMessage('PEGASOCIAL M-100', false, '', getPConnect()) * .then(() => { * // success * }).catch(err => { * // errors * }); * @param messageID The ID(pzInsKey) of the message that needs to be deleted. * @param isReply The flag that determines if you want to delete a message or a reply to a message. * @param replyID The ID of the reply that needs to be deleted. * @param c11nEnv The name of the context where the API is being called. */ deleteMessage: (messageID: string, isReply: boolean, replyID: string, c11nEnv: C11nEnv) => void; /** * Obtains the list of users who liked the message. * @function * @static * @example In this example, the API obtains the list of users who liked the message with messageID PEGASOCIAL M-100 * PCore.getFeedUtils().getLikedUsers(PEGASOCIAL M-100, getPConnect()) * .then(response => { * // response array * }).catch(err => { * // errors * }); * * @param messageID The ID(pzInsKey) of the message for which that liked users must be fetched. * @param c11nEnv The name of the context where the API is being called. * @returns A Promise that resolves to an object. */ getLikedUsers: (messageID: string, c11nEnv: C11nEnv) => Promise; /** * Obtains the list of options for the selected object that can be mentioned in a Pulse post. * @function * @static * @example In this example, the API obtains the list of cases that can be mentioned in a Pulse post. * PCore.getFeedUtils().getMentionSuggestions({searchFor:"case", mentionsType = 'Cases', listSize:5}, getPConnect()) * .then(mentionsResponse => { * // mentionsResponse array * }).catch(err => { * // errors * }); * @param mentionProps The object that contains the search parameters for obtaining the list of options for the selected type of object. * @param c11nEnv The name of the context where the API is being called. * @returns A Promise that resolves to an object. */ getMentionSuggestions: (mentionProps: any, c11nEnv: C11nEnv) => Promise; /** * Obtains the list of available types of objects that can be mentioned in a Pulse post. * @function * @static * @example In this example, the API obtains the list of available types of objects that can be mentioned in a Pulse post. * PCore.getFeedUtils().getMentionTypes() * .then(response => { * // response array * }).catch(err => { * // errors * }); * @param c11nEnv The name of the context where the API is being called. * @returns A Promise that resolves to an object. */ getMentionTypes: (c11nEnv: C11nEnv) => Promise; /** * Obtains the options suggested for selecting a tag for a given context. * @function * @static * @example In this example, the API obtains the options suggested for selecting a tag for the given context. * PCore.getFeedUtils().getTagSuggestions({searchFor:"test", listSize:5}, getPConnect()) * .then(tagsResponse => { * // tagsResponse array * }).catch(err => { * // errors * }); * @param tagProps The object that contains the search parameters for obtaining the list of tags. * @param c11nEnv The name of the context where the API is being called. * @returns A Promise that resolves to an object. */ getTagSuggestions: (tagProps: any, c11nEnv: C11nEnv) => Promise; } declare const _default: FeedUtils; export default _default;