cpp Rest API master
C++ library for REST API access with Qt, Curl and cpp-httplib backends
 
Loading...
Searching...
No Matches
cpp_restapi::LinkHeaderPaginationStrategy Class Reference

Pagination strategy using RFC 5988 Link headers. More...

#include <link_header_pagination_strategy.hpp>

Inheritance diagram for cpp_restapi::LinkHeaderPaginationStrategy:
cpp_restapi::IPaginationStrategy

Public Member Functions

std::string nextPageUrl (const std::string &responseHeaders) override
 Extract next page URL from response headers.
 
std::string merge (const std::vector< std::string > &pages) override
 Merge all collected pages into a single result.
 
- Public Member Functions inherited from cpp_restapi::IPaginationStrategy
virtual ~IPaginationStrategy ()=default
 

Detailed Description

Pagination strategy using RFC 5988 Link headers.

Discovers the next page via the Link: <url>; rel="next" header and merges JSON responses by concatenating arrays or deep-merging objects. Used by GitHub API and other services that paginate with Link headers.

Member Function Documentation

◆ merge()

std::string cpp_restapi::LinkHeaderPaginationStrategy::merge ( const std::vector< std::string > & pages)
overridevirtual

Merge all collected pages into a single result.

Parameters
pagesresponse bodies from all pages
Returns
merged result

Implements cpp_restapi::IPaginationStrategy.

◆ nextPageUrl()

std::string cpp_restapi::LinkHeaderPaginationStrategy::nextPageUrl ( const std::string & responseHeaders)
overridevirtual

Extract next page URL from response headers.

Parameters
responseHeadersraw HTTP headers from the response
Returns
URL of the next page, or empty string if no more pages

Implements cpp_restapi::IPaginationStrategy.


The documentation for this class was generated from the following file: