Skip to content

Commit 75ff9a8

Browse files
committed
[Components] goto_meeting #15169
Sources - New Meeting Actions - Create Meeting
1 parent f456e6e commit 75ff9a8

File tree

6 files changed

+117
-305
lines changed

6 files changed

+117
-305
lines changed
Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,67 @@
1-
import goto_meeting from "../../goto_meeting.app.mjs";
2-
import { axios } from "@pipedream/platform";
1+
import { MEETING_TYPE_OPTIONS } from "../../common/constants.mjs";
2+
import { parseObject } from "../../common/utils.mjs";
3+
import app from "../../goto_meeting.app.mjs";
34

45
export default {
56
key: "goto_meeting-create-meeting",
67
name: "Create Meeting",
7-
description: "Creates a scheduled meeting in GoTo Meeting. [See the documentation](), ",
8-
version: "0.0.{{ts}}",
8+
description: "Creates a scheduled meeting in GoTo Meeting. [See the documentation](https://developer.goto.com/GoToMeetingV1#tag/Meetings/operation/createMeeting)",
9+
version: "0.0.1",
910
type: "action",
1011
props: {
11-
goto_meeting: {
12-
type: "app",
13-
app: "goto_meeting",
14-
},
12+
app,
1513
subject: {
16-
propDefinition: [
17-
goto_meeting,
18-
"subject",
19-
],
14+
type: "string",
15+
label: "Subject",
16+
description: "The subject of the meeting",
2017
},
2118
startTime: {
22-
propDefinition: [
23-
goto_meeting,
24-
"startTime",
25-
],
19+
type: "string",
20+
label: "Start Time",
21+
description: "The start time of the meeting in ISO 8601 format",
2622
},
2723
endTime: {
28-
propDefinition: [
29-
goto_meeting,
30-
"endTime",
31-
],
24+
type: "string",
25+
label: "End Time",
26+
description: "The end time of the meeting in ISO 8601 format",
3227
},
3328
passwordRequired: {
34-
propDefinition: [
35-
goto_meeting,
36-
"passwordRequired",
37-
],
29+
type: "boolean",
30+
label: "Password Required",
31+
description: "Whether a password is required to join the meeting",
3832
},
3933
conferenceCallInfo: {
40-
propDefinition: [
41-
goto_meeting,
42-
"conferenceCallInfo",
43-
],
34+
type: "string",
35+
label: "Conference Call Info",
36+
description: "Information for the conference call",
4437
},
4538
meetingType: {
46-
propDefinition: [
47-
goto_meeting,
48-
"meetingType",
49-
],
50-
},
51-
timezoneKey: {
52-
propDefinition: [
53-
goto_meeting,
54-
"timezoneKey",
55-
],
56-
optional: true,
39+
type: "string",
40+
label: "Meeting Type",
41+
description: "The type of the meeting",
42+
options: MEETING_TYPE_OPTIONS,
5743
},
5844
coorganizerKeys: {
59-
propDefinition: [
60-
goto_meeting,
61-
"coorganizerKeys",
62-
],
45+
type: "string[]",
46+
label: "Co-Organizer Keys",
47+
description: "Keys of the co-organizers for the meeting",
6348
optional: true,
6449
},
6550
},
6651
async run({ $ }) {
67-
const meeting = await this.goto_meeting.createScheduledMeeting({
68-
subject: this.subject,
69-
startTime: this.startTime,
70-
endTime: this.endTime,
71-
passwordRequired: this.passwordRequired,
72-
conferenceCallInfo: this.conferenceCallInfo,
73-
meetingType: this.meetingType,
74-
timezoneKey: this.timezoneKey,
75-
coorganizerKeys: this.coorganizerKeys,
52+
const meeting = await this.app.createScheduledMeeting({
53+
$,
54+
data: {
55+
subject: this.subject,
56+
startTime: this.startTime,
57+
endTime: this.endTime,
58+
passwordRequired: this.passwordRequired,
59+
conferenceCallInfo: this.conferenceCallInfo,
60+
meetingType: this.meetingType,
61+
coorganizerKeys: parseObject(this.coorganizerKeys),
62+
},
7663
});
77-
$.export("$summary", `Meeting Created: ${meeting.subject}`);
64+
$.export("$summary", `Meeting Created: ${meeting[0].meetingid}`);
7865
return meeting;
7966
},
8067
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const MEETING_TYPE_OPTIONS = [
2+
{
3+
label: "Scheduled",
4+
value: "scheduled",
5+
},
6+
{
7+
label: "Instant",
8+
value: "instant",
9+
},
10+
{
11+
label: "Recurring",
12+
value: "recurring",
13+
},
14+
];
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export const parseObject = (obj) => {
2+
if (!obj) return undefined;
3+
4+
if (Array.isArray(obj)) {
5+
return obj.map((item) => {
6+
if (typeof item === "string") {
7+
try {
8+
return JSON.parse(item);
9+
} catch (e) {
10+
return item;
11+
}
12+
}
13+
return item;
14+
});
15+
}
16+
if (typeof obj === "string") {
17+
try {
18+
return JSON.parse(obj);
19+
} catch (e) {
20+
return obj;
21+
}
22+
}
23+
return obj;
24+
};

components/goto_meeting/goto_meeting.app.mjs

Lines changed: 16 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -3,155 +3,36 @@ import { axios } from "@pipedream/platform";
33
export default {
44
type: "app",
55
app: "goto_meeting",
6-
version: "0.0.{{ts}}",
7-
propDefinitions: {
8-
subject: {
9-
type: "string",
10-
label: "Subject",
11-
description: "The subject of the meeting",
12-
},
13-
startTime: {
14-
type: "string",
15-
label: "Start Time",
16-
description: "The start time of the meeting in ISO 8601 format",
17-
},
18-
endTime: {
19-
type: "string",
20-
label: "End Time",
21-
description: "The end time of the meeting in ISO 8601 format",
22-
},
23-
passwordRequired: {
24-
type: "boolean",
25-
label: "Password Required",
26-
description: "Whether a password is required to join the meeting",
27-
},
28-
conferenceCallInfo: {
29-
type: "string",
30-
label: "Conference Call Info",
31-
description: "Information for the conference call",
32-
},
33-
meetingType: {
34-
type: "string",
35-
label: "Meeting Type",
36-
description: "The type of the meeting",
37-
options: [
38-
{
39-
label: "Scheduled",
40-
value: "scheduled",
41-
},
42-
{
43-
label: "Instant",
44-
value: "instant",
45-
},
46-
{
47-
label: "Recurring",
48-
value: "recurring",
49-
},
50-
],
51-
},
52-
timezoneKey: {
53-
type: "string",
54-
label: "Timezone Key",
55-
description: "The timezone key for the meeting time",
56-
optional: true,
57-
},
58-
coorganizerKeys: {
59-
type: "string[]",
60-
label: "Co-Organizer Keys",
61-
description: "Keys of the co-organizers for the meeting",
62-
optional: true,
63-
async options() {
64-
const coorganizers = await this.listCoOrganizers();
65-
return coorganizers.map((coorganizer) => ({
66-
label: coorganizer.name,
67-
value: coorganizer.id,
68-
}));
69-
},
70-
},
71-
},
726
methods: {
73-
// Existing method
74-
authKeys() {
75-
console.log(Object.keys(this.$auth));
76-
},
777
_baseUrl() {
788
return "https://api.goto.com/meeting/v1";
799
},
80-
async _makeRequest(opts = {}) {
81-
const {
82-
$ = this,
83-
method = "GET",
84-
path = "/",
85-
headers = {},
86-
...otherOpts
87-
} = opts;
10+
_headers() {
11+
return {
12+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
13+
};
14+
},
15+
_makeRequest({
16+
$ = this, path, ...opts
17+
}) {
8818
return axios($, {
89-
...otherOpts,
90-
method,
9119
url: this._baseUrl() + path,
92-
headers: {
93-
...headers,
94-
"Authorization": `Bearer ${this.$auth.access_token}`,
95-
"Content-Type": "application/json",
96-
},
20+
headers: this._headers(),
21+
...opts,
9722
});
9823
},
99-
async createScheduledMeeting({
100-
subject, startTime, endTime, passwordRequired, conferenceCallInfo, meetingType, timezoneKey, coorganizerKeys,
101-
}) {
102-
const data = {
103-
subject: this.subject,
104-
startTime: this.startTime,
105-
endTime: this.endTime,
106-
passwordRequired: this.passwordRequired,
107-
conferenceCallInfo: this.conferenceCallInfo,
108-
meetingType: this.meetingType,
109-
};
110-
if (this.timezoneKey) {
111-
data.timezoneKey = this.timezoneKey;
112-
}
113-
if (this.coorganizerKeys && this.coorganizerKeys.length > 0) {
114-
data.coorganizerKeys = this.coorganizerKeys;
115-
}
116-
const meeting = await this._makeRequest({
24+
createScheduledMeeting(opts = {}) {
25+
return this._makeRequest({
11726
method: "POST",
11827
path: "/meetings",
119-
data,
28+
...opts,
12029
});
121-
this.emitMeetingCreated(meeting);
122-
return meeting;
12330
},
124-
async listCoOrganizers() {
31+
listUpcomingMeetings(opts = {}) {
12532
return this._makeRequest({
126-
method: "GET",
127-
path: "/users/coorganizers",
33+
path: "/upcomingMeetings",
34+
...opts,
12835
});
12936
},
130-
emitMeetingCreated(meeting) {
131-
this.$emit(meeting, {
132-
summary: `Meeting Created: ${meeting.subject}`,
133-
id: meeting.id,
134-
});
135-
},
136-
async paginate(fn, ...opts) {
137-
const results = [];
138-
let hasMore = true;
139-
let page = 1;
140-
141-
while (hasMore) {
142-
const response = await fn({
143-
...opts,
144-
page,
145-
});
146-
if (response && response.length > 0) {
147-
results.push(...response);
148-
page += 1;
149-
} else {
150-
hasMore = false;
151-
}
152-
}
153-
154-
return results;
155-
},
15637
},
15738
};

components/goto_meeting/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/goto_meeting",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream GoTo Meeting Components",
55
"main": "goto_meeting.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
1518
}

0 commit comments

Comments
 (0)