@pipedream/zoom 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/zoom.app.mjs CHANGED
@@ -1,21 +1,56 @@
1
1
  import { axios } from "@pipedream/platform";
2
+ import constants from "./common/constants.mjs";
2
3
 
3
4
  export default {
4
5
  type: "app",
5
6
  app: "zoom",
6
7
  propDefinitions: {
7
- meetingIds: {
8
- type: "integer[]",
9
- label: "Meeting Filter",
10
- description: "Optionally filter for events for one or more meetings",
11
- async options({ page }) {
12
- const { meetings } = await this.listMeetings({
13
- page_number: page + 1,
8
+ webinarId: {
9
+ type: "string",
10
+ label: "Webinar",
11
+ description: "The webinar to get details for",
12
+ async options({ prevContext }) {
13
+ const { nextPageToken } = prevContext;
14
+ const response = await this.listWebinars({
15
+ params: {
16
+ next_page_token: nextPageToken,
17
+ },
14
18
  });
15
- return meetings.map((meeting) => ({
19
+ const options = response.webinars.map(({
20
+ id: value, topic: label,
21
+ }) => ({
22
+ label,
23
+ value,
24
+ }));
25
+ return {
26
+ context: {
27
+ nextPageToken: response.next_page_token,
28
+ },
29
+ options,
30
+ };
31
+ },
32
+ },
33
+ meetingId: {
34
+ type: "integer",
35
+ label: "Meeting ID",
36
+ description: "The meeting ID to get details for.",
37
+ async options({ prevContext }) {
38
+ const { nextPageToken } = prevContext;
39
+ const response = await this.listMeetings({
40
+ params: {
41
+ next_page_token: nextPageToken,
42
+ },
43
+ });
44
+ const options = response.meetings.map((meeting) => ({
16
45
  label: `${meeting.topic} (${meeting.id})`,
17
46
  value: meeting.id,
18
47
  }));
48
+ return {
49
+ options,
50
+ context: {
51
+ nextPageToken: response.next_page_token,
52
+ },
53
+ };
19
54
  },
20
55
  optional: true,
21
56
  },
@@ -35,65 +70,226 @@ export default {
35
70
  optional: true,
36
71
  default: false,
37
72
  },
73
+ occurrenceIds: {
74
+ type: "string",
75
+ label: "Occurrence IDs",
76
+ description: "Occurrence IDs. You can find these with the meeting get API. Multiple values separated by comma.",
77
+ optional: true,
78
+ },
79
+ email: {
80
+ type: "string",
81
+ label: "Email",
82
+ description: "A valid email address of the registrant.",
83
+ },
84
+ firstName: {
85
+ type: "string",
86
+ label: "First Name",
87
+ description: "Registrant's first name.",
88
+ },
89
+ lastName: {
90
+ type: "string",
91
+ label: "Last Name",
92
+ description: "Registrant's last name.",
93
+ },
94
+ address: {
95
+ type: "string",
96
+ label: "Address",
97
+ description: "Registrant's address.",
98
+ optional: true,
99
+ },
100
+ city: {
101
+ type: "string",
102
+ label: "City",
103
+ description: "Registrant's city.",
104
+ optional: true,
105
+ },
106
+ country: {
107
+ type: "string",
108
+ label: "Country",
109
+ description: "Registrant's country.",
110
+ optional: true,
111
+ },
112
+ zip: {
113
+ type: "string",
114
+ label: "Zip/Postal Code",
115
+ description: "Registrant's Zip/Postal code.",
116
+ optional: true,
117
+ },
118
+ state: {
119
+ type: "string",
120
+ label: "State/Province",
121
+ description: "Registrant's State/Province.",
122
+ optional: true,
123
+ },
124
+ phone: {
125
+ type: "string",
126
+ label: "Phone",
127
+ description: "Registrant's Phone number.",
128
+ optional: true,
129
+ },
130
+ industry: {
131
+ type: "string",
132
+ label: "Industry",
133
+ description: "Registrant's industry.",
134
+ optional: true,
135
+ },
136
+ org: {
137
+ type: "string",
138
+ label: "Organization",
139
+ description: "Registrant's Organization.",
140
+ optional: true,
141
+ },
142
+ jobTitle: {
143
+ type: "string",
144
+ label: "Job Title",
145
+ description: "Registrant's job title.",
146
+ optional: true,
147
+ },
148
+ purchasingTimeFrame: {
149
+ type: "string",
150
+ label: "Purchasing Time Frame",
151
+ description: "This field can be included to gauge interest of webinar attendees towards buying your product or service.",
152
+ optional: true,
153
+ },
154
+ roleInPurchaseProcess: {
155
+ type: "string",
156
+ label: "Role in Purchase Process",
157
+ description: "Role in Purchase Process.",
158
+ optional: true,
159
+ },
160
+ noOfEmployees: {
161
+ type: "string",
162
+ label: "Number of Employees",
163
+ description: "Number of Employees.",
164
+ optional: true,
165
+ },
166
+ comments: {
167
+ type: "string",
168
+ label: "Comments",
169
+ description: "A field that allows registrants to provide any questions or comments that they might have.",
170
+ optional: true,
171
+ },
172
+ customQuestions: {
173
+ type: "string",
174
+ label: "Custom Questions",
175
+ description: "Custom questions.",
176
+ optional: true,
177
+ },
178
+ nextPageToken: {
179
+ type: "string",
180
+ label: "Next Page Token",
181
+ description: "Use the next page token to paginate through large result sets. A next page token is returned whenever the set of available results exceeds the current page size. This token's expiration period is 15 minutes. Example: `IAfJX3jsOLW7w3dokmFl84zOa0MAVGyMEB2`",
182
+ optional: true,
183
+ },
184
+ max: {
185
+ type: "integer",
186
+ label: "Max Resources",
187
+ description: "The maximum number of resources to retrieve.",
188
+ optional: true,
189
+ default: constants.MAX_RESOURCES,
190
+ min: 1,
191
+ },
38
192
  },
39
193
  methods: {
40
- _baseUrl() {
41
- return "https://api.zoom.us/v2/";
194
+ _getUrl(path) {
195
+ return `${constants.BASE_URL}${constants.VERSION_PATH}${path}`;
42
196
  },
43
- _getHeaders() {
197
+ _getHeaders(headers) {
44
198
  return {
45
199
  "Authorization": `Bearer ${this.$auth.oauth_access_token}`,
46
200
  "Content-Type": "application/json",
201
+ ...headers,
47
202
  };
48
203
  },
49
- async _makeRequest(args = {}) {
50
- const {
51
- method = "GET",
52
- headers,
53
- path,
54
- $ = this,
55
- ...otherArgs
56
- } = args;
204
+ _makeRequest({
205
+ step = this, headers, path, ...args
206
+ } = {}) {
57
207
  const config = {
58
- method,
59
- headers: {
60
- ...headers,
61
- ...this._getHeaders(),
62
- },
63
- url: `${this._baseUrl()}${path}`,
64
- ...otherArgs,
208
+ headers: this._getHeaders(headers),
209
+ url: this._getUrl(path),
210
+ ...args,
65
211
  };
66
- return axios($, config);
212
+ return axios(step, config);
67
213
  },
68
- async getPastMeetingDetails(meetingId, params) {
214
+ create(args = {}) {
69
215
  return this._makeRequest({
70
- path: `past_meetings/${meetingId}`,
71
- params,
216
+ method: "post",
217
+ ...args,
72
218
  });
73
219
  },
74
- async listMeetings(params) {
220
+ getPastMeetingDetails({
221
+ meetingId, ...args
222
+ } = {}) {
75
223
  return this._makeRequest({
76
- path: "users/me/meetings",
77
- params,
224
+ path: `/past_meetings/${meetingId}`,
225
+ ...args,
78
226
  });
79
227
  },
80
- async listWebinars(params) {
228
+ listMeetings(args = {}) {
81
229
  return this._makeRequest({
82
- path: "users/me/webinars",
83
- params,
230
+ path: "/users/me/meetings",
231
+ ...args,
84
232
  });
85
233
  },
86
- async listWebinarMetrics(params) {
234
+ listWebinars({
235
+ userId = "me", ...args
236
+ } = {}) {
87
237
  return this._makeRequest({
88
- path: "metrics/webinars",
89
- params,
238
+ path: `/users/${userId}/webinars`,
239
+ ...args,
90
240
  });
91
241
  },
92
- async listRecordings(params) {
242
+ listWebinarMetrics(args = {}) {
93
243
  return this._makeRequest({
94
- path: "users/me/recordings",
95
- params,
244
+ path: "/metrics/webinars",
245
+ ...args,
96
246
  });
97
247
  },
248
+ listRecordings(args = {}) {
249
+ return this._makeRequest({
250
+ path: "/users/me/recordings",
251
+ ...args,
252
+ });
253
+ },
254
+ async *getResourcesStream({
255
+ resourceFn,
256
+ resourceFnArgs,
257
+ resourceName,
258
+ max = constants.MAX_RESOURCES,
259
+ }) {
260
+ let nextPageToken = resourceFnArgs.params?.next_page_token;
261
+ let resourcesCount = 0;
262
+
263
+ while (true) {
264
+ const response = await resourceFn({
265
+ ...resourceFnArgs,
266
+ params: {
267
+ ...resourceFnArgs.params,
268
+ next_page_token: nextPageToken,
269
+ },
270
+ });
271
+
272
+ const nextResources = response[resourceName];
273
+
274
+ if (!nextResources?.length) {
275
+ console.log("No more resources found");
276
+ return;
277
+ }
278
+
279
+ for (const resource of nextResources) {
280
+ yield resource;
281
+ resourcesCount += 1;
282
+
283
+ if (resourcesCount >= max) {
284
+ return;
285
+ }
286
+ }
287
+
288
+ nextPageToken = response.next_page_token;
289
+ if (!nextPageToken) {
290
+ return;
291
+ }
292
+ }
293
+ },
98
294
  },
99
295
  };