Skip to content

Commit b0adee7

Browse files
committed
microsoft_outlook_calendar components
1 parent 8aac563 commit b0adee7

File tree

3 files changed

+139
-4
lines changed

3 files changed

+139
-4
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
2+
3+
export default {
4+
key: "microsoft_outlook_calendar-get-schedule",
5+
name: "Get Free/Busy Schedule",
6+
description: "Get the free/busy availability information for a collection of users, distributions lists, or resources (rooms or equipment) for a specified time period. [See the documentation](https://learn.microsoft.com/en-us/graph/api/calendar-getschedule)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
microsoftOutlook,
11+
schedules: {
12+
type: "string[]",
13+
label: "Schedules",
14+
description: "A collection of SMTP addresses of users, distribution lists, or resources to get availability information for",
15+
},
16+
start: {
17+
propDefinition: [
18+
microsoftOutlook,
19+
"start",
20+
],
21+
},
22+
end: {
23+
propDefinition: [
24+
microsoftOutlook,
25+
"end",
26+
],
27+
},
28+
timeZone: {
29+
propDefinition: [
30+
microsoftOutlook,
31+
"timeZone",
32+
],
33+
},
34+
availabilityViewInterval: {
35+
type: "integer",
36+
label: "Availability View Interval",
37+
description: "Represents the duration of a time slot in minutes in an availabilityView in the response. The default is 30 minutes, minimum is 5, maximum is 1440.",
38+
optional: true,
39+
},
40+
},
41+
methods: {
42+
getSchedule(opts = {}) {
43+
return this.microsoftOutlook._makeRequest({
44+
method: "POST",
45+
path: "/me/calendar/getSchedule",
46+
...opts,
47+
});
48+
},
49+
},
50+
async run({ $ }) {
51+
const { value } = await this.getSchedule({
52+
$,
53+
data: {
54+
schedules: this.schedules,
55+
startTime: {
56+
dateTime: this.start,
57+
timeZone: this.timeZone,
58+
},
59+
endTime: {
60+
dateTime: this.end,
61+
timeZone: this.timeZone,
62+
},
63+
availabilityViewInterval: this.availabilityViewInterval,
64+
},
65+
});
66+
67+
$.export("$summary", `Successfully retrieved schedules for \`${this.schedules.join("`, `")}\``);
68+
69+
return value;
70+
},
71+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs";
2+
3+
export default {
4+
key: "microsoft_outlook_calendar-list-events",
5+
name: "List Events",
6+
description: "Get a list of event objects in the user's mailbox. [See the documentation](https://learn.microsoft.com/en-us/graph/api/user-list-events)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
microsoftOutlook,
11+
filter: {
12+
type: "string",
13+
label: "Filter",
14+
description: "Use the `$filter` query parameter to filter events. E.g. `contains(subject, 'my event')` [See the documentation](https://learn.microsoft.com/en-us/graph/filter-query-parameter) for more information about the `$filter` parameter.",
15+
optional: true,
16+
},
17+
orderBy: {
18+
type: "string",
19+
label: "Order By",
20+
description: "The field to sort the results by. Default is `createdDateTime`. [See the documentation](https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http#orderby-parameter) for more info about the `$orderby` parameter.",
21+
default: "createdDateTime",
22+
optional: true,
23+
},
24+
sortOrder: {
25+
type: "string",
26+
label: "Sort Order",
27+
description: "Whether to sort the results in ascending or descending order. Default is `descending`.",
28+
options: [
29+
{
30+
label: "ascending",
31+
value: "asc",
32+
},
33+
{
34+
label: "descending",
35+
value: "desc",
36+
},
37+
],
38+
default: "desc",
39+
optional: true,
40+
},
41+
maxResults: {
42+
type: "integer",
43+
label: "Max Results",
44+
description: "The maximum number of results to return",
45+
optional: true,
46+
},
47+
},
48+
async run({ $ }) {
49+
const { value = [] } = await this.microsoftOutlook.listCalendarEvents({
50+
$,
51+
params: {
52+
"$orderby": `${this.orderBy} ${this.sortOrder}`,
53+
"$filter": this.filter,
54+
"$top": this.maxResults,
55+
},
56+
});
57+
58+
$.export("$summary", `Successfully retrieved ${value.length} event${value.length === 1
59+
? ""
60+
: "s"}`);
61+
62+
return value;
63+
},
64+
};
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/microsoft_outlook_calendar",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "Pipedream Microsoft Outlook Calendar Components",
55
"main": "microsoft_outlook_calendar.app.mjs",
66
"keywords": [
@@ -11,10 +11,10 @@
1111
],
1212
"homepage": "https://pipedream.com/apps/microsoft_outlook_calendar",
1313
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
14-
"dependencies": {
15-
"@pipedream/platform": "^1.5.1"
16-
},
1714
"publishConfig": {
1815
"access": "public"
16+
},
17+
"dependencies": {
18+
"@pipedream/platform": "^3.0.3"
1919
}
2020
}

0 commit comments

Comments
 (0)