-
Notifications
You must be signed in to change notification settings - Fork 2
/
Comments.ts
39 lines (34 loc) · 1.81 KB
/
Comments.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
39
import api from "../api/api"
import {DeviantArtCommentContext, DeviantArtCommentSearch} from "../types/index"
export class Comments {
private readonly api = new api(this.accessToken)
constructor(private readonly accessToken: string) {}
/**
* Fetches all of the replies to a certain comment, requires the comment id.
*/
public siblings = async (params: {commentid: string, ext_item?: boolean, offset?: number, limit?: number, mature_content?: boolean}) => {
const result = await this.api.get(`api/v1/oauth2/comments/${params.commentid}/siblings`, {params})
return result as Promise<DeviantArtCommentContext>
}
/**
* Fetches all comments on a certain deviation.
*/
public deviation = async (params: {deviationid: string, commentid?: string, maxdepth?: number, offset?: number, limit?: number, mature_content?: boolean}) => {
const result = await this.api.get(`api/v1/oauth2/comments/deviation/${params.deviationid}`, {params})
return result as Promise<DeviantArtCommentSearch>
}
/**
* Fetches all the comments on a user profile.
*/
public profile = async (params: {username: string, commentid?: string, maxdepth?: number, offset?: number, limit?: number, mature_content?: boolean}) => {
const result = await this.api.get(`api/v1/oauth2/comments/profile/${params.username}`, {params})
return result as Promise<DeviantArtCommentSearch>
}
/**
* Fetches all the comments on a user status.
*/
public status = async (params: {statusid: string, commentid?: string, maxdepth?: number, offset?: number, limit?: number, mature_content?: boolean}) => {
const result = await this.api.get(`api/v1/oauth2/comments/status/${params.statusid}`, {params})
return result as Promise<DeviantArtCommentSearch>
}
}