protected function makeApiRequest($key, $method, $resource, $body = null, $type = 'form') { $headers = array(); if ($body !== null) { if ($type === 'form') { if (is_array($body)) { $body = http_build_query($body); } $headers['Content-Type'] = 'application/x-www-form-urlencoded'; } elseif ($type === 'json') { $body = json_encode($body); $headers['Content-Type'] = 'application/json'; } } $query['key'] = $key; $url = self::BASE_URL . $resource . '?' . http_build_query($query); return $this->requestManager->send($method, $url, $body, $headers); }