mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix pagination
This commit is contained in:
@@ -1,14 +1,7 @@
|
|||||||
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
|
import {
|
||||||
|
ICredentialType,
|
||||||
const userScopes = [
|
NodePropertyTypes,
|
||||||
'meeting:read',
|
} from 'n8n-workflow';
|
||||||
'meeting:write',
|
|
||||||
'user:read',
|
|
||||||
'user:write',
|
|
||||||
'user_profile',
|
|
||||||
'webinar:read',
|
|
||||||
'webinar:write'
|
|
||||||
];
|
|
||||||
|
|
||||||
export class ZoomOAuth2Api implements ICredentialType {
|
export class ZoomOAuth2Api implements ICredentialType {
|
||||||
name = 'zoomOAuth2Api';
|
name = 'zoomOAuth2Api';
|
||||||
@@ -27,7 +20,6 @@ export class ZoomOAuth2Api implements ICredentialType {
|
|||||||
type: 'hidden' as NodePropertyTypes,
|
type: 'hidden' as NodePropertyTypes,
|
||||||
default: 'https://zoom.us/oauth/token'
|
default: 'https://zoom.us/oauth/token'
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
displayName: 'Scope',
|
displayName: 'Scope',
|
||||||
name: 'scope',
|
name: 'scope',
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export async function zoomApiRequestAllItems(
|
|||||||
// tslint:disable-line:no-any
|
// tslint:disable-line:no-any
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
|
query.page_number = 0;
|
||||||
do {
|
do {
|
||||||
responseData = await zoomApiRequest.call(
|
responseData = await zoomApiRequest.call(
|
||||||
this,
|
this,
|
||||||
@@ -83,14 +84,21 @@ export async function zoomApiRequestAllItems(
|
|||||||
body,
|
body,
|
||||||
query
|
query
|
||||||
);
|
);
|
||||||
query.page_number = responseData['page_number'];
|
query.page_number++;
|
||||||
returnData.push.apply(returnData, responseData[propertyName]);
|
returnData.push.apply(returnData, responseData[propertyName]);
|
||||||
|
// zoom free plan rate limit is 1 request/second
|
||||||
|
// TODO just wait when the plan is free
|
||||||
|
await wait();
|
||||||
} while (
|
} while (
|
||||||
responseData['page_number'] !== undefined &&
|
responseData.page_count !== responseData.page_number
|
||||||
responseData['page_number'] !== ''
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
function wait() {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(true);
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const meetingOperations = [
|
|||||||
name: 'Update',
|
name: 'Update',
|
||||||
value: 'update',
|
value: 'update',
|
||||||
description: 'Update a meeting',
|
description: 'Update a meeting',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
default: 'create',
|
default: 'create',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
@@ -69,7 +69,7 @@ export const meetingFields = [
|
|||||||
description: 'User ID or email address of user.',
|
description: 'User ID or email address of user.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -83,7 +83,7 @@ export const meetingFields = [
|
|||||||
resource: [
|
resource: [
|
||||||
'meeting',
|
'meeting',
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -209,7 +209,7 @@ export const meetingFields = [
|
|||||||
|
|
||||||
],
|
],
|
||||||
default: 2,
|
default: 2,
|
||||||
description: 'Meeting type.'
|
description: 'Meeting type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Muting before entry',
|
displayName: 'Muting before entry',
|
||||||
@@ -219,7 +219,7 @@ export const meetingFields = [
|
|||||||
description: 'Mute participants upon entry.',
|
description: 'Mute participants upon entry.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Participant Video',
|
displayName: 'Participant video',
|
||||||
name: 'participant_video',
|
name: 'participant_video',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
default: false,
|
default: false,
|
||||||
@@ -308,7 +308,7 @@ export const meetingFields = [
|
|||||||
description: 'Meeting ID.',
|
description: 'Meeting ID.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -398,13 +398,13 @@ export const meetingFields = [
|
|||||||
},
|
},
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 300
|
maxValue: 300,
|
||||||
},
|
},
|
||||||
default: 30,
|
default: 30,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -456,7 +456,7 @@ export const meetingFields = [
|
|||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
operation: [
|
operation: [
|
||||||
'delete'
|
'delete',
|
||||||
],
|
],
|
||||||
resource: [
|
resource: [
|
||||||
'meeting',
|
'meeting',
|
||||||
@@ -521,7 +521,7 @@ export const meetingFields = [
|
|||||||
description: 'Meeting ID.',
|
description: 'Meeting ID.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -667,7 +667,7 @@ export const meetingFields = [
|
|||||||
|
|
||||||
],
|
],
|
||||||
default: 2,
|
default: 2,
|
||||||
description: 'Meeting type.'
|
description: 'Meeting type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Muting before entry',
|
displayName: 'Muting before entry',
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export const meetingRegistrantFields = [
|
|||||||
description: 'First Name.',
|
description: 'First Name.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -109,7 +109,7 @@ export const meetingRegistrantFields = [
|
|||||||
resource: [
|
resource: [
|
||||||
'meetingRegistrants',
|
'meetingRegistrants',
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -202,7 +202,7 @@ export const meetingRegistrantFields = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Meeting type.'
|
description: 'Meeting type.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Role in purchase process',
|
displayName: 'Role in purchase process',
|
||||||
@@ -228,7 +228,7 @@ export const meetingRegistrantFields = [
|
|||||||
|
|
||||||
],
|
],
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Role in purchase process.'
|
description: 'Role in purchase process.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'State',
|
displayName: 'State',
|
||||||
@@ -304,13 +304,13 @@ export const meetingRegistrantFields = [
|
|||||||
},
|
},
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 300
|
maxValue: 300,
|
||||||
},
|
},
|
||||||
default: 30,
|
default: 30,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -324,7 +324,7 @@ export const meetingRegistrantFields = [
|
|||||||
resource: [
|
resource: [
|
||||||
'meetingRegistrants',
|
'meetingRegistrants',
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -412,7 +412,7 @@ export const meetingRegistrantFields = [
|
|||||||
description: `Registrant Status.`,
|
description: `Registrant Status.`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export const webinarFields = [
|
|||||||
description: 'User ID or email address of user.',
|
description: 'User ID or email address of user.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -263,7 +263,7 @@ export const webinarFields = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 5,
|
default: 5,
|
||||||
description: 'Webinar type.'
|
description: 'Webinar type.',
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
@@ -290,7 +290,7 @@ export const webinarFields = [
|
|||||||
description: 'Webinar ID.',
|
description: 'Webinar ID.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -380,7 +380,7 @@ export const webinarFields = [
|
|||||||
},
|
},
|
||||||
typeOptions: {
|
typeOptions: {
|
||||||
minValue: 1,
|
minValue: 1,
|
||||||
maxValue: 300
|
maxValue: 300,
|
||||||
},
|
},
|
||||||
default: 30,
|
default: 30,
|
||||||
description: 'How many results to return.',
|
description: 'How many results to return.',
|
||||||
@@ -397,7 +397,7 @@ export const webinarFields = [
|
|||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
operation: [
|
operation: [
|
||||||
'delete'
|
'delete',
|
||||||
],
|
],
|
||||||
resource: [
|
resource: [
|
||||||
'webinarId',
|
'webinarId',
|
||||||
@@ -456,7 +456,7 @@ export const webinarFields = [
|
|||||||
description: 'User ID or email address of user.',
|
description: 'User ID or email address of user.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional settings',
|
displayName: 'Additional fields',
|
||||||
name: 'additionalFields',
|
name: 'additionalFields',
|
||||||
type: 'collection',
|
type: 'collection',
|
||||||
placeholder: 'Add Field',
|
placeholder: 'Add Field',
|
||||||
@@ -470,7 +470,7 @@ export const webinarFields = [
|
|||||||
resource: [
|
resource: [
|
||||||
'webinar',
|
'webinar',
|
||||||
],
|
],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -203,13 +203,21 @@ export class Zoom implements INodeType {
|
|||||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings
|
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings
|
||||||
const userId = this.getNodeParameter('userId', i) as string;
|
const userId = this.getNodeParameter('userId', i) as string;
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
||||||
|
const additionalFields = this.getNodeParameter(
|
||||||
|
'additionalFields',
|
||||||
|
i
|
||||||
|
) as IDataObject;
|
||||||
|
if (additionalFields.type) {
|
||||||
|
qs.type = additionalFields.type as string;
|
||||||
|
|
||||||
|
}
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
responseData = await zoomApiRequestAllItems.call(this, 'results', 'GET', `/users/${userId}/meetings`, {}, qs);
|
responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', `/users/${userId}/meetings`, {}, qs);
|
||||||
} else {
|
} else {
|
||||||
const limit = this.getNodeParameter('limit', i) as number;
|
qs.page_size = this.getNodeParameter('limit', i) as number;;
|
||||||
qs.page_size = limit;
|
|
||||||
responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs);
|
responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/meetings`, {}, qs);
|
||||||
responseData = responseData.results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user