Api::fetch_meeting_data( int $zoom_meeting_id, string $meeting_type )
Get the Meeting by ID from Zoom and Return the Data.
Contents
Parameters
- $zoom_meeting_id
-
(int) (Required) The Zoom meeting id.
- $meeting_type
-
(string) (Required) The type of meeting (Meeting or Webinar) to fetch the information for.
Return
(array) An array of data from the Zoom API.
Source
File: src/Tribe/Meetings/Zoom/Api.php
public function fetch_meeting_data( $zoom_meeting_id, $meeting_type ) {
if ( ! $this->get_token_authorization_header() ) {
return [];
}
$data = [];
$api_endpoint = Meetings::$meeting_type === $meeting_type
? Meetings::$api_endpoint
: Webinars::$api_endpoint;
$this->get(
self::$api_base . "{$api_endpoint}/{$zoom_meeting_id}",
[
'headers' => [
'Authorization' => $this->get_token_authorization_header(),
'Content-Type' => 'application/json; charset=utf-8',
],
'body' => null,
],
200
)->then(
function ( array $response ) use ( &$data ) {
if (
! (
isset( $response['body'] )
&& false !== ( $body = json_decode( $response['body'], true ) )
&& isset( $body['join_url'] )
)
) {
do_action( 'tribe_log', 'error', __CLASS__, [
'action' => __METHOD__,
'message' => 'Zoom API meetings settings response is malformed.',
'response' => $body,
] );
return [];
}
$data = $body;
}
)->or_catch(
function ( \WP_Error $error ) {
do_action( 'tribe_log', 'error', __CLASS__, [
'action' => __METHOD__,
'code' => $error->get_error_code(),
'message' => $error->get_error_message(),
] );
}
);
return $data;
}
Changelog
| Version | Description |
|---|---|
| 1.0.4 | Introduced. |