Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Zoom_Helpers::get_meetings( string $label = null, string $option_code = 'ZOOMMEETINGS', array $args = array() )


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$label

(Optional)

Default value: null

$option_code

(Optional)

Default value: 'ZOOMMEETINGS'

$args

(Optional)

Default value: array()


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/zoom/helpers/zoom-helpers.php

	public function get_meetings( $label = null, $option_code = 'ZOOMMEETINGS', $args = array() ) {
		if ( ! $this->load_options ) {
			return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
		}
		if ( ! $label ) {
			$label = __( 'Meeting', 'uncanny-automator' );
		}
		$args = wp_parse_args(
			$args,
			array(
				'uo_include_any' => false,
				'uo_any_label'   => __( 'Any Meeting', 'uncanny-automator' ),
			)
		);
		$token        = key_exists( 'token', $args ) ? $args['token'] : true;
		$is_ajax      = key_exists( 'is_ajax', $args ) ? $args['is_ajax'] : false;
		$target_field = key_exists( 'target_field', $args ) ? $args['target_field'] : '';
		$end_point    = key_exists( 'endpoint', $args ) ? $args['endpoint'] : '';
		$options      = array();
		if ( Automator()->helpers->recipe->load_helpers ) {
			$client = $this->get_client();
			
			if ( ! $client || empty( $client['access_token'] ) ) {
				return Automator()->helpers->recipe->build_default_options_array( $label, $option_code );
			}
			// API register call
			$response = wp_remote_post(
				$this->automator_api,
				array(
					'body' =>
						array(
							'action'       => 'get_meetings',
							'access_token' => $client['access_token'],
							'page_number'  => 1,
							'page_size'    => 1000,
							'type'         => 'upcoming',
						),
				)
			);
			$response_code = wp_remote_retrieve_response_code( $response );
			// prepare meeting lists
			if ( $response_code === 200 ) {
				$response_body = json_decode( wp_remote_retrieve_body( $response ), true );
				if ( count( $response_body['data']['meetings'] ) > 0 ) {
					foreach ( $response_body['data']['meetings'] as $meeting ) {
						$meeting_key                            = (string) $meeting['id'];
						$options[ $meeting_key . '-objectkey' ] = $meeting['topic'];
					}
				}
			}
		}
		$option = array(
			'option_code'     => $option_code,
			'label'           => $label,
			'input_type'      => 'select',
			'required'        => true,
			'supports_tokens' => $token,
			'is_ajax'         => $is_ajax,
			'fill_values_in'  => $target_field,
			'endpoint'        => $end_point,
			'options'         => $options,
		);
		return apply_filters( 'uap_option_zoom_get_meetings', $option );
	}