From 875885a97d037998247f5b40913142c492b6759a Mon Sep 17 00:00:00 2001 From: joao Date: Wed, 4 Jun 2025 18:48:48 +0100 Subject: [PATCH 1/2] feat: list recordings w/ userid and users --- .../list-user-cloud-recordings.mjs | 70 ++++++++++++++ .../actions/list-users/list-users.mjs | 93 +++++++++++++++++++ components/zoom_admin/zoom_admin.app.mjs | 21 +++++ 3 files changed, 184 insertions(+) create mode 100644 components/zoom_admin/actions/list-user-cloud-recordings/list-user-cloud-recordings.mjs create mode 100644 components/zoom_admin/actions/list-users/list-users.mjs diff --git a/components/zoom_admin/actions/list-user-cloud-recordings/list-user-cloud-recordings.mjs b/components/zoom_admin/actions/list-user-cloud-recordings/list-user-cloud-recordings.mjs new file mode 100644 index 0000000000000..af6f8f9342af2 --- /dev/null +++ b/components/zoom_admin/actions/list-user-cloud-recordings/list-user-cloud-recordings.mjs @@ -0,0 +1,70 @@ +import { paginate } from "../../common/pagination.mjs"; +import consts from "../../consts.mjs"; +import zoomAdmin from "../../zoom_admin.app.mjs"; + +export default { + name: "List User Cloud Recordings", + description: "Search cloud recordings from a user. [See the documentation](https://developers.zoom.us/docs/api/users/#tag/users/GET/users/{userId}/recordings)", + key: "zoom_admin-list-user-cloud-recordings", + version: "0.0.1", + type: "action", + props: { + zoomAdmin, + userId: { + type: "string", + label: "User ID", + description: "The user ID to get recordings for", + }, + mc: { + type: "string", + label: "MC", + description: "Query Metadata of Recording if an On-Premise Meeting Connector was used for the meeting.", + optional: true, + }, + trash: { + type: "boolean", + label: "Trash", + description: "If `true`, list recordings from trash", + optional: true, + }, + trashType: { + type: "string", + label: "Trash Type", + description: "Should be used together with `Trash`. The type of Cloud recording that you would like to retrieve from trash", + optional: true, + options: consts.CLOUD_RECORD_TRASH_TYPE_OPTIONS, + }, + from: { + type: "string", + label: "From", + description: "The start date in `yyyy-mm-dd` UTC format for the date range for which you would like to retrieve recordings. The maximum range can be a month. If no value is provided for this field, the default will be current date.", + optional: true, + }, + to: { + type: "string", + label: "To", + description: "End date in `yyyy-mm-dd` UTC format.", + optional: true, + }, + }, + async run({ $ }) { + const params = { + mc: this.mc, + trash: this.trash, + trash_type: this.trashType, + from: this.from, + to: this.to, + }; + + const data = await paginate( + this.zoomAdmin.listUserCloudRecordings, + "meetings", + this.userId, + params, + ); + + $.export("$summary", `${data.length} Cloud record(s) successfully fetched`); + + return data; + }, +}; diff --git a/components/zoom_admin/actions/list-users/list-users.mjs b/components/zoom_admin/actions/list-users/list-users.mjs new file mode 100644 index 0000000000000..15bed4dfbcecf --- /dev/null +++ b/components/zoom_admin/actions/list-users/list-users.mjs @@ -0,0 +1,93 @@ +import { paginate } from "../../common/pagination.mjs"; +import zoomAdmin from "../../zoom_admin.app.mjs"; + +export default { + name: "List users", + description: "List all users. [See the documentation](https://developers.zoom.us/docs/api/users/#tag/users/GET/users)", + key: "zoom_admin-list-users", + version: "0.0.1", + type: "action", + props: { + zoomAdmin, + status: { + type: "string", + label: "Status", + description: "The user's status", + optional: true, + default: "active", + options: [ + { label: "Active", value: "active" }, + { label: "Inactive", value: "inactive" }, + { label: "Pending", value: "pending" }, + ], + }, + pageSize: { + type: "integer", + label: "Page Size", + description: "The number of records returned within a single API call", + optional: true, + default: 30, + min: 1, + max: 2000, + }, + roleId: { + type: "string", + label: "Role ID", + description: "The role's unique ID to filter users by a specific role", + optional: true, + }, + pageNumber: { + type: "string", + label: "Page Number", + description: "The page number of the current page in the returned records", + optional: true, + }, + includeFields: { + type: "string", + label: "Include Fields", + description: "Additional fields to include in the response", + optional: true, + options: [ + { label: "Custom Attributes", value: "custom_attributes" }, + { label: "Host Key", value: "host_key" }, + ], + }, + nextPageToken: { + type: "string", + label: "Next Page Token", + description: "Token for paginating through large result sets (expires in 15 minutes)", + optional: true, + }, + license: { + type: "string", + label: "License", + description: "Filter users by specific license", + optional: true, + options: [ + { label: "Zoom Workforce Management", value: "zoom_workforce_management" }, + { label: "Zoom Compliance Management", value: "zoom_compliance_management" }, + ], + }, + }, + async run({ $ }) { + const params = { + status: this.status, + page_size: this.pageSize, + role_id: this.roleId, + page_number: this.pageNumber, + include_fields: this.includeFields, + next_page_token: this.nextPageToken, + license: this.license, + }; + + const data = await paginate( + this.zoomAdmin.listUsers, + "users", + params, + ); + + $.export("$summary", `Successfully fetched ${data.length} user(s)`); + + return data; + }, +}; diff --git a/components/zoom_admin/zoom_admin.app.mjs b/components/zoom_admin/zoom_admin.app.mjs index e183d3c5a631b..882ff75b2c8fa 100644 --- a/components/zoom_admin/zoom_admin.app.mjs +++ b/components/zoom_admin/zoom_admin.app.mjs @@ -358,6 +358,16 @@ export default { }); return data; }, + async listUserCloudRecordings(userId, params) { + const { data } = await this._makeRequest({ + path: `/users/${userId}/recordings`, + params: { + page_size: 100, + ...params, + }, + }); + return data; + }, async listMeetingRegistrants(meetingId, params, nextPageToken) { const { data } = await this._makeRequest({ path: `/meetings/${meetingId}/registrants`, @@ -391,6 +401,17 @@ export default { }); return data; }, + async listUsers(params, nextPageToken) { + const { data } = await this._makeRequest({ + path: `/users`, + params: { + page_size: 100, + next_page_token: nextPageToken, + ...params, + }, + }); + return data; + }, async listPastMeetingParticipants(meetingId, nextPageToken) { const { data } = await this._makeRequest({ path: `/past_meetings/${meetingId}/participants`, From 50ced99a6fb1d9ec53e04f043f7eb82831878a05 Mon Sep 17 00:00:00 2001 From: joaocoform Date: Tue, 17 Jun 2025 15:42:39 +0100 Subject: [PATCH 2/2] fix: eslint and update version --- .../actions/list-users/list-users.mjs | 35 +++++++++++++++---- components/zoom_admin/package.json | 2 +- components/zoom_admin/zoom_admin.app.mjs | 2 +- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/components/zoom_admin/actions/list-users/list-users.mjs b/components/zoom_admin/actions/list-users/list-users.mjs index 15bed4dfbcecf..32919acd0aabe 100644 --- a/components/zoom_admin/actions/list-users/list-users.mjs +++ b/components/zoom_admin/actions/list-users/list-users.mjs @@ -16,9 +16,18 @@ export default { optional: true, default: "active", options: [ - { label: "Active", value: "active" }, - { label: "Inactive", value: "inactive" }, - { label: "Pending", value: "pending" }, + { + label: "Active", + value: "active", + }, + { + label: "Inactive", + value: "inactive", + }, + { + label: "Pending", + value: "pending", + }, ], }, pageSize: { @@ -48,8 +57,14 @@ export default { description: "Additional fields to include in the response", optional: true, options: [ - { label: "Custom Attributes", value: "custom_attributes" }, - { label: "Host Key", value: "host_key" }, + { + label: "Custom Attributes", + value: "custom_attributes", + }, + { + label: "Host Key", + value: "host_key", + }, ], }, nextPageToken: { @@ -64,8 +79,14 @@ export default { description: "Filter users by specific license", optional: true, options: [ - { label: "Zoom Workforce Management", value: "zoom_workforce_management" }, - { label: "Zoom Compliance Management", value: "zoom_compliance_management" }, + { + label: "Zoom Workforce Management", + value: "zoom_workforce_management", + }, + { + label: "Zoom Compliance Management", + value: "zoom_compliance_management", + }, ], }, }, diff --git a/components/zoom_admin/package.json b/components/zoom_admin/package.json index 00b2120ac5c6d..598b901d69f8e 100644 --- a/components/zoom_admin/package.json +++ b/components/zoom_admin/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/zoom_admin", - "version": "0.8.0", + "version": "0.10.0", "description": "Pipedream Zoom_admin Components", "main": "zoom_admin.app.mjs", "keywords": [ diff --git a/components/zoom_admin/zoom_admin.app.mjs b/components/zoom_admin/zoom_admin.app.mjs index 882ff75b2c8fa..dd25dc52a3c0b 100644 --- a/components/zoom_admin/zoom_admin.app.mjs +++ b/components/zoom_admin/zoom_admin.app.mjs @@ -403,7 +403,7 @@ export default { }, async listUsers(params, nextPageToken) { const { data } = await this._makeRequest({ - path: `/users`, + path: "/users", params: { page_size: 100, next_page_token: nextPageToken,