Skip to content

New Components - goto_meeting #15392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions components/goto_meeting/actions/create-meeting/create-meeting.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { MEETING_TYPE_OPTIONS } from "../../common/constants.mjs";
import { parseObject } from "../../common/utils.mjs";
import app from "../../goto_meeting.app.mjs";

export default {
key: "goto_meeting-create-meeting",
name: "Create Meeting",
description: "Creates a scheduled meeting in GoTo Meeting. [See the documentation](https://developer.goto.com/GoToMeetingV1#tag/Meetings/operation/createMeeting)",
version: "0.0.1",
type: "action",
props: {
app,
subject: {
type: "string",
label: "Subject",
description: "The subject of the meeting",
},
startTime: {
type: "string",
label: "Start Time",
description: "The start time of the meeting in ISO 8601 format",
},
endTime: {
type: "string",
label: "End Time",
description: "The end time of the meeting in ISO 8601 format",
},
passwordRequired: {
type: "boolean",
label: "Password Required",
description: "Whether a password is required to join the meeting",
},
conferenceCallInfo: {
type: "string",
label: "Conference Call Info",
description: "Information for the conference call",
},
meetingType: {
type: "string",
label: "Meeting Type",
description: "The type of the meeting",
options: MEETING_TYPE_OPTIONS,
},
coorganizerKeys: {
type: "string[]",
label: "Co-Organizer Keys",
description: "Keys of the co-organizers for the meeting",
optional: true,
},
},
async run({ $ }) {
const meeting = await this.app.createScheduledMeeting({
$,
data: {
subject: this.subject,
startTime: this.startTime,
endTime: this.endTime,
passwordRequired: this.passwordRequired,
conferenceCallInfo: this.conferenceCallInfo,
meetingType: this.meetingType,
coorganizerKeys: parseObject(this.coorganizerKeys),
},
});
$.export("$summary", `Meeting Created: ${meeting[0].meetingid}`);
return meeting;
},
};
14 changes: 14 additions & 0 deletions components/goto_meeting/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const MEETING_TYPE_OPTIONS = [
{
label: "Scheduled",
value: "scheduled",
},
{
label: "Instant",
value: "instant",
},
{
label: "Recurring",
value: "recurring",
},
];
24 changes: 24 additions & 0 deletions components/goto_meeting/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const parseObject = (obj) => {
if (!obj) return undefined;

if (Array.isArray(obj)) {
return obj.map((item) => {
if (typeof item === "string") {
try {
return JSON.parse(item);
} catch (e) {
return item;
}
}
return item;
});
}
if (typeof obj === "string") {
try {
return JSON.parse(obj);
} catch (e) {
return obj;
}
}
return obj;
};
35 changes: 31 additions & 4 deletions components/goto_meeting/goto_meeting.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "goto_meeting",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.goto.com/meeting/v1";
},
_headers() {
return {
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
};
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: this._baseUrl() + path,
headers: this._headers(),
...opts,
});
},
createScheduledMeeting(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/meetings",
...opts,
});
},
listUpcomingMeetings(opts = {}) {
return this._makeRequest({
path: "/upcomingMeetings",
...opts,
});
},
},
};
7 changes: 5 additions & 2 deletions components/goto_meeting/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/goto_meeting",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream GoTo Meeting Components",
"main": "goto_meeting.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
42 changes: 42 additions & 0 deletions components/goto_meeting/sources/new-meeting/new-meeting.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
import app from "../../goto_meeting.app.mjs";

export default {
key: "goto_meeting-new-meeting",
name: "New Meeting Created",
description: "Emit new event when a meeting is created in your GoToMeeting account.",
version: "0.0.1",
type: "source",
dedupe: "unique",
props: {
app,
db: "$.service.db",
timer: {
type: "$.interface.timer",
default: {
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
},
},
},
methods: {
async emitEvent() {
const response = await this.app.listUpcomingMeetings();

for (const item of response) {
this.$emit(item, {
id: item.meetingId,
summary: `Meeting Created: ${item.meetingId}`,
ts: Date.now(),
});
}
},
},
hooks: {
async deploy() {
await this.emitEvent();
},
},
async run() {
await this.emitEvent();
},
};
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading