Skip to content
Merged
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
3 changes: 0 additions & 3 deletions components/calendarhero/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import app from "../../calendarhero.app.mjs";

export default {
key: "calendarhero-list-meeting-types",
name: "List Meeting Types",
description: "Get the user's meeting types. [See the documentation](https://api.calendarhero.com/documentation#/user/getUserMeeting).",
version: "0.0.1",
type: "action",
props: {
app,
},
async run({ $ }) {
const response = await this.app.listMeetingTypes({
$,
});
const { length } = Object.keys(response ?? {});
$.export("$summary", `Successfully listed ${length} meeting type${length === 1
? ""
: "s"}`);
return response;
},
};
36 changes: 36 additions & 0 deletions components/calendarhero/actions/list-meetings/list-meetings.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import app from "../../calendarhero.app.mjs";

export default {
key: "calendarhero-list-meetings",
name: "List Meetings",
description: "Get the user's meetings within a timeframe. [See the documentation](https://api.calendarhero.com/documentation#/meeting/getMeeting).",
version: "0.0.1",
type: "action",
props: {
app,
start: {
type: "string",
label: "Start Date/Time",
description: "Initial date/time of the period to list events, in ISO 8601 format, e.g. `2025-03-10T09:00:00Z`",
},
end: {
type: "string",
label: "End Date/Time",
description: "End date/time of the period to list events, in ISO 8601 format, e.g. `2025-03-14T18:00:00Z`",
},
},
async run({ $ }) {
const {
app, ...params
} = this;
const response = await app.listMeetings({
$,
params,
});
const { length } = response;
$.export("$summary", `Successfully listed ${length} meeting${length === 1
? ""
: "s"}`);
return response;
},
};
13 changes: 0 additions & 13 deletions components/calendarhero/app/calendarhero.app.ts

This file was deleted.

51 changes: 51 additions & 0 deletions components/calendarhero/calendarhero.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "calendarhero",
propDefinitions: {},
methods: {
async _makeRequest({
$ = this, headers, ...args
} = {}) {
return axios($, {
baseURL: "https://api.calendarhero.com",
headers: {
...headers,
Authorization: `${this.$auth.api_key}`,
},
...args,
});
},
listMeetings(args) {
return this._makeRequest({
url: "/meeting",
...args,
});
},
listMeetingTypes(args) {
return this._makeRequest({
url: "/user/meeting",
...args,
});
},
createWebhook({
event, ...args
}) {
return this._makeRequest({
method: "post",
url: `webhook/${event}`,
...args,
});
},
deleteWebhook({
event, ...args
}) {
return this._makeRequest({
method: "delete",
url: `webhook/${event}`,
...args,
});
},
},
};
34 changes: 34 additions & 0 deletions components/calendarhero/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export const WEBHOOK_EVENT_TYPE_OPTIONS = [
{
label: "New Meeting Request",
value: "new_meeting_request",
},
{
label: "Meeting Request Succeeded",
value: "meeting_request_success",
},
{
label: "Meeting Request Expired",
value: "meeting_request_expired",
},
{
label: "Meeting Request Cancelled",
value: "meeting_request_cancelled",
},
{
label: "Meeting Rescheduled",
value: "meeting_rescheduled",
},
{
label: "Meeting Started",
value: "meeting_started",
},
{
label: "Meeting Completed",
value: "meeting_completed",
},
{
label: "New Contact Added",
value: "new_contact_added",
},
];
10 changes: 5 additions & 5 deletions components/calendarhero/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@pipedream/calendarhero",
"version": "0.0.3",
"version": "0.1.0",
"description": "Pipedream CalendarHero Components",
"main": "dist/app/calendarhero.app.mjs",
"main": "calendarhero.app.mjs",
"keywords": [
"pipedream",
"calendarhero"
],
"files": [
"dist"
],
"homepage": "https://pipedream.com/apps/calendarhero",
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import app from "../../calendarhero.app.mjs";
import { WEBHOOK_EVENT_TYPE_OPTIONS } from "../../common/constants.mjs";

export default {
key: "calendarhero-new-event-instant",
name: "New Event (Instant)",
description:
"Emit new event when a selected type of CalendarHero event occurs. [See the documentation](https://api.calendarhero.com/documentation#/webhook/postWebhookEvent)",
type: "source",
version: "0.0.1",
dedupe: "unique",
props: {
app,
http: "$.interface.http",
event: {
type: "string",
label: "Event Type",
description: "Select the type of event that will trigger this source",
options: WEBHOOK_EVENT_TYPE_OPTIONS,
},
},
hooks: {
async activate() {
const {
app,
event,
http: { endpoint: hookUrl },
} = this;
await app.createWebhook({
event,
data: {
hookUrl,
},
});
},
async deactivate() {
const {
app,
event,
http: { endpoint: hookUrl },
} = this;
await app.deleteWebhook({
event,
data: {
hookUrl,
},
});
},
},
async run({ body }) {
const ts = Date.now();
const id = body.id ?? ts;
this.$emit(body, {
id,
summary: `New event${id
? ` (ID ${id})`
: ""}`,
ts,
});
},
};
17 changes: 10 additions & 7 deletions pnpm-lock.yaml

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

Loading