TargetService

Hierarchy

  • TargetService

Methods

commentList

  • Get comment list.

    Parameters

    Returns Promise<FeedMessageComment[]>

    Comment list.

    const appItem = await Context.data.app.fetch();
    const messageId = '55467104-fe1e-4b20-9233-412a10bf4a11'; 
    const users =  await System.users.search().size(2).all(); 
    const options: FeedListOptions =  { 
         from: 5, 
         size: 20, 
         filter: { 
             authors: users,  
         } 
    }; 
    const comments = await System.feed.target.commentList (appItem, messageId, options); 
    

createComment

  • Create comment.

    Parameters

    Returns Promise<string>

    Unique comment identifier.

    const appItem = await  Context.data.app.fetch();
    const messageId = '55467104-fe1e- 4b20-9233-412a10bf4a11'; 
    const commentBody = 'Comment body'; 
    const users =  await System.users.search().size(2).all(); 
    const blob = new Blob (['file_text_content']); 
    const buf = await blob.arrayBuffer(); 
    const file  = await System.files.createTemporary('file.txt', buf); 
    const options:  FeedPostOptions = { 
         mentions: users, 
         tempFiles: [file], 
    };  
    const commentId = await System.feed.target.createComment (appItem, messageId, commentBody, options); 
    

createMessage

  • createMessage(target: RefItem, title: string | null, body: string, options?: FeedPostOptions): Promise<string>
  • Create message.

    Parameters

    Returns Promise<string>

    Unique message identifier.

    const appItem = await  Context.data.app.fetch();
    const messageTitle = 'Title'; 
    const messageBody  = 'Message body'; 
    const users = await System.users.search().size(2).all();  
    const blob = new Blob(['file_text_content']); 
    const buf = await  blob.arrayBuffer(); 
    const file = await System.files.createTemporary ('file.txt', buf); 
    const options: FeedPostOptions = { 
         mentions:  users, 
         tempFiles: [file], 
    }; 
    const messageId = await  System.feed.target.createMessage(appItem, messageTitle, messageBody, options) ; 
    

messageList

  • Get message list.

    Parameters

    Returns Promise<FeedMessage[]>

    Message list.

    const appItem = await Context.data.app.fetch();
    const users = await System.users.search().size(2).all(); 
    const options:  FeedListOptions = { 
         from: 5, 
         size: 20, 
         filter: { 
              hasComments: true, 
             authors: users, 
         } 
    }; 
    const messages =  await System.feed.target.messageList(appItem, options);