-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecent.js
52 lines (48 loc) · 1.4 KB
/
recent.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
const { get } = require("../modules/leetcode");
module.exports = {
/**
* Function to get user recent submissions
* @param {String} username Username that we want to search up
* @returns Recent submissions object
*/
async getRecentSubmissions(username) {
const options = {
query : `query getRecentSubmissionList($username: String!, $limit: Int) {
recentSubmissionList(username: $username, limit: $limit) {
title
titleSlug
timestamp
statusDisplay
lang
}
}`,
variables : {username}
}
try {
return await get(options);
} catch(err) {
throw err;
}
},
async getRecentTopics(username) {
const options = {
query: `query getRecentPosts($username: String! $limit: Int) {
userRecentTopics(username: $username, limit: $limit) {
id
title
commentCount
post {
creationDate
voteCount
}
}
}`,
variables: {username}
}
try {
return await get(options);
} catch(err) {
throw err;
}
}
}