Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "calendly_v2-create-invitee-no-show",
name: "Create Invitee No Show",
description: "Marks an Invitee as a No Show in Calendly. [See the documentation](https://calendly.stoplight.io/docs/api-docs/cebd8c3170790-create-invitee-no-show).",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
calendly,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "calendly_v2-create-scheduling-link",
name: "Create a Scheduling Link",
description: "Creates a single-use scheduling link. [See the documentation](https://calendly.stoplight.io/docs/api-docs/b3A6MzQyNTM0OQ-create-single-use-scheduling-link)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
calendly,
Expand Down
2 changes: 1 addition & 1 deletion components/calendly_v2/actions/get-event/get-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "calendly_v2-get-event",
name: "Get Event",
description: "Gets information about an Event associated with a URI. [See the documentation](https://developer.calendly.com/api-docs/e2f95ebd44914-get-event).",
version: "0.1.5",
version: "0.1.6",
type: "action",
props: {
calendly,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "calendly_v2-list-event-invitees",
name: "List Event Invitees",
description: "List invitees for an event. [See the documentation](https://calendly.stoplight.io/docs/api-docs/b3A6NTkxNDEx-list-event-invitees)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
calendly,
Expand Down
70 changes: 64 additions & 6 deletions components/calendly_v2/actions/list-events/list-events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,39 @@
key: "calendly_v2-list-events",
name: "List Events",
description: "List events for an user. [See the documentation](https://calendly.stoplight.io/docs/api-docs/b3A6NTkxNDEy-list-events)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
calendly,
alert: {

Check warning on line 11 in components/calendly_v2/actions/list-events/list-events.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 11 in components/calendly_v2/actions/list-events/list-events.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `
Select "authenticatedUser" scope to return events for the authenticated user
Select "organization" scope to return events for that organization (requires admin/owner privilege)
Select "user" scope to return events for a specific User in your organization (requires admin/owner privilege)
Select "group" scope to return events for a specific Group (requires organization admin/owner or group admin privilege)`,
},
scope: {
type: "string",
label: "Scope",
description: "The scope to fetch events for",
options: [
"authenticatedUser",
"organization",
"user",
"group",
],
default: "authenticatedUser",
reloadProps: true,
},
organization: {
propDefinition: [
calendly,
"organization",
],
optional: true,
hidden: true,
},
user: {
propDefinition: [
Expand All @@ -24,6 +48,19 @@
],
description: "Returns events for a specified user",
optional: true,
hidden: true,
},
group: {
propDefinition: [
calendly,
"groupId",
(c) => ({
organization: c.organization,
}),
],
description: "Returns events for a specified group",
optional: true,
hidden: true,
},
inviteeEmail: {
propDefinition: [
Expand Down Expand Up @@ -51,14 +88,35 @@
],
},
},
async additionalProps(props) {
props.organization.hidden = this.scope === "authenticatedUser";
props.organization.optional = this.scope === "authenticatedUser";

props.group.hidden = this.scope !== "group";
props.group.optional = this.scope !== "group";

props.user.hidden = this.scope !== "user";
props.user.optional = this.scope !== "user";

return {};
},
async run({ $ }) {
const params = {
organization: this.organization,
inviteeEmail: this.inviteeEmail,
status: this.status,
paginate: this.paginate,
maxResults: this.maxResults,
};
if (this.inviteeEmail) params.invitee_email = this.inviteeEmail;
if (this.status) params.status = this.status;
if (this.paginate) params.paginate = this.paginate;
if (this.maxResults) params.maxResults = this.maxResults;

if (this.scope !== "authenticatedUser") {
params.organization = this.organization;
}
if (this.scope === "user") {
params.user = this.user;
}
if (this.scope === "group") {
params.group = this.group;
}

const response = await this.calendly.listEvents(params, this.user, $);
$.export("$summary", `Found ${response.pagination.count} event(s)`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "calendly_v2-list-user-availability-schedules",
name: "List User Availability Schedules",
description: "List the availability schedules of the given user. [See the documentation](https://developer.calendly.com/api-docs/8098de44af94c-list-user-availability-schedules)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
calendly,
Expand Down
79 changes: 55 additions & 24 deletions components/calendly_v2/calendly_v2.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ export default {
});
},
},
groupId: {
type: "string",
label: "Group ID",
description: "A group UUID",
async options({
prevContext, organization,
}) {
prevContext.organization = organization;
return await this._makeAsyncOptionsRequest({
prevContext,
requestType: "listGroups",
optionsCallbackFn: this._getNameOptions,
});
},
},
inviteeEmail: {
type: "string",
label: "Inviteee Email",
Expand Down Expand Up @@ -101,6 +116,9 @@ export default {
_buildUserUri(user) {
return `${this._baseUri()}/users/${user}`;
},
_buildGroupUri(group) {
return `${this._baseUri()}/groups/${group}`;
},
_buildEventType(eventType) {
return `${this._baseUri()}/event_types/${eventType}`;
},
Expand Down Expand Up @@ -184,23 +202,27 @@ export default {
delete opts.params.paginate;
delete opts.params.maxResults;

do {
const res = await axios(
$ ?? this,
this._makeRequestOpts(opts),
);
response.collection.push(...res.collection);
response.pagination.count += res.pagination.count;
response.pagination.next_page = res.pagination.next_page;
opts.params.page_token = this._extractNextPageToken(res.pagination.next_page);
} while (paginate && opts.params.page_token && response.collection.length < maxResults);
try {
do {
const res = await axios(
$ ?? this,
this._makeRequestOpts(opts),
);
response.collection.push(...res.collection);
response.pagination.count += res.pagination.count;
response.pagination.next_page = res.pagination.next_page;
opts.params.page_token = this._extractNextPageToken(res.pagination.next_page);
} while (paginate && opts.params.page_token && response.collection.length < maxResults);

if (response.collection.length > maxResults) {
response.collection.length = maxResults;
response.pagination.count = maxResults;
}
if (response.collection.length > maxResults) {
response.collection.length = maxResults;
response.pagination.count = maxResults;
}

return response;
return response;
} catch (error) {
throw new Error(`${error.response.data.title} - ${error.response.data.message}`);
}
},
async getUserInfo(user, $) {
const opts = {
Expand Down Expand Up @@ -239,18 +261,19 @@ export default {
);
},
async listEvents(params, uuid, $) {
const user = uuid
? this._buildUserUri(uuid)
: !params?.organization
? await this.defaultUser($)
: undefined;
if (uuid) {
params.user = this._buildUserUri(uuid);
}
if (params.group) {
params.group = this._buildGroupUri(params.group);
}
if (!params.organization && !params.group && !params.user) {
params.user = await this.defaultUser($);
}

const opts = {
path: "/scheduled_events",
params: {
user,
...params,
},
params,
};

return this._makeRequest(opts, $);
Expand Down Expand Up @@ -298,6 +321,14 @@ export default {

return this._makeRequest(opts, $);
},
async listGroups(params, $) {
const opts = {
path: "/groups",
params,
};

return this._makeRequest(opts, $);
},
async createSchedulingLink(params, $) {
params.owner = this._buildEventType(params.owner);

Expand Down
2 changes: 1 addition & 1 deletion components/calendly_v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/calendly_v2",
"version": "1.3.0",
"version": "1.3.1",
"description": "Pipedream Calendly V2 Components",
"main": "calendly_v2.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "calendly_v2-invitee-canceled",
name: "New Invitee Canceled",
description: "Emit new event when an event is canceled.",
version: "0.0.3",
version: "0.0.4",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "calendly_v2-invitee-created",
name: "New Invitee Created",
description: "Emit new event when a new event is scheduled.",
version: "0.0.4",
version: "0.0.5",
type: "source",
dedupe: "unique",
props: {
Expand Down
Loading
Loading