URI of oauth.

@param $endpoint

@return string
161768
public function getAuthUrl($endpoint = null)
    {
        if ($endpoint !== null) {
            $this->endpoint = $endpoint;
        }
        $query_string = [
            'response_type' => self::RESPONSE_TYPE,
            'client_id'     => $this->client_id,
            'redirect_uri'  => $this->redirect_uri,
            'scope'         => implode(',', $this->scope),
        ];

        return $this->endpoint.self::OAUTH_AUTHORIZE.'?'.http_build_query($query_string);
    }
538907
public function request($method, $endpoint, array $parameters = null)
    {
        $url = $this->config->getEndpoint() . $endpoint;

        // Client should always send OAuth2 tokens in its headers
        $headers = array('Authorization' => 'Bearer ' . $this->config->getAccessToken());

        return $this->client->request($method, $url, $parameters, $headers);
    }
840303
private function normalizeEndpoint(Endpoint $endpoint)
    {
        $normalizedEndpoint = [
            'serviceName' => $endpoint->getServiceName(),
        ];

        if (null !== ($ipv4 = $endpoint->getIpv4())) {
            $normalizedEndpoint['ipv4'] = $ipv4;
        }

        if (null !== ($ipv6 = $endpoint->getIpv6())) {
            $normalizedEndpoint['ipv6'] = $ipv6;
        }

        if (null !== ($port = $endpoint->getPort())) {
            $normalizedEndpoint['port'] = $port;
        }

        return $normalizedEndpoint;
    }
766877
public static function request($endpoint)
  {
    return (new Request(NULL, NULL, NULL))->host($endpoint)->get()->path('')->accept('application/json');
  }
259446
public function resolveEndpoint(Request $request): ?Endpoint
    {
        if (empty($this->endpointsConfig)) {
            return $this->definitionRegistry->getEndpoint();
        }

        foreach ($this->endpointsConfig as $endpoint => $config) {
            if (isset($config['host'])) {
                $host = $request->getHost();
                if (preg_match(sprintf('/%s/', $this->cleanExpression($config['host'])), $host)) {
                    $hostPassed = true;
                } else {
                    $hostPassed = false;
                }
            } else {
                $hostPassed = true;
            }

            if (isset($config['path'])) {
                $path = $request->getPathInfo();
                if (preg_match(sprintf('/%s/', $this->cleanExpression($config['path'])), $path)) {
                    $pathPassed = true;
                } else {
                    $pathPassed = false;
                }
            } else {
                $pathPassed = true;
            }

            if (isset($config['roles'])) {
                try {
                    $rolePassed = $this->authorizationChecker->isGranted($config['roles']);
                } catch (AuthenticationCredentialsNotFoundException $exception) {
                    $rolePassed = false;
                }
            } else {
                $rolePassed = true;
            }

            if ($rolePassed && $hostPassed && $pathPassed) {
                return $this->definitionRegistry->getEndpoint($endpoint);
            }
        }

        return null;
    }
382325
private static function makeEndpoints($endpoints)
    {
        if (is_string($endpoints)) {
            return self::makeEndpointsFromString($endpoints, self::ROUTE_METHODS);
        }

        return $endpoints;
    }
244905
public function getValue($endpoint, $key)
    {
        if (isset($this->endpoints['endpoints'][$endpoint])
            && isset($this->endpoints['endpoints'][$endpoint][$key])
        ) {
            return $this->endpoints['endpoints'][$endpoint][$key];
        }

        if (isset($this->endpoints[$key])) {
            return $this->endpoints[$key];
        }

        return null;
    }
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;
    }
399421
public static function url($endpoint = null, $suffix = '')
    {
        $base = Phramework::getSetting('base');

        if ($endpoint) {
            $suffix = $endpoint . '/' . $suffix;

            $suffix = str_replace('//', '/', $suffix);
        }
        return $base . $suffix;
    }
350762
public function getEndpoint($endpoint, $account = null)
    {
        $isSandbox = (new ConfigurationRepository)->getAccountKey('sandbox', true, $account);

        if ($isSandbox) {
            return $this->resolveUrl(MPESA_SANDBOX, $endpoint);
        }

        return $this->resolveUrl(MPESA_PRODUCTION, $endpoint);
    }
497746
public function getEndpoint($endpoint, $withHost = false, $forceReload = false)
    {
        $this->loadApiDefinition($forceReload);
        $url = "";
        if ($withHost) {
            $url = empty($this->options['host']) ? $this->definition->getHost() : $this->options['host'];
        }

        // If the base path is not already included, we need to add it.
        $url .= (empty($this->options['includeBasePath']) ? $this->definition->getBasePath() : '') . $endpoint;

        return $url;
    }
762852
protected function getStream(string $endpoint, array $params)
    {
        $response = $this->requestRaw($endpoint, 'POST', ['json' => $params]);

        if (false !== stripos($response->getHeaderLine('Content-disposition'), 'attachment')) {
            return StreamResponse::buildFromPsrResponse($response);
        }

        return $this->castResponseToType($response, $this->app['config']->get('response_type'));
    }
716088
public function get($endpoint, $params = [])
    {
        // build url
        $url = $this->domain . '/' . $endpoint;

        if (!empty($params)) {
            $url = $url . '?' . http_build_query($params);
        }

        $request = new Request($url);
        
        // Add client secret header
        if (isset($this->config['secret'])) {
            $request->headers->add(['X-Client-Secret' => $this->config['secret']]);
        }
        
        // add curl options
        if (isset($this->config['curl']) && is_array($this->config['curl'])) {
            foreach ($this->config['curl'] as $option => $value) {
                $request->setOption($option, $value);
            }
        }
        
        $request->execute();

        return $request->getResponse();
    }
1026820
protected function getUrl(Request $request)
    {
        if (strpos($request->getApiMethod(), 'sync-') === 0)
        {
            $apiMethod = 'sync/' . substr($request->getApiMethod(), strlen('sync-'));
        }
        else
        {
            $apiMethod = $request->getApiMethod();
        }

        if (strlen($request->getEndPointGroup()) > 0)
        {
            $endPoint = "group/{$request->getEndPointGroup()}";
        }
        else
        {
            $endPoint = (string) $request->getEndPoint();
        }

        return "{$request->getGatewayUrl()}/{$apiMethod}/{$endPoint}";
    }
1169333
protected function endpoint($resId = null)
    {
        return $resId === null ? $this->endpoint : $this->endpoint . '/' . $resId;
    }
90542
public function getRequestedURI()
    {
        $endpoint = parse_url($this->apiEndpoint);

        // Replace Path of endpoint with requested path from curl
        $header = explode(' ', $this->curl->request_headers[0]);
        $endpoint['path'] = $header[1];

        return $endpoint['scheme'].'://'.$endpoint['host'].$endpoint['path'];
    }
1175024
public function requestEndpoint(AbstractEndpoint $endpoint)
    {
        $cloned = clone $endpoint;
        $cloned->setType($this->getName());

        return $this->getIndex()->requestEndpoint($cloned);
    }