parent
f5516cc322
commit
aa7e3e8747
@ -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." |
||||
); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -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; |
||||
} |
@ -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"); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue