SammyK / LaravelFacebookSdk

Fully unit tested Facebook SDK v5 integration for Laravel & Lumen
MIT License
693 stars 201 forks source link

get method does not have possibility to pass query arguments. #200

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello.

At the moment when using get method, there is no possibility to pass custom query arguments. Example: ( This wont work ):

$photos = $facebook->get(
    '/' . $album['id'] . '/photos?id,album,height,images,link,name,width',
    $accessToken
)->getDecodedBody();

And if we look into code:

    public function get($endpoint, $accessToken = null, $eTag = null, $graphVersion = null)
    {
        return $this->sendRequest(
            'GET',
            $endpoint,
            $params = [],
            $accessToken,
            $eTag,
            $graphVersion
        );
    }

Looks like $params variable is hardcoded. And it won't accept custom columns.

ghost commented 6 years ago

**UPDATE:***

There is possibility to do request like this:

            $fields = [
                'fields' => 'id,album,height,images,link,name,width',
            ];

            $photos = $facebook->sendRequest('GET', '/' . $album['id'] . '/photos', $fields, $accessToken)
                ->getDecodedBody();

Still, I think that GET request should have option to send custom fields to be returned with request.