protected function get(string $path, array $parameters = []): object
    {
        $url = $this->buildApiUrl($path, $parameters);

        $request = $this->requestFactory->createRequest('GET', $url);
        $response = $this->httpClient->sendRequest($request);

        $body = json_decode((string) $response->getBody());

        if (isset($body->error_message)) {
            throw new InstagramException($body->error_message);
        }

        if (isset($body->meta->error_message)) {
            throw new InstagramException($body->meta->error_message);
        }

        if ($response->getStatusCode() !== 200) {
            throw new InstagramException($response->getReasonPhrase());
        }

        return $body;
    }
protected function get(string $path, array $parameters = []): object
    {
        $url = $this->buildApiUrl($path, $parameters);

        $request = $this->requestFactory->createRequest('GET', $url);
        $response = $this->httpClient->sendRequest($request);

        $body = json_decode((string) $response->getBody());

        if (isset($body->error_message)) {
            throw new InstagramException($body->error_message);
        }

        if (isset($body->meta->error_message)) {
            throw new InstagramException($body->meta->error_message);
        }

        if ($response->getStatusCode() !== 200) {
            throw new InstagramException($response->getReasonPhrase());
        }

        return $body;
    }
protected function get ( string $ path , array $ parameters = [ ] ) : object { $ url = $ this -> buildApiUrl ( $ path , $ parameters ) ; $ request = $ this -> requestFactory -> createRequest ( 'GET' , $ url ) ; $ response = $ this -> httpClient -> sendRequest ( $ request ) ; $ body = json_decode ( ( string ) $ response -> getBody ( ) ) ; if ( isset ( $ body -> error_message ) ) { throw new InstagramException ( $ body -> error_message ) ; } if ( isset ( $ body -> meta -> error_message ) ) { throw new InstagramException ( $ body -> meta -> error_message ) ; } if ( $ response -> getStatusCode ( ) !== 200 ) { throw new InstagramException ( $ response -> getReasonPhrase ( ) ) ; } return $ body ; }
Send a get request.

@param string $path
@param array $parameters

@throws \Vinkla\Instagram\InstagramException

@return object
Send a get request .