Skip to content

Commit

Permalink
Update to api version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Auditor committed Jan 3, 2019
1 parent 3711605 commit 6ef9d85
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/BigBlueButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class BigBlueButton
* @var string
* A version string.
*/
const VERSION = '0.5.0';
const VERSION = '0.6.0';

/**
* The BigBlueButton API version.
*
* @var string
* A version string.
*/
const API_VERSION = '0.9';
const API_VERSION = '1.0';

/**
* The BigBlueButton server object.
Expand Down
36 changes: 33 additions & 3 deletions src/BigBlueButton/Member/Meeting.php
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ private function getInfo()
{
$options = [
'meetingID' => $this->meetingID,
'password' => $this->moderatorPW,
'password' => $this->attendeePW,
];
$response = $this->client->get('getMeetingInfo', $options);
foreach ($response as $key => $value) {
Expand Down Expand Up @@ -1203,7 +1203,7 @@ private function getInfo()
*/
public function getRecording($recordingID)
{
$recordings = $this->getRecordings();
$recordings = $this->getRecordings([$recordingID]);
if (isset($recordings[$recordingID])) {
return $recordings[$recordingID];
}
Expand All @@ -1215,16 +1215,46 @@ public function getRecording($recordingID)
*
* Retrieves the recordings that are available for playback.
*
* @param string[] $recordIds
* A record ID for get the recordings. It can be a set of recordIDs separate by commas. If the record ID is not
* specified, it will use meeting ID as the main criteria. If neither the meeting ID is specified, it will get ALL
* the recordings. The recordID can also be used as a wildcard by including only the first characters in the
* string.
*
* @param string[] $states
* Since version 1.0 the recording has an attribute that shows a state that Indicates if the recording is
* [processing|processed|published|unpublished|deleted]. The parameter state can be used to filter results. It can
* be a set of states separate by commas. If it is not specified only the states [published|unpublished] are
* considered (same as in previous versions). If it is specified as “any”, recordings in all states are included.
*
* @param string[] $meta
* You can pass one or more metadata values to filter the recordings returned. The format of these parameters is
* the same as the metadata passed to the create call. For more information see the docs for the create call.
* http://docs.bigbluebutton.org/dev/api.html#create
*
* @return array
* An array of \sanduhrs\BigBlueButton\Recording.
*
* @throws \sanduhrs\BigBlueButton\Exception\BigBlueButtonException
*/
public function getRecordings()
public function getRecordings($recordIds = [], $states = ['published', 'unpublished'], $meta = [])
{
$options = [
'meetingID' => $this->meetingID,
];

if (count($recordIds)) {
$options['recordID'] = implode(',', $recordIds);
}

if (count($states)) {
$options['state'] = implode(',', $states);
}

if (count($meta)) {
$options['meta'] = implode(',', $recordIds);
}

$response = $this->client->get('getRecordings', $options);

$recordings = [];
Expand Down
45 changes: 42 additions & 3 deletions src/BigBlueButton/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public function getMeetings()
*/
public function getRecording($recordingID)
{
$recordings = $this->getRecordings();
$recordings = $this->getRecordings([], [$recordingID]);
if (isset($recordings[$recordingID])) {
return $recordings[$recordingID];
}
Expand All @@ -241,15 +241,54 @@ public function getRecording($recordingID)
*
* Retrieves the recordings that are available for playback.
*
* @param string[] $meetingIds
* A meeting ID for get the recordings. It can be a set of meetingIDs separate by commas. If the meeting ID is not
* specified, it will get ALL the recordings. If a recordID is specified, the meetingID is ignored.
*
* @param string[] $recordIds
* A record ID for get the recordings. It can be a set of recordIDs separate by commas. If the record ID is not
* specified, it will use meeting ID as the main criteria. If neither the meeting ID is specified, it will get ALL
* the recordings. The recordID can also be used as a wildcard by including only the first characters in the
* string.
*
* @param string[] $states
* Since version 1.0 the recording has an attribute that shows a state that Indicates if the recording is
* [processing|processed|published|unpublished|deleted]. The parameter state can be used to filter results. It can
* be a set of states separate by commas. If it is not specified only the states [published|unpublished] are
* considered (same as in previous versions). If it is specified as “any”, recordings in all states are included.
*
* @param string[] $meta
* You can pass one or more metadata values to filter the recordings returned. The format of these parameters is
* the same as the metadata passed to the create call. For more information see the docs for the create call.
* http://docs.bigbluebutton.org/dev/api.html#create
*
* @return array
* An array of \sanduhrs\BigBlueButton\Member\Recording.
*
* @throws \sanduhrs\BigBlueButton\Exception\BigBlueButtonException
*/
public function getRecordings()
public function getRecordings($meetingIds = [], $recordIds = [], $states = ['published', 'unpublished'], $meta = [])
{
$recordings = [];
$response = $this->client->get('getRecordings');
$options = [];

if (count($meetingIds)) {
$options['meetingID'] = implode(',', $meetingIds);
}

if (count($recordIds)) {
$options['recordID'] = implode(',', $recordIds);
}

if (count($states)) {
$options['state'] = implode(',', $states);
}

if (count($meta)) {
$options['meta'] = implode(',', $recordIds);
}

$response = $this->client->get('getRecordings', $options);

// No meetings were found on this server.
if (!isset($response->recordings->recording)) {
Expand Down

0 comments on commit 6ef9d85

Please sign in to comment.