itd-api / CommentsResource
Interface: CommentsResource
Defined in: resources/comments.ts:46
Комментарии и ответы на них.
Доступна как 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:80
Перебирает ответы на комментарий.
Parameters
commentId
string
params?
RepliesParams = {}
options?
PaginationOptions = {}
Returns
like()
like(commentId, options?): Promise<LikeResult>;Defined in: resources/comments.ts:150
Ставит реакцию на комментарий.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<LikeResult>
remove()
remove(commentId, options?): Promise<void>;Defined in: resources/comments.ts:134
Удаляет комментарий. Восстановить его можно через restore.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<void>
replies()
replies(
commentId,
params?,
options?
): Promise<Page<Comment>>;Defined in: resources/comments.ts:71
Загружает страницу ответов на комментарий.
Здесь пагинация постраничная, в отличие от комментариев к посту, где курсорная.
Parameters
commentId
string
params?
RepliesParams = {}
options?
RequestOptions = {}
Returns
reply()
reply(
commentId,
input,
options?
): Promise<Comment>;Defined in: resources/comments.ts:97
Отвечает на комментарий.
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:142
Восстанавливает удалённый комментарий.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<void>
unlike()
unlike(commentId, options?): Promise<LikeResult>;Defined in: resources/comments.ts:158
Убирает реакцию с комментария.
Parameters
commentId
string
options?
RequestOptions = {}
Returns
Promise<LikeResult>
update()
update(
commentId,
content,
options?
): Promise<CommentUpdateResult>;Defined in: resources/comments.ts:121
Редактирует текст комментария.
Parameters
commentId
string
content
string
options?
RequestOptions = {}
Returns
Promise<CommentUpdateResult>