Google_Sheet_Helpers::api_call( mixed $body, mixed $action = null )

Method api_call


Parameters Parameters

$body

(Required)

$action

(Optional)

Default value: null


Top ↑

Return Return

(void)


Source Source

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

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

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

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

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

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

		return $response;

	}