Intercom\IntercomClient::nextPage PHP Method

nextPage() public method

Returns next page of the result.
public nextPage ( array $pages ) : mixed
$pages array
return mixed
    public function nextPage($pages)
    {
        $response = $this->http_client->request('GET', $pages['next'], ['auth' => $this->getAuth(), 'headers' => ['Accept' => 'application/json']]);
        return $this->handleResponse($response);
    }

Usage Example

 public function testPaginationHelper()
 {
     $mock = new MockHandler([new Response(200, ['X-Foo' => 'Bar'], "{\"foo\":\"bar\"}")]);
     $container = [];
     $history = Middleware::history($container);
     $stack = HandlerStack::create($mock);
     $stack->push($history);
     $http_client = new Client(['handler' => $stack]);
     $client = new IntercomClient('u', 'p');
     $client->setClient($http_client);
     $client->nextPage(['next' => 'https://foo.com']);
     foreach ($container as $transaction) {
         $host = $transaction['request']->getUri()->getHost();
         $this->assertTrue($host == "foo.com");
     }
 }