diff --git a/components/microsoft_onedrive/actions/get-file-by-id/get-file-by-id.mjs b/components/microsoft_onedrive/actions/get-file-by-id/get-file-by-id.mjs new file mode 100644 index 0000000000000..764176af965e6 --- /dev/null +++ b/components/microsoft_onedrive/actions/get-file-by-id/get-file-by-id.mjs @@ -0,0 +1,25 @@ +import onedrive from "../../microsoft_onedrive.app.mjs"; + +export default { + key: "microsoft_onedrive-get-file-by-id", + name: "Get File by ID", + description: "Retrieves a file by ID. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get)", + version: "0.0.1", + type: "action", + props: { + onedrive, + fileId: { + propDefinition: [ + onedrive, + "fileId", + ], + description: "The file to retrieve. You can either search for the file here, provide a custom *File ID*.", + }, + }, + async run({ $ }) { + const response = await this.onedrive.client().api(`/me/drive/items/${this.fileId}`) + .get(); + $.export("$summary", `Successfully retreived file with ID: ${this.fileId}`); + return response; + }, +}; diff --git a/components/microsoft_onedrive/package.json b/components/microsoft_onedrive/package.json index b85bb6a2847f4..1dd1788bf086f 100644 --- a/components/microsoft_onedrive/package.json +++ b/components/microsoft_onedrive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/microsoft_onedrive", - "version": "1.5.2", + "version": "1.6.0", "description": "Pipedream Microsoft OneDrive components", "main": "microsoft_onedrive.app.js", "homepage": "https://pipedream.com/apps/microsoft-onedrive", @@ -10,7 +10,7 @@ }, "dependencies": { "@microsoft/microsoft-graph-client": "^3.0.1", - "@pipedream/platform": "^1.1.0", + "@pipedream/platform": "^3.0.3", "bottleneck": "^2.19.5", "file-type": "^18.7.0", "isomorphic-fetch": "^3.0.0", diff --git a/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs b/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs new file mode 100644 index 0000000000000..91f18e490ff0d --- /dev/null +++ b/components/microsoft_outlook/actions/add-label-to-email/add-label-to-email.mjs @@ -0,0 +1,45 @@ +import microsoftOutlook from "../../microsoft_outlook.app.mjs"; + +export default { + key: "microsoft_outlook-add-label-to-email", + name: "Add Label to Email", + description: "Adds a label/category to an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)", + version: "0.0.1", + type: "action", + props: { + microsoftOutlook, + messageId: { + propDefinition: [ + microsoftOutlook, + "messageId", + ], + }, + labelId: { + propDefinition: [ + microsoftOutlook, + "labelId", + ], + }, + }, + async run({ $ }) { + const message = await this.microsoftOutlook.getMessage({ + $, + messageId: this.messageId, + }); + + const labels = message?.categories; + + const response = await this.microsoftOutlook.updateMessage({ + $, + messageId: this.messageId, + data: { + categories: [ + ...labels, + this.labelId, + ], + }, + }); + $.export("$summary", "Successfully added label to message."); + return response; + }, +}; diff --git a/components/microsoft_outlook/actions/create-contact/create-contact.mjs b/components/microsoft_outlook/actions/create-contact/create-contact.mjs index cad9c28c18fe1..c18142be6ab67 100644 --- a/components/microsoft_outlook/actions/create-contact/create-contact.mjs +++ b/components/microsoft_outlook/actions/create-contact/create-contact.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-create-contact", - version: "0.0.7", + version: "0.0.8", name: "Create Contact", description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)", props: { diff --git a/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs b/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs index a0f3bd330aa59..08d0f738490d0 100644 --- a/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs +++ b/components/microsoft_outlook/actions/create-draft-email/create-draft-email.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-create-draft-email", - version: "0.0.7", + version: "0.0.8", name: "Create Draft Email", description: "Create a draft email, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-messages)", props: { diff --git a/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs b/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs index 92ac9b7020773..eaeb4a3344735 100644 --- a/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs +++ b/components/microsoft_outlook/actions/find-contacts/find-contacts.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-find-contacts", - version: "0.0.7", + version: "0.0.8", name: "Find Contacts", description: "Finds contacts with given search string", props: { diff --git a/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs b/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs index 2d7602b5f7a47..adef14cfa0363 100644 --- a/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs +++ b/components/microsoft_outlook/actions/list-contacts/list-contacts.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-list-contacts", - version: "0.0.7", + version: "0.0.8", name: "List Contacts", description: "Get a contact collection from the default contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-list-contacts)", props: { diff --git a/components/microsoft_outlook/actions/list-labels/list-labels.mjs b/components/microsoft_outlook/actions/list-labels/list-labels.mjs new file mode 100644 index 0000000000000..48db4fc94b851 --- /dev/null +++ b/components/microsoft_outlook/actions/list-labels/list-labels.mjs @@ -0,0 +1,21 @@ +import microsoftOutlook from "../../microsoft_outlook.app.mjs"; + +export default { + key: "microsoft_outlook-list-labels", + name: "List Labels", + description: "Get all the labels/categories that have been defined for a user. [See the documentation](https://learn.microsoft.com/en-us/graph/api/outlookuser-list-mastercategories)", + version: "0.0.1", + type: "action", + props: { + microsoftOutlook, + }, + async run({ $ }) { + const { value } = await this.microsoftOutlook.listLabels({ + $, + }); + $.export("$summary", `Successfully retrieved ${value.length} label${value.length != 1 + ? "s" + : ""}.`); + return value; + }, +}; diff --git a/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs b/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs new file mode 100644 index 0000000000000..b4a21dd48370b --- /dev/null +++ b/components/microsoft_outlook/actions/remove-label-from-email/remove-label-from-email.mjs @@ -0,0 +1,47 @@ +import microsoftOutlook from "../../microsoft_outlook.app.mjs"; + +export default { + key: "microsoft_outlook-remove-label-from-email", + name: "Remove Label from Email", + description: "Removes a label/category from an email in Microsoft Outlook. [See the documentation](https://learn.microsoft.com/en-us/graph/api/message-update)", + version: "0.0.1", + type: "action", + props: { + microsoftOutlook, + messageId: { + propDefinition: [ + microsoftOutlook, + "messageId", + ], + }, + labelId: { + propDefinition: [ + microsoftOutlook, + "labelId", + ], + description: "The identifier of the label/category to remove", + }, + }, + async run({ $ }) { + const message = await this.microsoftOutlook.getMessage({ + $, + messageId: this.messageId, + }); + let labels = message?.categories; + + const index = labels.indexOf(this.labelId); + if (index > -1) { + labels.splice(index, 1); + } + + const response = await this.microsoftOutlook.updateMessage({ + $, + messageId: this.messageId, + data: { + categories: labels, + }, + }); + $.export("$summary", "Successfully removed label from message."); + return response; + }, +}; diff --git a/components/microsoft_outlook/actions/send-email/send-email.mjs b/components/microsoft_outlook/actions/send-email/send-email.mjs index 59807a5e715ed..873618e0367ae 100644 --- a/components/microsoft_outlook/actions/send-email/send-email.mjs +++ b/components/microsoft_outlook/actions/send-email/send-email.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-send-email", - version: "0.0.8", + version: "0.0.9", name: "Send Email", description: "Send an email to one or multiple recipients, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-sendmail)", props: { diff --git a/components/microsoft_outlook/actions/update-contact/update-contact.mjs b/components/microsoft_outlook/actions/update-contact/update-contact.mjs index 0e03b22201b33..7cfc1a99c3cb7 100644 --- a/components/microsoft_outlook/actions/update-contact/update-contact.mjs +++ b/components/microsoft_outlook/actions/update-contact/update-contact.mjs @@ -3,7 +3,7 @@ import microsoftOutlook from "../../microsoft_outlook.app.mjs"; export default { type: "action", key: "microsoft_outlook-update-contact", - version: "0.0.7", + version: "0.0.8", name: "Update Contact", description: "Add a contact to the root Contacts folder, [See the docs](https://docs.microsoft.com/en-us/graph/api/user-post-contacts)", props: { diff --git a/components/microsoft_outlook/microsoft_outlook.app.mjs b/components/microsoft_outlook/microsoft_outlook.app.mjs index dddde09063d63..21391edb7ccd0 100644 --- a/components/microsoft_outlook/microsoft_outlook.app.mjs +++ b/components/microsoft_outlook/microsoft_outlook.app.mjs @@ -100,6 +100,41 @@ export default { type: "object", optional: true, }, + labelId: { + type: "string", + label: "Label ID", + description: "The identifier of the label/category to add", + async options() { + const { value: labels } = await this.listLabels(); + return labels?.map(({ + id: value, displayName: label, + }) => ({ + value, + label, + })) || []; + }, + }, + messageId: { + type: "string", + label: "Message ID", + description: "The identifier of the message to update", + async options({ page }) { + const limit = 50; + const { value } = await this.listMessages({ + params: { + $top: limit, + $skip: limit * page, + $orderby: "createdDateTime desc", + }, + }); + return value?.map(({ + id: value, subject: label, + }) => ({ + value, + label, + })) || []; + }, + }, }, methods: { _getUrl(path) { @@ -286,5 +321,20 @@ export default { ...args, }); }, + listLabels(args = {}) { + return this._makeRequest({ + path: "/me/outlook/masterCategories", + ...args, + }); + }, + updateMessage({ + messageId, ...args + }) { + return this._makeRequest({ + method: "PATCH", + path: `/me/messages/${messageId}`, + ...args, + }); + }, }, }; diff --git a/components/microsoft_outlook/package.json b/components/microsoft_outlook/package.json index 4de1e5d98f48a..1a07f608491c5 100644 --- a/components/microsoft_outlook/package.json +++ b/components/microsoft_outlook/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/microsoft_outlook", - "version": "1.0.5", + "version": "1.1.0", "description": "Pipedream Microsoft Outlook Components", "main": "microsoft_outlook.app.mjs", "keywords": [ @@ -12,6 +12,7 @@ "homepage": "https://pipedream.com/apps/microsoft_outlook", "author": "Pipedream (https://pipedream.com/)", "dependencies": { + "@pipedream/platform": "^3.0.3", "axios": "^0.21.1", "js-base64": "^3.7.2", "md5": "^2.3.0", diff --git a/components/microsoft_outlook/sources/new-contact/new-contact.mjs b/components/microsoft_outlook/sources/new-contact/new-contact.mjs index dd9579df69308..45326cdb7d043 100644 --- a/components/microsoft_outlook/sources/new-contact/new-contact.mjs +++ b/components/microsoft_outlook/sources/new-contact/new-contact.mjs @@ -5,7 +5,7 @@ export default { key: "microsoft_outlook-new-contact", name: "New Contact Event (Instant)", description: "Emit new event when a new Contact is created", - version: "0.0.8", + version: "0.0.9", type: "source", hooks: { ...common.hooks, diff --git a/components/microsoft_outlook/sources/new-email/new-email.mjs b/components/microsoft_outlook/sources/new-email/new-email.mjs index ab8aa72217cbf..785b66a58b0c6 100644 --- a/components/microsoft_outlook/sources/new-email/new-email.mjs +++ b/components/microsoft_outlook/sources/new-email/new-email.mjs @@ -7,7 +7,7 @@ export default { key: "microsoft_outlook-new-email", name: "New Email Event (Instant)", description: "Emit new event when an email is received in specified folders.", - version: "0.0.11", + version: "0.0.12", type: "source", dedupe: "unique", props: { diff --git a/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs b/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs new file mode 100644 index 0000000000000..652669db759e5 --- /dev/null +++ b/components/microsoft_outlook_calendar/actions/get-schedule/get-schedule.mjs @@ -0,0 +1,71 @@ +import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs"; + +export default { + key: "microsoft_outlook_calendar-get-schedule", + name: "Get Free/Busy Schedule", + 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)", + version: "0.0.1", + type: "action", + props: { + microsoftOutlook, + schedules: { + type: "string[]", + label: "Schedules", + description: "A collection of SMTP addresses of users, distribution lists, or resources to get availability information for", + }, + start: { + propDefinition: [ + microsoftOutlook, + "start", + ], + }, + end: { + propDefinition: [ + microsoftOutlook, + "end", + ], + }, + timeZone: { + propDefinition: [ + microsoftOutlook, + "timeZone", + ], + }, + availabilityViewInterval: { + type: "integer", + label: "Availability View Interval", + 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.", + optional: true, + }, + }, + methods: { + getSchedule(opts = {}) { + return this.microsoftOutlook._makeRequest({ + method: "POST", + path: "/me/calendar/getSchedule", + ...opts, + }); + }, + }, + async run({ $ }) { + const { value } = await this.getSchedule({ + $, + data: { + schedules: this.schedules, + startTime: { + dateTime: this.start, + timeZone: this.timeZone, + }, + endTime: { + dateTime: this.end, + timeZone: this.timeZone, + }, + availabilityViewInterval: this.availabilityViewInterval, + }, + }); + + $.export("$summary", `Successfully retrieved schedules for \`${this.schedules.join("`, `")}\``); + + return value; + }, +}; diff --git a/components/microsoft_outlook_calendar/actions/list-events/list-events.mjs b/components/microsoft_outlook_calendar/actions/list-events/list-events.mjs new file mode 100644 index 0000000000000..dc57d15273ecd --- /dev/null +++ b/components/microsoft_outlook_calendar/actions/list-events/list-events.mjs @@ -0,0 +1,64 @@ +import microsoftOutlook from "../../microsoft_outlook_calendar.app.mjs"; + +export default { + key: "microsoft_outlook_calendar-list-events", + name: "List Events", + 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)", + version: "0.0.1", + type: "action", + props: { + microsoftOutlook, + filter: { + type: "string", + label: "Filter", + 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.", + optional: true, + }, + orderBy: { + type: "string", + label: "Order By", + 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.", + default: "createdDateTime", + optional: true, + }, + sortOrder: { + type: "string", + label: "Sort Order", + description: "Whether to sort the results in ascending or descending order. Default is `descending`.", + options: [ + { + label: "ascending", + value: "asc", + }, + { + label: "descending", + value: "desc", + }, + ], + default: "desc", + optional: true, + }, + maxResults: { + type: "integer", + label: "Max Results", + description: "The maximum number of results to return", + optional: true, + }, + }, + async run({ $ }) { + const { value = [] } = await this.microsoftOutlook.listCalendarEvents({ + $, + params: { + "$orderby": `${this.orderBy} ${this.sortOrder}`, + "$filter": this.filter, + "$top": this.maxResults, + }, + }); + + $.export("$summary", `Successfully retrieved ${value.length} event${value.length === 1 + ? "" + : "s"}`); + + return value; + }, +}; diff --git a/components/microsoft_outlook_calendar/package.json b/components/microsoft_outlook_calendar/package.json index 063bbda238371..c92e035a0afa5 100644 --- a/components/microsoft_outlook_calendar/package.json +++ b/components/microsoft_outlook_calendar/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/microsoft_outlook_calendar", - "version": "0.2.0", + "version": "0.3.0", "description": "Pipedream Microsoft Outlook Calendar Components", "main": "microsoft_outlook_calendar.app.mjs", "keywords": [ @@ -11,10 +11,10 @@ ], "homepage": "https://pipedream.com/apps/microsoft_outlook_calendar", "author": "Pipedream (https://pipedream.com/)", - "dependencies": { - "@pipedream/platform": "^1.5.1" - }, "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0175fcf2a536f..d743fb7fb5037 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5884,8 +5884,7 @@ importers: specifier: ^1.2.1 version: 1.6.6 - components/lightpanda: - specifiers: {} + components/lightpanda: {} components/lightspeed_retail_pos: dependencies: @@ -6540,8 +6539,8 @@ importers: specifier: ^3.0.1 version: 3.0.7 '@pipedream/platform': - specifier: ^1.1.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 bottleneck: specifier: ^2.19.5 version: 2.19.5 @@ -6557,6 +6556,9 @@ importers: components/microsoft_outlook: dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 axios: specifier: ^0.21.1 version: 0.21.4 @@ -6573,8 +6575,8 @@ importers: components/microsoft_outlook_calendar: dependencies: '@pipedream/platform': - specifier: ^1.5.1 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 components/microsoft_power_bi: dependencies: