Google_Calendar_Helpers::api_call( array $body, array $action = null )

Method api_call


Parameters Parameters

$body

(Required) The request body form-data.

$action

(Optional) The Automator Action parameters.

Default value: null


Top ↑

Return Return

(string) Json encoded response from API.


Source Source

File: src/integrations/google-calendar/helpers/google-calendar-helpers.php

	public function api_call( $body, $action = null ) {

		$body['access_token'] = wp_json_encode( $this->get_client() );

		$params = array(
			'endpoint' => self::API_ENDPOINT,
			'body'     => $body,
			'action'   => $action,
			'timeout'  => 15,
		);

		$response = Api_Server::api_call( $params );

		if ( 200 !== $response['statusCode'] ) {
			throw new \Exception( $params['endpoint'] . ' failed' );
		}

		return $response;

	}