-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
Copy pathairmeet.app.mjs
66 lines (64 loc) · 1.4 KB
/
airmeet.app.mjs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { axios } from "@pipedream/platform";
export default {
type: "app",
app: "airmeet",
propDefinitions: {
airmeetId: {
type: "string",
label: "Airmeet ID",
description: "The Airmeet ID",
async options() {
const { data: airmeets } = await this.getAirmeets();
return airmeets.map((airmeet) => ({
value: airmeet.uid,
label: airmeet.name,
}));
},
},
},
methods: {
_oauthAccessToken() {
return this.$auth.oauth_access_token;
},
_region() {
return this.$auth.region;
},
_apiUrl() {
return `https://${this._region()}.airmeet.com/prod`;
},
async _makeRequest({
$ = this, path, ...args
}) {
return axios($, {
url: `${this._apiUrl()}${path}`,
...args,
headers: {
...args.headers,
"X-Airmeet-Access-Token": this._oauthAccessToken(),
},
});
},
createAirmeet(args = {}) {
return this._makeRequest({
path: "/airmeet",
method: "post",
...args,
});
},
addAuthorizedAttendee({
airmeetId, ...args
}) {
return this._makeRequest({
path: `/airmeet/${airmeetId}/attendee`,
method: "post",
...args,
});
},
getAirmeets(args = {}) {
return this._makeRequest({
path: "/airmeets",
...args,
});
},
},
};