TargetService

Hierarchy

  • TargetService

Methods

commentList

  • Получить список комментариев.

    Parameters

    Returns Promise<FeedMessageComment[]>

    Список комментариев.

    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

  • Создать комментарий.

    Parameters

    Returns Promise<string>

    Уникальный идентификатор комментария.

    const appItem = await Context.data.app.fetch();
    const messageId = '55467104-fe1e-4b20-9233-412a10bf4a11';
    const commentBody = 'Тело комментария';
    
    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>
  • Создать сообщение.

    Parameters

    Returns Promise<string>

    Уникальный идентификатор сообщения.

    const appItem = await Context.data.app.fetch();
    const messageTitle = 'Заголовок';
    const messageBody = 'Тело сообщения';
    
    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

  • Получить список сообщений.

    Parameters

    Returns Promise<FeedMessage[]>

    Список сообщений.

    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);