itd-api / CommentsResource
Interface: CommentsResource
Defined in: resources/comments.ts:39
Комментарии и ответы на них.
Доступна как itd.comments. Комментарии к посту живут в itd.posts: itd.posts.comments() и itd.posts.comment().
Extends
BaseResource
Methods
iterateReplies()
iterateReplies(
commentId,
params?,
options?): Paginator<Comment>;Defined in: resources/comments.ts:73
Перебирает ответы на комментарий.
Parameters
commentId
string
params?
RepliesParams = {}
options?
PaginationOptions = {}
Returns
like()
like(commentId, options?): Promise<LikeResult>;Defined in: resources/comments.ts:143
Ставит реакцию на комментарий.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<LikeResult>
remove()
remove(commentId, options?): Promise<void>;Defined in: resources/comments.ts:127
Удаляет комментарий. Восстановить его можно через restore.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<void>
replies()
replies(
commentId,
params?,
options?): Promise<Page<Comment>>;Defined in: resources/comments.ts:64
Загружает страницу ответов на комментарий.
Здесь пагинация постраничная, в отличие от комментариев к посту, где курсорная.
Parameters
commentId
string
params?
RepliesParams = {}
options?
RequestOptions = {}
Returns
reply()
reply(
commentId,
input,
options?): Promise<Comment>;Defined in: resources/comments.ts:90
Отвечает на комментарий.
Parameters
commentId
string
input
string | CommentInput
options?
RequestOptions = {}
Returns
Promise<Comment>
Example
await itd.comments.reply(commentId, 'согласен');
await itd.comments.reply(commentId, (c) => c.content('и вот почему').replyTo(userId));restore()
restore(commentId, options?): Promise<void>;Defined in: resources/comments.ts:135
Восстанавливает удалённый комментарий.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<void>
unlike()
unlike(commentId, options?): Promise<LikeResult>;Defined in: resources/comments.ts:151
Убирает реакцию с комментария.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<LikeResult>
update()
update(
commentId,
content,
options?): Promise<CommentUpdateResult>;Defined in: resources/comments.ts:114
Редактирует текст комментария.
Parameters
commentId
string
content
string
options?
RequestOptions = {}
Returns
Promise<CommentUpdateResult>