2.1.1 • Published 1 year ago

@illustrative-mathematics/zoom-node v2.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Zoom Node.js Library

The Zoom Node.js library provides convenient access to Zoom's Meeting API. This client library assumes usage of the Server-to-Server OAuth authentication flow.

Note: This library is a work-in-progress and does not exhaustively cover the API. Additionally, it's only been used in production with Node.js version 16.15.1.

Documentation

This library is based on the Zoom Meeting API 2.0.0 REST API. More details can be found there.

This library's API can be found here.

Installation

Install via npm:

npm install @illustrative-mathematics/zoom-node

Requirements

This library uses ES6 modules and has only been tested with Node.js version 16.15.1. Be sure to set the type property in package.json to "module" to use this module:

 {
   "name": "my-zoom-app",
+  "type": "module",
   "version": "1.0.0",
   "description": "",
   "main": "index.js",

Usage

Initialize client:

import Zoom from "@illustrative-mathematics/zoom-node";

// Provide your unique values here.
const client = new Zoom({
  accountId: "xxxxx",
  clientId: "xxxxx",
  clientSecret: "xxxxx",
});

This library attempts to mirror the namespacing used in the Zoom API documentation. For example, Meetings is a separate section, so this library nests methods under meetings in the client instance. To fetch a specific meeting:

const meetingId = 12345;
// Use `client` instance from initialization above.
const data = await client.meetings.getAMeeting(meetingId);
console.log(data);

Endpoints with list/collection responses behave similarly. To fetch a list of participants using Dashboards:

const meetingId = 12345;
// Use `client` instance from initialization above.
const response = await client.dashboards.listMeetingParticipants(meetingId, {
  type: "past",
});
console.log(data.participants);

The above example demonstrates passing query string arguments.

Pagination

This library offers a couple ways to paginate endpoints with list/collection responses. To manually paginate Dashboards participants:

const meetingId = 12345;
// Use `client` instance from initialization above.
const firstPage = await client.dashboards.listMeetingParticipants(meetingId, {
  type: "past",
});
console.log(firstPage.participants);

const nextPage = await client.dashboards.listMeetingParticipants(meetingId, {
  type: "past",
  // Use `firstPage` token provided by Zoom to fetch next page.
  next_page_token: firstPage.next_page_token,
});
console.log(nextPage.participants);

List/collection items can also be paginated without manually refetching the endpoint using the for await...of statement:

const meetingId = 12345;
// Use `client` instance from initialization above.
for await (const participant of client.dashboards.listMeetingParticipants(
  meetingId,
  {
    type: "past",
  }
)) {
  // Note that this is an individual item in the list/collection response.
  console.log(participant);
}

Similarly, this can also be done for individual pages:

const meetingId = 12345;
// Use `client` instance from initialization above.
for await (const page of client.dashboards
  .listMeetingParticipants(meetingId, {
    type: "past",
  })
  .pages()) {
  // <-- Note the `.pages` call here.
  // Note that this is a page of items.
  console.log(page.participants);
}

There is also a nextPage helper:

const meetingId = 12345;
// Use `client` instance from initialization above.
const pager = client.dashboards.listMeetingParticipants(meetingId, {
  type: "past",
});
while (true) {
  const page = await pager.nextPage();
  if (!page) {
    break;
  }

  console.log(page.participants);
}

License

See the LICENSE file for license rights and limitations (MIT).

2.1.1

1 year ago

2.1.0

1 year ago

2.0.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago