Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 15fe97a

Browse files
author
Rayhan Arayilakath
committed
Add my REPLangs API to the Repl Class
1 parent acf2c1d commit 15fe97a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
node_modules
1+
node_modules
2+
testing.js
3+
data.json
4+
.replit

src/classes/Repl.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ class Repl {
6767
return info;
6868
}
6969
}
70+
71+
async replLangs() {
72+
let username = this.username;
73+
let slug = this.slug;
74+
75+
let info = await variables
76+
.fetch(`https://replangs.rayhanadev.repl.co/${username}/${slug}`, {
77+
method: 'GET',
78+
headers
79+
})
80+
.then(res => res.json());
81+
82+
if (info.error) {
83+
throw new Error(`REPLangs Error: ${info.error}.`);
84+
} else {
85+
return info;
86+
}
87+
}
7088
}
7189

7290
module.exports = {

0 commit comments

Comments
 (0)