public function indexResponse($response, $class)
    {
        $resources = $this->response($response);

        $collection = (new IndexCollection($resources))->map(
            function($resource) use ($class) {
                return new $class($resource);
            }
        );

        $link = $response->getHeader('Link')[0] ?? null;
        $total = $response->getHeader('X-Total-Count')[0] ?? null;

        $collection->setPagination($this->getPageNumber($link), (int) $total);

        return $collection;
    }