Set the Full API endpoint

@param string $endPoint
@return string
@throws OdooException OdooException
189354
private function setApiEndPoint($endPoint)
    {
        if (empty($this->host))
            throw new OdooException('You must provide the odoo host by host setter method');

        return $this->host . $this->suffix . $endPoint;

    }
907306
private static function curl(string $endpoint)
    {
        // Get the base URL and App Key.
        $baseUrl = self::$_baseUrl;

        // Create a cURL session.
        $curl = curl_init();

        // Set the options necessary for communicating with the UCRM Server.
        curl_setopt($curl, CURLOPT_URL, $baseUrl.$endpoint);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, false);

        // TODO: Determine if we EVER need to use HTTPS and how to handle it correctly here!
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // DEFAULT
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); // DEFAULT

        // Set the necessary HTTP HEADERS.
        curl_setopt($curl, CURLOPT_HTTPHEADER, self::$_headers);

        return $curl;
    }
1325862
private static function makeEndpointsFromString($endpoint, $methods)
    {
        return collect($methods)->map(function ($method) use ($endpoint) {
            return [$method => $endpoint];
        })->collapse();
    }
1175024
public function requestEndpoint(AbstractEndpoint $endpoint)
    {
        $cloned = clone $endpoint;
        $cloned->setType($this->getName());

        return $this->getIndex()->requestEndpoint($cloned);
    }
744971
protected function getEndpoint($method)
    {
        $endpoint = 'inspect';
        $number = $this->getArgument("number");
        if (!is_null($number)) {
            $endpoint .= "/$number";
            $this->delArgument("number");
        }
        return $endpoint;
    }
443018
public function setClient($endpoint = null)
    {
        // Create client using API endpoint.
        $this->client = new Client([
                                       'base_uri' => ! is_null($endpoint) ? $endpoint : $this->endpoint,
                                   ]);

        return $this;
    }
304033
public function setAuthorizationEndpoint($endpoint)
    {
        if (!in_array($endpoint, [self::ENDPOINT_AUTHENTICATE, self::ENDPOINT_AUTHORIZE])) {
            throw new Exception(
                sprintf("'%s' is not a correct Twitter authorization endpoint.", $endpoint)
            );
        }

        $this->authorizationEndpoint = $endpoint;

        return $this;
    }
1281920
private function buildSchemaForEndpoint(string $endpoint)
    {
        $schemaPathAndFilename = $this->endpointsConfiguration[$endpoint]['schema'];
        $content = Files::getFileContents($schemaPathAndFilename);
        $documentNode = Parser::parse($content);
        $this->schemaCache->set(urlencode($endpoint), $documentNode, [md5($schemaPathAndFilename)]);
        return $documentNode;
    }
885096
public function buildUrl($apiEndPoint)
    {
        if (is_null($this->request['url'])) {
            return $apiEndPoint . '/' . $this->uri . ($this->queryStr ? '?' . http_build_query($this->queryStr) : '');
        }
        if (strpos($this->url, $apiEndPoint) !== 0) {
            throw new PaysafeException('Unexpected endpoint in url: ' . $this->url . ' expected: ' . $apiEndPoint);
        }
        return $this->url;
    }
176701
public function verifySettings(string $endpoint)
    {
        if (!isset($this->endpointsConfiguration[$endpoint])) {
            throw new \InvalidArgumentException(sprintf('The endpoint "%s" is not configured.', $endpoint), 1461435428);
        }

        if (!isset($this->endpointsConfiguration[$endpoint]['schema']) && !isset($this->endpointsConfiguration[$endpoint]['querySchema'])) {
            throw new \InvalidArgumentException(sprintf('There is no root query schema configured for endpoint "%s".', $endpoint), 1461435432);
        }

        if (isset($this->endpointsConfiguration[$endpoint]['schema']) && !file_exists($this->endpointsConfiguration[$endpoint]['schema'])) {
            throw new \InvalidArgumentException(sprintf('The Schema file configured for endpoint "%s" does not exist at: "%s".', $endpoint, $this->endpointsConfiguration[$endpoint]['schema']), 1516719329);
        }
    }
871370
public function call($endpoint, $method = 'GET', array $data = [])
    {
        if (substr($endpoint, -1) == '/') {
            $endpoint = substr($endpoint, 0, strlen($endpoint)-1);
        }
        
        self::log("Calling $method /api/$endpoint");
            
        $params = [
            'headers'=> [
                'Accept'     => sprintf('application/vnd.xac.v%d+json', self::$apiVersion),
                'AC-API-KEY' => self::$apiKey,
            ],
        ];
        
        if (count($data) > 0) {
            $params['json'] = $data;
        }
        
        try {
            $this->initTransport();
            
            $res = $this->transport->request($method, $endpoint, $params);
        } catch (ConnectException $e) {
            self::log($e->getMessage(), Logger::ERROR);
            throw new \Exception($e->getMessage());
        
        } catch (ServerException $e) {
            $response = json_decode((string) $e->getResponse()->getBody(), true);
            self::$lastResponse = $response['ACResponse'];
            self::$lastResponse['httpCode'] = $e->getResponse()->getStatusCode();
            self::log($e->getMessage(), Logger::ERROR);
            throw new \Exception(self::$lastResponse['message']);
        
        } catch (ClientException $e) {
            $response = json_decode((string) $e->getResponse()->getBody(), true);
            self::$lastResponse = $response['ACResponse'];
            self::$lastResponse['httpCode'] = $e->getResponse()->getStatusCode();
            self::log($e->getMessage(), Logger::ERROR);
            throw new \Exception(self::$lastResponse['message']);
             
        } finally {
            if (isset($res)) {
                $response = json_decode((string) $res->getBody(), !self::$returnObject);
                $response = $response['ACResponse'];
            }
        }
        
        self::$lastResponse = $response;
        
        return $response['body']['data'];
    }
1044086
public function get($endpoint, $options = [])
    {
        return $this->request('GET', 'rest/v1/users/' . $this->userId . '/' . $endpoint . '?' . http_build_query($options));
    }
1198202
protected function getEndpoint($method)
    {
        $endpoint = "calls";
        $searchParams = $this->getArgument("search_params");
        if (!is_null($searchParams)) {
            $queryString = http_build_query($searchParams);
            $this->delArgument("search_params");
            return "$endpoint?$queryString";
        }
        return $endpoint;
    }
636182
public static function fromEndpoint(Endpoint $endpoint)
    {
        return static::generateKey(strtolower($endpoint->getRegion()->getDomain()).$endpoint->getUrl());
    }
1128932
public static function getApiUrl($endpoint, $version = null)
    {
        if ($version === null) {
            $version = self::$apiVersion;
        }
        return self::$apiBase . '/v' . $version . '/' . $endpoint . '/json';
    }
1260821
public function getKey(string $endpoint = null)
    {
        if ('sandboxnew/pay/getsignkey' === $endpoint) {
            return $this['config']->key;
        }

        $key = $this->inSandbox() ? $this['sandbox']->getKey() : $this['config']->key;

        if (empty($key)) {
            throw new InvalidArgumentException("config key connot be empty.");
        }

        if (32 !== strlen($key)) {
            throw new InvalidArgumentException(sprintf("'%s' should be 32 chars length.", $key));
        }

        return $key;
    }
1013417
protected function buildUrl($endpoint, $params)
    {
        $url = $this->getOAuthApiRoot();
        $scheme = parse_url($url, PHP_URL_SCHEME);
        $authority = parse_url($url, PHP_URL_HOST);
        $path = parse_url($url, PHP_URL_PATH);
        $path .= trim($endpoint, '/');
        $fragment = '';
        $uri = Uri::composeComponents(
            $scheme,
            $authority,
            $path,
            build_query($params),
            $fragment
        );
        return $uri;
    }