diff --git a/plugin/zoom/API/CreatedRegistration.php b/plugin/zoom/API/CreatedRegistration.php
index e40882ffe0..95d86010fb 100644
--- a/plugin/zoom/API/CreatedRegistration.php
+++ b/plugin/zoom/API/CreatedRegistration.php
@@ -5,6 +5,8 @@ namespace Chamilo\PluginBundle\Zoom;
class CreatedRegistration
{
+ use JsonDeserializable;
+
/** @var int meeting ID */
public $id;
diff --git a/plugin/zoom/API/JWTClient.php b/plugin/zoom/API/JWTClient.php
index c4178248f7..e06845d652 100755
--- a/plugin/zoom/API/JWTClient.php
+++ b/plugin/zoom/API/JWTClient.php
@@ -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);
}
-
}
diff --git a/plugin/zoom/API/JsonDeserializable.php b/plugin/zoom/API/JsonDeserializable.php
new file mode 100644
index 0000000000..d30a7db442
--- /dev/null
+++ b/plugin/zoom/API/JsonDeserializable.php
@@ -0,0 +1,88 @@
+ $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."
+ );
+ }
+ }
+ }
+}
diff --git a/plugin/zoom/API/Meeting.php b/plugin/zoom/API/Meeting.php
index 5b5b83978e..240443ef01 100644
--- a/plugin/zoom/API/Meeting.php
+++ b/plugin/zoom/API/Meeting.php
@@ -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;
+ }
}
diff --git a/plugin/zoom/API/MeetingInfo.php b/plugin/zoom/API/MeetingInfo.php
index 9e38839037..3f6c5b7490 100644
--- a/plugin/zoom/API/MeetingInfo.php
+++ b/plugin/zoom/API/MeetingInfo.php
@@ -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;
}
diff --git a/plugin/zoom/API/MeetingInfoGet.php b/plugin/zoom/API/MeetingInfoGet.php
new file mode 100644
index 0000000000..0860a2e73f
--- /dev/null
+++ b/plugin/zoom/API/MeetingInfoGet.php
@@ -0,0 +1,25 @@
+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");
+ }
}
diff --git a/plugin/zoom/API/MeetingList.php b/plugin/zoom/API/MeetingList.php
index 654829e9ae..68cf639cb7 100644
--- a/plugin/zoom/API/MeetingList.php
+++ b/plugin/zoom/API/MeetingList.php
@@ -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");
+ }
}
diff --git a/plugin/zoom/API/MeetingListItem.php b/plugin/zoom/API/MeetingListItem.php
index ba66f5346a..c579ca537d 100644
--- a/plugin/zoom/API/MeetingListItem.php
+++ b/plugin/zoom/API/MeetingListItem.php
@@ -5,6 +5,8 @@ namespace Chamilo\PluginBundle\Zoom;
class MeetingListItem
{
+ use JsonDeserializable;
+
/** @var string unique meeting instance ID */
public $uuid;
diff --git a/plugin/zoom/API/MeetingRegistrantList.php b/plugin/zoom/API/MeetingRegistrantList.php
index 12a42d2778..0f97dfbb1a 100644
--- a/plugin/zoom/API/MeetingRegistrantList.php
+++ b/plugin/zoom/API/MeetingRegistrantList.php
@@ -3,8 +3,10 @@
namespace Chamilo\PluginBundle\Zoom;
-class MeetingRegistrantList extends Pagination
+class MeetingRegistrantList
{
+ use Pagination;
+
/** @var MeetingRegistrantListItem[] */
public $registrants;
}
diff --git a/plugin/zoom/API/MeetingSettings.php b/plugin/zoom/API/MeetingSettings.php
index 7227e6cb52..28478bd604 100644
--- a/plugin/zoom/API/MeetingSettings.php
+++ b/plugin/zoom/API/MeetingSettings.php
@@ -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;
+ }
}
diff --git a/plugin/zoom/API/Pagination.php b/plugin/zoom/API/Pagination.php
index 69621259e3..5ea3e3693c 100644
--- a/plugin/zoom/API/Pagination.php
+++ b/plugin/zoom/API/Pagination.php
@@ -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;
}
diff --git a/plugin/zoom/API/ParticipantList.php b/plugin/zoom/API/ParticipantList.php
index 57e102c497..2741e1f4ce 100644
--- a/plugin/zoom/API/ParticipantList.php
+++ b/plugin/zoom/API/ParticipantList.php
@@ -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");
+ }
+
}
diff --git a/plugin/zoom/API/RecordingFile.php b/plugin/zoom/API/RecordingFile.php
new file mode 100644
index 0000000000..8908420416
--- /dev/null
+++ b/plugin/zoom/API/RecordingFile.php
@@ -0,0 +1,71 @@
+
+ * `MP4`: Video file of the recording.
+ * `M4A` Audio-only file of the recording.
+ * `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;
+}
diff --git a/plugin/zoom/API/RecordingMeeting.php b/plugin/zoom/API/RecordingMeeting.php
new file mode 100644
index 0000000000..c8df29fac6
--- /dev/null
+++ b/plugin/zoom/API/RecordingMeeting.php
@@ -0,0 +1,64 @@
+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");
+ }
+
+}
diff --git a/plugin/zoom/lib/zoom_plugin.class.php b/plugin/zoom/lib/zoom_plugin.class.php
index dda891684d..0b3755edf5 100755
--- a/plugin/zoom/lib/zoom_plugin.class.php
+++ b/plugin/zoom/lib/zoom_plugin.class.php
@@ -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();