You are here

private function ZoomApiClient::buildOptions in Zoom API 8

Same name and namespace in other branches
  1. 2.0.x src/Client/ZoomApiClient.php \Drupal\zoomapi\Client\ZoomApiClient::buildOptions()

Build options for the client.

Parameters

array $query: An array of querystring params for guzzle.

array $body: An array of items that guzzle with json_encode.

Return value

array An array of options for guzzle.

1 call to ZoomApiClient::buildOptions()
ZoomApiClient::request in src/Client/ZoomApiClient.php
Utilizes Drupal's httpClient to connect to the Zoom API.

File

src/Client/ZoomApiClient.php, line 153

Class

ZoomApiClient
Uses http client to interact with the Zoom API.

Namespace

Drupal\zoomapi\Client

Code

private function buildOptions(array $query = [], array $body = []) {
  $options = [];
  $options['headers'] = [
    'Authorization' => 'Bearer ' . $this
      ->setAuthHeader(),
  ];
  if (!empty($body)) {

    // Json key converts array to json & adds appropriate content-type header.
    $options['json'] = $body;
  }
  if (!empty($query)) {
    $options['query'] = $query;
  }
  return $options;
}