Zoom plugin creates native API objects from Json - refs BT#17288

pull/3274/head
Sébastien Ducoulombier 5 years ago
parent f5516cc322
commit aa7e3e8747
  1. 2
      plugin/zoom/API/CreatedRegistration.php
  2. 194
      plugin/zoom/API/JWTClient.php
  3. 88
      plugin/zoom/API/JsonDeserializable.php
  4. 22
      plugin/zoom/API/Meeting.php
  5. 5
      plugin/zoom/API/MeetingInfo.php
  6. 25
      plugin/zoom/API/MeetingInfoGet.php
  7. 1
      plugin/zoom/API/MeetingInstance.php
  8. 26
      plugin/zoom/API/MeetingInstances.php
  9. 28
      plugin/zoom/API/MeetingList.php
  10. 2
      plugin/zoom/API/MeetingListItem.php
  11. 4
      plugin/zoom/API/MeetingRegistrantList.php
  12. 19
      plugin/zoom/API/MeetingSettings.php
  13. 7
      plugin/zoom/API/Pagination.php
  14. 31
      plugin/zoom/API/ParticipantList.php
  15. 71
      plugin/zoom/API/RecordingFile.php
  16. 64
      plugin/zoom/API/RecordingMeeting.php
  17. 51
      plugin/zoom/lib/zoom_plugin.class.php

@ -5,6 +5,8 @@ namespace Chamilo\PluginBundle\Zoom;
class CreatedRegistration
{
use JsonDeserializable;
/** @var int meeting ID */
public $id;

@ -46,15 +46,16 @@ class JWTClient
* On success, returns the body of the response
* On error, throws an exception with an detailed error message
*
* @param string $httpMethod GET, POST, PUT, DELETE ...
* @param string $relativeQueryString what to append to URL https://api.zoom.us/v2/
* @param object $requestBody json-encoded body of the request
* @param string $httpMethod GET, POST, PUT, DELETE ...
* @param string $relativePath to append to https://api.zoom.us/v2/
* @param array $parameters request query parameters
* @param object $requestBody json-encoded body of the request
*
* @throws Exception describing the error (message and code)
*
* @return object json-decoded body of the response
* @return string response body (not json-decoded)
*/
public function send($httpMethod, $relativeQueryString, $requestBody = null)
public function send($httpMethod, $relativePath, $parameters = [], $requestBody = null)
{
$options = [
CURLOPT_CUSTOMREQUEST => $httpMethod,
@ -76,7 +77,11 @@ class JWTClient
$options[CURLOPT_POSTFIELDS] = $jsonRequestBody;
}
$curl = curl_init("https://api.zoom.us/v2/$relativeQueryString");
$url = "https://api.zoom.us/v2/$relativePath";
if (!empty($parameters)) {
$url .= '?'.http_build_query($parameters);
}
$curl = curl_init($url);
if (false === $curl) {
throw new Exception("curl_init returned false");
}
@ -101,44 +106,7 @@ class JWTClient
throw new Exception($responseBody, $responseCode);
}
if (empty($responseBody)) {
return null;
}
$jsonDecodedResponseBody = json_decode($responseBody);
if (is_null($jsonDecodedResponseBody)) {
throw new Exception('Could not decode JSON response body');
}
return $jsonDecodedResponseBody;
}
/**
* Returns the list of Zoom user permissions.
*
* @throws Exception describing the error (message and code)
*
* @return string[] Zoom user permissions
*/
public function userPermissions()
{
return $this->send('GET', '/users/me/permissions')->permissions;
}
/**
* Retrieves a limited list of meetings.
*
* @param string $type MEETING_TYPE_SCHEDULED, MEETING_TYPE_LIVE or MEETING_TYPE_UPCOMING
* @param int $pageNumber number of the result page to be returned, starts at 1
* @param int $pageSize how many meetings can fit in one page
*
* @throws Exception describing the error (message and code)
*
* @return MeetingList|object list of meetings
*/
public function listMeetings($type, $pageNumber = 1, $pageSize = 30)
{
return $this->send('GET', "users/me/meetings?type=$type&page_size=$pageSize&page_number=$pageNumber");
return $responseBody;
}
/**
@ -150,28 +118,9 @@ class JWTClient
*
* @return MeetingListItem[] meetings
*/
public function listAllMeetings($type)
public function getMeetings($type)
{
$meetings = [];
$pageCount = 1;
$pageSize = 300;
$totalRecords = 0;
for ($pageNumber = 1; $pageNumber <= $pageCount; $pageNumber++) {
$response = $this->listMeetings($type, $pageNumber, $pageSize);
if (!is_null($response)) {
$meetings = array_merge($meetings, $response->meetings);
if (0 === $totalRecords) {
$pageCount = $response->page_count;
$pageSize = $response->page_size;
$totalRecords = $response->total_records;
}
}
}
if (count($meetings) !== $totalRecords) {
error_log('Zoom announced '.$totalRecords.' records but returned '.count($meetings));
}
return $meetings;
return $this->getFullList("users/me/meetings", MeetingList::class, 'meetings');
}
/**
@ -181,11 +130,11 @@ class JWTClient
*
* @throws Exception describing the error (message and code)
*
* @return MeetingInstances|object list of meeting instances
* @return MeetingInstance[] list of meeting instances
*/
public function listEndedMeetingInstances($meetingId)
public function getEndedMeetingInstances($meetingId)
{
return $this->send('GET', "past_meetings/$meetingId/instances");
return MeetingInstances::fromJson($this->send('GET', "past_meetings/$meetingId/instances"))->meetings;
}
/**
@ -195,11 +144,11 @@ class JWTClient
*
* @throws Exception describing the error (message and code)
*
* @return Meeting|object meeting
* @return MeetingInfoGet meeting
*/
public function createMeeting($meeting)
{
return $this->send('POST', 'users/me/meetings', $meeting);
return MeetingInfoGet::fromJson($this->send('POST', 'users/me/meetings', [], $meeting));
}
/**
@ -209,11 +158,11 @@ class JWTClient
*
* @throws Exception describing the error (message and code)
*
* @return Meeting|object meeting
* @return Meeting meeting
*/
public function getMeeting($meetingId)
{
return $this->send('GET', 'meetings/'.$meetingId);
return MeetingInfoGet::fromJson($this->send('GET', 'meetings/'.$meetingId));
}
/**
@ -226,7 +175,7 @@ class JWTClient
*/
public function updateMeeting($meetingId, $meeting)
{
$this->send('PATCH', 'meetings/'.$meetingId, $meeting);
$this->send('PATCH', 'meetings/'.$meetingId, [], $meeting);
}
/**
@ -238,7 +187,7 @@ class JWTClient
*/
public function endMeeting($meetingId)
{
$this->send('PUT', "meetings/$meetingId/status", (object) ['action' => 'end']);
$this->send('PUT', "meetings/$meetingId/status", [], (object) ['action' => 'end']);
}
/**
@ -262,26 +211,34 @@ class JWTClient
*
* @throws Exception describing the error (message and code)
*
* @return CreatedRegistration|object with unique join_url and registrant_id properties
* @return CreatedRegistration with unique join_url and registrant_id properties
*/
public function addMeetingRegistrant($meetingId, $registrant, $occurrenceIds = '')
public function addRegistrant($meetingId, $registrant, $occurrenceIds = '')
{
$path = 'meetings/'.$meetingId.'/registrants';
if (!empty($occurrenceIds)) {
$path .= "?occurrence_ids=$occurrenceIds";
}
return $this->send('POST', $path, $registrant);
return CreatedRegistration::fromJson($this->send('POST', $path, [], $registrant));
}
/**
* List meeting registrants.
*
* @param int $meetingId
*
* @throws Exception
*
* @return MeetingRegistrantListItem[] the meeting registrants
*/
public function listMeetingRegistrants($meetingId)
public function getRegistrants($meetingId)
{
// TODO "/meetings/$meetingId/registrants";
return $this->getFullList(
"meetings/$meetingId/registrants",
MeetingRegistrantList::class,
'registrants'
);
}
/**
@ -291,80 +248,90 @@ class JWTClient
*
* @throws Exception describing the error (message and code)
*
* @return PastMeeting|object meeting
* @return PastMeeting meeting
*/
public function getPastMeetingDetails($meetingUUID)
{
return $this->send('GET', 'past_meetings/'.$meetingUUID);
return PastMeeting::fromJson($this->send('GET', 'past_meetings/'.$meetingUUID));
}
/**
* Gets all the recordings from a meeting.
* The recording files can be downloaded via the `download_url` property listed in the response.
* Gets the recordings from a meeting.
*
* @param $meetingUUID
* @param string $meetingUUID
*
* @throws Exception describing the error (message and code)
*
* @return object an object with string property 'share_url' and array property 'recording_files'
* @return RecordingMeeting the recordings for this meeting
*/
public function listRecordings($meetingUUID)
public function getRecordings($meetingUUID)
{
return $this->send('GET', 'meetings/'.$this->doubleEncode($meetingUUID).'/recordings');
return RecordingMeeting::fromJson(
$this->send(
'GET',
'meetings/'.$this->doubleEncode($meetingUUID).'/recordings'
)
);
}
/**
* Retrieves information on participants from a past meeting.
*
* @param string $meetingUUID the meeting instance UUID
* @param int $pageNumber
* @param int $pageSize
*
* @throws Exception describing the error (message and code)
*
* @return ParticipantList|object
* @return ParticipantListItem[] participants
*/
public function getParticipants($meetingUUID, $pageNumber = 1, $pageSize = 30)
public function getParticipants($meetingUUID)
{
return $this->send(
'GET',
'past_meetings/'.$this->doubleEncode(
$meetingUUID
)."/participants?page_size=$pageSize&page_number=$pageNumber"
return $this->getFullList(
'past_meetings/'.$this->doubleEncode($meetingUUID).'/participants',
ParticipantList::class,
'participants'
);
}
/**
* Gets a full list of participants.
* Retrieves a full list of items using one or more API calls to the Zoom server
*
* @param string $meetingUUID the meeting instance UUID
* @param string $relativePath @see self::send
* @param string $listClassName name of the API's list class, such as 'MeetingList'
* @param string $arrayPropertyName name of the class property that contains the actual items, such as 'meetings'
*
* @throws Exception describing the error (message and code)
* @throws Exception on API, JSON or other error
*
* @return ParticipantListItem[] participants
* @return array whose items are expected API class instances, such as MeetingListItems
*/
public function getAllParticipants($meetingUUID)
private function getFullList($relativePath, $listClassName, $arrayPropertyName)
{
$participants = [];
$items = [];
$pageCount = 1;
$pageSize = 300;
$totalRecords = 0;
for ($pageNumber = 1; $pageNumber <= $pageCount; $pageNumber++) {
$response = $this->getParticipants($meetingUUID, $pageNumber, $pageSize);
if (!is_null($response)) {
$participants = array_merge($participants, $response->participants);
if (0 === $totalRecords) {
$pageCount = $response->page_count;
$pageSize = $response->page_size;
$totalRecords = $response->total_records;
}
$response = $listClassName::fromJson(
$this->send(
'GET',
$relativePath,
[
'page_size' => $pageSize,
'page_number' => $pageNumber,
]
)
);
$items = array_merge($items, $response->$arrayPropertyName);
if (0 === $totalRecords) {
$pageCount = $response->page_count;
$pageSize = $response->page_size;
$totalRecords = $response->total_records;
}
}
if (count($participants) !== $totalRecords) {
error_log('Zoom announced '.$totalRecords.' records but returned '.count($participants));
if (count($items) !== $totalRecords) {
error_log('Zoom announced '.$totalRecords.' records but returned '.count($items));
}
return $participants;
return $items;
}
/**
@ -379,5 +346,4 @@ class JWTClient
{
return htmlentities($string, ENT_COMPAT, 'utf-8', true);
}
}

@ -0,0 +1,88 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\Zoom;
use Exception;
trait JsonDeserializable
{
/**
* Builds a class instance from the Json description of the object
*
* @param string $json
*
* @throws Exception on JSON-decode error or unexpected object property
*
* @return static
*/
public static function fromJson($json)
{
if (empty($json)) {
throw new Exception('Cannot JSON-decode empty string');
}
$object = json_decode($json);
if (is_null($object)) {
throw new Exception('Could not decode JSON: '.$json);
}
$instance = new static();
self::recursivelyCopyObjectProperties($object, $instance);
return $instance;
}
/**
* Returns the class name of the items to be found in the named array property
*
* To override in classes that have a property of type array
*
* @param string $propertyName array property name
* @throws Exception if not implemented for this propertyName
*/
protected function itemClass($propertyName)
{
throw new Exception(__FUNCTION__.' not implemented for property '.$propertyName.' in class '.static::class);
}
/**
* Copies values from another object properties to an instance, recursively
*
* @param object $source source object
* @param object $destination specific class instance, with already initialized properties
*
* @throws Exception when the source object has an unexpected property
*/
private static function recursivelyCopyObjectProperties($source, &$destination)
{
foreach (get_object_vars($source) as $name => $value) {
if (property_exists($destination, $name)) {
if (is_object($value)) {
if (is_object($destination->$name)) {
self::recursivelyCopyObjectProperties($value, $destination->$name);
} else {
throw new Exception("Source property $name is an object, which is not expected");
}
} elseif (is_array($value)) {
if (is_array($destination->$name)) {
foreach ($value as $sourceItem) {
$itemClass = $destination->itemClass($name);
$item = new $itemClass;
self::recursivelyCopyObjectProperties($sourceItem, $item);
$destination->$name[] = $item;
}
} else {
throw new Exception("Source property $name is an array, which is not expected");
}
} else {
$destination->$name = $value;
}
} else {
throw new Exception(
"Source object has property $name, which was not expected."
);
}
}
}
}

@ -5,6 +5,8 @@ namespace Chamilo\PluginBundle\Zoom;
class Meeting
{
use JsonDeserializable;
const TYPE_INSTANT = 1;
const TYPE_SCHEDULED = 2;
const TYPE_RECURRING_WITH_NO_FIXED_TIME = 3;
@ -42,15 +44,23 @@ class Meeting
/**
* Meeting constructor.
*
* @param string $topic
* @param int $type
*/
public function __construct($topic, $type = self::TYPE_SCHEDULED)
protected function __construct()
{
$this->topic = $topic;
$this->type = $type;
$this->tracking_fields = [];
$this->settings = new MeetingSettings();
}
/**
* @param string $topic
* @param int $type
* @return static
*/
public static function fromTopicAndType($topic, $type = self::TYPE_SCHEDULED)
{
$instance = new static();
$instance->topic = $topic;
$instance->type = $type;
return $instance;
}
}

@ -7,14 +7,19 @@ class MeetingInfo extends Meeting
{
/** @var string */
public $created_at;
/** @var string, allows host to start the meeting as the host (without password) - not to be shared */
public $start_url;
/** @var string, for participants to join the meeting - to share with users to invite */
public $join_url;
/** @var string H.323/SIP room system password */
public $h323_password;
/** @var int Personal Meeting Id. Only used for scheduled meetings and recurring meetings with no fixed time */
public $pmi;
/** @var object[] */
public $occurrences;
}

@ -0,0 +1,25 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\Zoom;
class MeetingInfoGet extends MeetingInfo
{
/** @var string unique meeting instance ID */
public $uuid;
/** @var string meeting number */
public $id;
/** @var string host Zoom user id */
public $host_id;
/** @var string meeting status, either "waiting", "started" or "finished" */
public $status;
/** @var string undocumented */
public $pstn_password;
/** @var string Encrypted password for third party endpoints (H323/SIP). */
public $encrypted_password;
}

@ -7,6 +7,7 @@ class MeetingInstance
{
/** @var string */
public $uuid;
/** @var string */
public $start_time;
}

@ -3,8 +3,34 @@
namespace Chamilo\PluginBundle\Zoom;
use Exception;
class MeetingInstances
{
use JsonDeserializable;
/** @var MeetingInstance[] List of ended meeting instances. */
public $meetings;
/**
* MeetingInstances constructor.
*/
public function __construct()
{
$this->meetings = [];
}
/**
* @see JsonDeserializable::itemClass()
*
* @param string $propertyName array property name
* @throws Exception on wrong propertyName
*/
protected function itemClass($propertyName)
{
if ('meetings' === $propertyName) {
return MeetingInstance::class;
}
throw new Exception("No such array property $propertyName");
}
}

@ -3,8 +3,34 @@
namespace Chamilo\PluginBundle\Zoom;
class MeetingList extends Pagination
use Exception;
class MeetingList
{
use Pagination;
/** @var MeetingListItem[] */
public $meetings;
/**
* MeetingList constructor.
*/
public function __construct()
{
$this->meetings = [];
}
/**
* @see JsonDeserializable::itemClass()
*
* @param string $propertyName array property name
* @throws Exception on wrong propertyName
*/
protected function itemClass($propertyName)
{
if ('meetings' === $propertyName) {
return MeetingListItem::class;
}
throw new Exception("No such array property $propertyName");
}
}

@ -5,6 +5,8 @@ namespace Chamilo\PluginBundle\Zoom;
class MeetingListItem
{
use JsonDeserializable;
/** @var string unique meeting instance ID */
public $uuid;

@ -3,8 +3,10 @@
namespace Chamilo\PluginBundle\Zoom;
class MeetingRegistrantList extends Pagination
class MeetingRegistrantList
{
use Pagination;
/** @var MeetingRegistrantListItem[] */
public $registrants;
}

@ -56,6 +56,12 @@ class MeetingSettings
/** @var string either local, cloud or none */
public $auto_recording;
/** @var boolean @deprecated only signed in users can join this meeting */
public $enforce_login;
/** @var string @deprecated only signed in users with specified domains can join meetings */
public $enforce_login_domains;
/** @var string Alternative host's emails or IDs: multiple values separated by a comma. */
public $alternative_hosts;
@ -100,4 +106,17 @@ class MeetingSettings
* @see https://support.zoom.us/hc/en-us/articles/360037117472-Authentication-Profiles-for-Meetings-and-Webinars#h_5c0df2e1-cfd2-469f-bb4a-c77d7c0cca6f
*/
public $authentication_name;
/**
* MeetingSettings constructor.
*/
public function __construct()
{
$this->approval_type = self::APPROVAL_TYPE_NO_REGISTRATION_REQUIRED;
$this->audio = 'voip';
$this->auto_recording = 'none';
$this->registrants_confirmation_email = 1;
$this->waiting_room = 1;
$this->registrants_email_notification = 1;
}
}

@ -3,14 +3,19 @@
namespace Chamilo\PluginBundle\Zoom;
class Pagination
trait Pagination
{
use JsonDeserializable;
/** @var int */
public $page_count;
/** @var int counting from 1 */
public $page_number;
/** @var int */
public $page_size;
/** @var int */
public $total_records;
}

@ -3,8 +3,35 @@
namespace Chamilo\PluginBundle\Zoom;
class ParticipantList extends Pagination
use Exception;
class ParticipantList
{
/** @var Participant[] */
use Pagination;
/** @var ParticipantListItem[] */
public $participants;
/**
* ParticipantList constructor.
*/
public function __construct()
{
$this->participants = [];
}
/**
* @see JsonDeserializable::itemClass()
*
* @param string $propertyName array property name
* @throws Exception on wrong propertyName
*/
protected function itemClass($propertyName)
{
if ('participants' === $propertyName) {
return ParticipantListItem::class;
}
throw new Exception("No such array property $propertyName");
}
}

@ -0,0 +1,71 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\Zoom;
class RecordingFile
{
use JsonDeserializable;
/** @var string The recording file ID. Included in the response of general query. */
public $id;
/** @var string The meeting ID. */
public $meeting_id;
/** @var string The recording start time. */
public $recording_start;
/** @var string The recording end time. Response in general query. */
public $recording_end;
/** @var string The recording file type. The value of this field could be one of the following:<br>
* `MP4`: Video file of the recording.<br>
* `M4A` Audio-only file of the recording.<br>
* `TIMELINE`: Timestamp file of the recording.
* To get a timeline file, the "Add a timestamp to the recording" setting must be enabled in the recording settings
* (https://support.zoom.us/hc/en-us/articles/203741855-Cloud-recording#h_3f14c3a4-d16b-4a3c-bbe5-ef7d24500048).
* The time will display in the host's timezone, set on their Zoom profile.
* `TRANSCRIPT`: Transcription file of the recording.
* `CHAT`: A TXT file containing in-meeting chat messages that were sent during the meeting.
* `CC`: File containing closed captions of the recording.
* A recording file object with file type of either `CC` or `TIMELINE` **does not have** the following properties:
* `id`, `status`, `file_size`, `recording_type`, and `play_url`.
*/
public $file_type;
/** @var int The recording file size. */
public $file_size;
/** @var string The URL using which a recording file can be played. */
public $play_url;
/** @var string The URL using which the recording file can be downloaded.
* To access a private or password protected cloud recording, you must use a [Zoom JWT App Type]
* (https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-jwt-app).
* Use the generated JWT token as the value of the `access_token` query parameter
* and include this query parameter at the end of the URL as shown in the example.
* Example: `https://api.zoom.us/recording/download/{{ Download Path }}?access_token={{ JWT Token }}`
*/
public $download_url;
/** @var string The recording status. "completed". */
public $status;
/** @var string The time at which recording was deleted. Returned in the response only for trash query. */
public $deleted_time;
/** @var string The recording type. The value of this field can be one of the following:
* `shared_screen_with_speaker_view(CC)`
* `shared_screen_with_speaker_view`
* `shared_screen_with_gallery_view`
* `speaker_view`
* `gallery_view`
* `shared_screen`
* `audio_only`
* `audio_transcript`
* `chat_file`
* `TIMELINE`
*/
public $recording_type;
}

@ -0,0 +1,64 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PluginBundle\Zoom;
use Exception;
class RecordingMeeting
{
use JsonDeserializable;
/** @var string Unique Meeting Identifier. Each instance of the meeting will have its own UUID. */
public $uuid;
/** @var string Meeting ID - also known as the meeting number. */
public $id;
/** @var string Unique Identifier of the user account. */
public $account_id;
/** @var string ID of the user set as host of meeting. */
public $host_id;
/** @var string Meeting topic. */
public $topic;
/** @var string The time at which the meeting started. */
public $start_time;
/** @var int Meeting duration. */
public $duration;
/** @var string Total size of the recording. */
public $total_size;
/** @var string Number of recording files returned in the response of this API call. */
public $recording_count;
/** @var RecordingFile[] List of recording file. */
public $recording_files;
/**
* RecordingMeeting constructor.
*/
protected function __construct()
{
$this->recording_files = [];
}
/**
* @see JsonDeserializable::itemClass()
*
* @param string $propertyName array property name
* @throws Exception on wrong propertyName
*/
protected function itemClass($propertyName)
{
if ('recording_files' === $propertyName) {
return RecordingFile::class;
}
throw new Exception("No such array property $propertyName");
}
}

@ -4,8 +4,10 @@
use Chamilo\PluginBundle\Zoom\JWTClient;
use Chamilo\PluginBundle\Zoom\Meeting;
use Chamilo\PluginBundle\Zoom\MeetingInfoGet;
use Chamilo\PluginBundle\Zoom\MeetingListItem;
use Chamilo\PluginBundle\Zoom\ParticipantListItem;
use Chamilo\PluginBundle\Zoom\RecordingMeeting;
class ZoomPlugin extends Plugin
{
@ -70,7 +72,7 @@ class ZoomPlugin extends Plugin
public function getPeriodMeetings($type, $startDate, $endDate)
{
$matchingMeetings = [];
foreach ($this->jwtClient()->listAllMeetings($type) as $meeting) {
foreach ($this->jwtClient()->getMeetings($type) as $meeting) {
if (property_exists($meeting, 'start_time')) {
$startTime = new DateTime($meeting->start_time);
if ($startDate <= $startTime && $startTime <= $endDate) {
@ -144,7 +146,7 @@ class ZoomPlugin extends Plugin
*
* @throws Exception describing the error (message and code)
*
* @return Meeting|object meeting
* @return MeetingInfoGet meeting
*/
public function createInstantMeeting()
{
@ -156,8 +158,9 @@ class ZoomPlugin extends Plugin
}
$courseInfo = api_get_course_info();
$topic .= $courseInfo['title'].', '.date('yy-m-d H:i');
$meeting = Meeting::fromTopicAndType($topic, Meeting::TYPE_INSTANT);
return $this->createMeeting(new Meeting(Meeting::TYPE_INSTANT), $topic, '', '');
return $this->createMeeting($meeting);
}
/**
@ -171,15 +174,17 @@ class ZoomPlugin extends Plugin
*
* @throws Exception describing the error (message and code)
*
* @return Meeting|object meeting
* @return MeetingInfoGet meeting
*/
public function createScheduledMeeting($startTime, $duration, $topic, $agenda = '', $password = '')
{
$meeting = new Meeting(Meeting::TYPE_SCHEDULED);
$meeting = Meeting::fromTopicAndType($topic, Meeting::TYPE_SCHEDULED);
$meeting->duration = $duration;
$meeting->start_time = $startTime->format(DateTimeInterface::ISO8601);
$meeting->agenda = $agenda;
$meeting->password = $password;
return $this->createMeeting($meeting, $topic, $agenda, $password);
return $this->createMeeting($meeting);
}
/**
@ -221,23 +226,23 @@ class ZoomPlugin extends Plugin
}
/**
* @see JWTClient::listRecordings()
* @see JWTClient::getRecordings()
*
* @param $meetingUUID
* @param string $meetingUUID
*
* @throws Exception on API error
* @return RecordingMeeting the recordings of the meeting
*
* @return object
* @throws Exception on API error
*/
public function getRecordings($meetingUUID)
{
return $this->jwtClient()->listRecordings($meetingUUID);
return $this->jwtClient()->getRecordings($meetingUUID);
}
/**
* @see JWTClient::getAllParticipants()
* @see JWTClient::getParticipants()
*
* @param $meetingUUID
* @param string $meetingUUID
*
* @throws Exception
*
@ -245,7 +250,7 @@ class ZoomPlugin extends Plugin
*/
public function getParticipants($meetingUUID)
{
return $this->jwtClient()->getAllParticipants($meetingUUID);
return $this->jwtClient()->getParticipants($meetingUUID);
}
/**
@ -259,7 +264,7 @@ class ZoomPlugin extends Plugin
*/
public function copyRecordingToLinkTool($meetingUUID)
{
$recordings = $this->jwtClient()->listRecordings($meetingUUID);
$recordings = $this->jwtClient()->getRecordings($meetingUUID);
$link = new Link();
$link->save(
[
@ -320,7 +325,7 @@ class ZoomPlugin extends Plugin
{
$matchingMeetings = [];
$tag = $this->agendaTag();
foreach ($this->jwtClient()->listAllMeetings($type) as $meeting) {
foreach ($this->jwtClient()->getMeetings($type) as $meeting) {
if (property_exists($meeting, 'agenda') && substr($meeting->agenda, -strlen($tag)) === $tag) {
$matchingMeetings[] = $meeting;
}
@ -332,7 +337,7 @@ class ZoomPlugin extends Plugin
/**
* Computes and append extra data for each listed meeting.
*
* @param MeetingListItem[] $meetings list of retreived meeting objects
* @param MeetingListItem[] $meetings list of retrieved meetings
*
* @throws Exception on API error
*
@ -373,20 +378,14 @@ class ZoomPlugin extends Plugin
/**
* Creates a meeting and returns it.
*
* @param Meeting $meeting a meeting with at least a type.
* @param string $topic short title of the meeting, required
* @param string $agenda ordre du jour
* @param string $password meeting password
* @param Meeting $meeting a meeting with at least a type and a topic
*
* @throws Exception describing the error (message and code)
*
* @return Meeting|object meeting
* @return MeetingInfoGet meeting
*/
private function createMeeting($meeting, $topic, $agenda, $password)
private function createMeeting($meeting)
{
$meeting->topic = $topic;
$meeting->agenda = $agenda;
$meeting->password = $password;
$meeting->settings->auto_recording = 'cloud';
$meeting->agenda .= $this->agendaTag();

Loading…
Cancel
Save