You are here

zoomapi.meeting.classes.inc in Zoom API 7

Meeting classes for Zoom API.

@todo add watchdog (info) logs.

File

includes/zoomapi.meeting.classes.inc
View source
<?php

/**
 * @file
 * Meeting classes for Zoom API.
 *
 * @see https://zoom.us/developer/overview/rest-meeting-api
 *
 * @todo add watchdog (info) logs.
 */

/**
 * Zoom API Meeting Class.
 */
class ZoomAPIMeeting extends ZoomAPI {

  /**
   * Create Meeting.
   *
   * Note: See the api documentation regarding the 'status' variable values in
   * the response. Also notes how to pass the user name in the join URL to
   * bypass the username dialog.
   *
   * @param string $host_zoom_user_id
   *   The zoom user ID of the meeting host.
   * @param string $topic
   *   The meeting topic. Max 300 chars.
   * @param int $type
   *   The type of meeting:
   *   - 1: Instant meeting.
   *   - 2: Normal scheduled meeting (default).
   *   - 3: Recurring meeting with no fixed time.
   *   - 8: Recurring meeting with fixed time.
   * @param array $options
   *   An array of optional meeting options.
   *
   * @return array
   *   An array of the meeting.
   */
  public function create($host_zoom_user_id, $topic, $type = 2, $options = []) {
    $options['host_id'] = $host_zoom_user_id;
    $options['topic'] = substr($topic, 0, 300);
    $options['type'] = $type;
    return $this
      ->sendRequest('meeting/create', $options);
  }

  /**
   * Delete Meeting.
   *
   * @param string $meeting_id
   *   The zoom provided meeting ID.
   * @param string $host_zoom_user_id
   *   The zoom user ID of the meeting host.
   * @param string $occurrence_id
   *   Optional meeting occurrence ID for use with recurring meetings.
   *
   * @return array
   *   An array of the transaction metadata.
   */
  public function delete($meeting_id, $host_zoom_user_id, $occurrence_id = NULL) {
    $data = [
      'id' => $meeting_id,
      'host_id' => $host_zoom_user_id,
    ];
    if ($occurrence_id) {
      $data['occurrence'] = $occurrence_id;
    }
    return $this
      ->sendRequest('meeting/delete', $data);
  }

  /**
   * List Meetings.
   *
   * @param string $host_zoom_user_id
   *   The host user ID.
   * @param int $page_size
   *   Number of results per page.
   * @param int $page_number
   *   The page number to return.
   *
   * @return array
   *   An array of meetings.
   *
   * @todo the use of the host ID makes this seem like a user specific list.
   * Need to check how to get a list of all meetings. API docs says this does
   * not include instant meetings either.
   */
  public function list($host_zoom_user_id, $page_size = 30, $page_number = 1) {
    $data = [
      'host_id' => $host_zoom_user_id,
      'page_size' => $page_size,
      'page_number' => $page_number,
    ];
    return $this
      ->sendRequest('meeting/list', $data);
  }

  /**
   * List Live Meetings.
   *
   * @param int $page_size
   *   Number of results per page.
   * @param int $page_number
   *   The page number to return.
   *
   * @return array
   *   An array of meetings.
   */
  public function live($page_size = 30, $page_number = 1) {
    $data = [
      'page_size' => $page_size,
      'page_number' => $page_number,
    ];
    return $this
      ->sendRequest('meeting/live', $data);
  }

  /**
   * Get Meeting Info.
   *
   * @param string $meeting_id
   *   The zoom generated meeting ID.
   * @param string $host_zoom_user_id
   *   The host user ID.
   *
   * @return array
   *   An array containing the meeting details.
   */
  public function get($meeting_id, $host_zoom_user_id) {
    $data = [
      'id' => $meeting_id,
      'host_id' => $host_zoom_user_id,
    ];
    return $this
      ->sendRequest('meeting/get', $data);
  }

  /**
   * Update Meeting.
   *
   * @param string $meeting_id
   *   The zoom generated meeting ID.
   * @param string $host_zoom_user_id
   *   The host user ID.
   * @param array $options
   *   Optional meeting configuration.
   *
   * @return array
   *   An array containing the transaction details.
   */
  public function update($meeting_id, $host_zoom_user_id, $options = []) {
    $options['id'] = $meeting_id;
    $options['host_id'] = $host_zoom_user_id;
    return $this
      ->sendRequest('meeting/get', $options);
  }

}

Classes

Namesort descending Description
ZoomAPIMeeting Zoom API Meeting Class.