Skip to content

getAllMembers

Matthew Grist edited this page Nov 14, 2022 · 4 revisions

getAllMembers() - version 1.0.0

The getAllMembers method is used to return the whole list of members within the ACM Chapter. This method does not include any API calls to the ACM server, so it quickly returns the entire member list that was last retrieved. This is used when you need to retrieve the whole list of members in a timely manner.

About

  • Input Parameters: none.
  • Return Type: object[] - on success, the updated member list is returned in an array of objects, and on failure an error message.
  • Async: no.
  • Important Note: this method cannot be called before the login method.

Example

const Chapter = require("acm-roster");

async function main() {
    const client = new Chapter();
    var memberList = [];
    try {
      // log in to ACM client
      await client.login("username", "password");

      // fetch chapter members, store in variable
      memberList = await client.getAllMembers();
    } catch (err) {
      console.log("-- Critical --");
      throw err;
    }
}

main()