-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
PostHideCommentRequest.ts
38 lines (35 loc) · 1.05 KB
/
PostHideCommentRequest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { AxiosResponse } from 'axios';
import { Method } from '../RequestConfig';
import { AbstractCommentRequest } from './AbstractCommentRequest';
import { CommentUpdateResponse } from './CommentUpdateResponse';
/**
* Request to toggle whether a comment is hidden.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.6.0
*/
export class PostHideCommentRequest extends AbstractCommentRequest<CommentUpdateResponse> {
/**
* The constructor.
*
* @param accessToken the access token.
* @param commentId the id of the comment.
* @param hide whether to hide or show the comment (default: true).
*/
constructor(accessToken: string, commentId: string, hide = true) {
super(accessToken, commentId);
this.params.hide = hide;
}
/**
* @inheritdoc
*/
protected parseResponse(response: AxiosResponse<never>): CommentUpdateResponse {
return new CommentUpdateResponse(response.data);
}
/**
* @inheritdoc
*/
protected method(): Method {
return 'POST';
}
}