mirror of https://github.com/kiwix/libkiwix.git
Pagination info in /catalog/v2/entries
This commit is contained in:
parent
f1797993af
commit
fa42cbc48f
|
@ -173,6 +173,9 @@ string OPDSDumper::dumpOPDSFeedV2(const std::vector<std::string>& bookIds, const
|
||||||
{"endpoint_root", rootLocation + "/catalog/v2"},
|
{"endpoint_root", rootLocation + "/catalog/v2"},
|
||||||
{"feed_id", gen_uuid(libraryId + "/entries?"+query)},
|
{"feed_id", gen_uuid(libraryId + "/entries?"+query)},
|
||||||
{"filter", query.empty() ? MustacheData(false) : MustacheData(query)},
|
{"filter", query.empty() ? MustacheData(false) : MustacheData(query)},
|
||||||
|
{"totalResults", to_string(m_totalResults)},
|
||||||
|
{"startIndex", to_string(m_startIndex)},
|
||||||
|
{"itemsPerPage", to_string(m_count)},
|
||||||
{"books", bookData }
|
{"books", bookData }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
xmlns:opds="https://specs.opds.io/opds-1.2">
|
xmlns:opds="https://specs.opds.io/opds-1.2"
|
||||||
|
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
|
||||||
<id>{{feed_id}}</id>
|
<id>{{feed_id}}</id>
|
||||||
|
|
||||||
<link rel="self"
|
<link rel="self"
|
||||||
|
@ -15,7 +16,11 @@
|
||||||
|
|
||||||
<title>{{^filter}}All Entries{{/filter}}{{#filter}}Filtered Entries ({{filter}}){{/filter}}</title>
|
<title>{{^filter}}All Entries{{/filter}}{{#filter}}Filtered Entries ({{filter}}){{/filter}}</title>
|
||||||
<updated>{{date}}</updated>
|
<updated>{{date}}</updated>
|
||||||
|
{{#filter}}
|
||||||
|
<totalResults>{{totalResults}}</totalResults>
|
||||||
|
<startIndx>{{startIndex}}</startIndx>
|
||||||
|
<itemsPerPage>{{itemsPerPage}}</itemsPerPage>
|
||||||
|
{{/filter}}
|
||||||
{{#books}}
|
{{#books}}
|
||||||
<entry>
|
<entry>
|
||||||
<id>{{id}}</id>
|
<id>{{id}}</id>
|
||||||
|
|
|
@ -1006,7 +1006,8 @@ TEST_F(LibraryServerTest, catalog_v2_categories)
|
||||||
#define CATALOG_V2_ENTRIES_PREAMBLE \
|
#define CATALOG_V2_ENTRIES_PREAMBLE \
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
||||||
"<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" \
|
"<feed xmlns=\"http://www.w3.org/2005/Atom\"\n" \
|
||||||
" xmlns:opds=\"https://specs.opds.io/opds-1.2\">\n" \
|
" xmlns:opds=\"https://specs.opds.io/opds-1.2\"\n" \
|
||||||
|
" xmlns:opensearch=\"http://a9.com/-/spec/opensearch/1.1/\">\n" \
|
||||||
" <id>12345678-90ab-cdef-1234-567890abcdef</id>\n" \
|
" <id>12345678-90ab-cdef-1234-567890abcdef</id>\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
" <link rel=\"self\"\n" \
|
" <link rel=\"self\"\n" \
|
||||||
|
@ -1046,7 +1047,9 @@ TEST_F(LibraryServerTest, catalog_v2_entries_filtered_by_range)
|
||||||
CATALOG_V2_ENTRIES_PREAMBLE
|
CATALOG_V2_ENTRIES_PREAMBLE
|
||||||
" <title>Filtered Entries (start=1)</title>\n"
|
" <title>Filtered Entries (start=1)</title>\n"
|
||||||
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
||||||
"\n"
|
" <totalResults>3</totalResults>\n"
|
||||||
|
" <startIndx>1</startIndx>\n"
|
||||||
|
" <itemsPerPage>2</itemsPerPage>\n"
|
||||||
RAY_CHARLES_CATALOG_ENTRY
|
RAY_CHARLES_CATALOG_ENTRY
|
||||||
UNCATEGORIZED_RAY_CHARLES_CATALOG_ENTRY
|
UNCATEGORIZED_RAY_CHARLES_CATALOG_ENTRY
|
||||||
"</feed>\n"
|
"</feed>\n"
|
||||||
|
@ -1060,7 +1063,9 @@ TEST_F(LibraryServerTest, catalog_v2_entries_filtered_by_range)
|
||||||
CATALOG_V2_ENTRIES_PREAMBLE
|
CATALOG_V2_ENTRIES_PREAMBLE
|
||||||
" <title>Filtered Entries (count=2)</title>\n"
|
" <title>Filtered Entries (count=2)</title>\n"
|
||||||
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
||||||
"\n"
|
" <totalResults>3</totalResults>\n"
|
||||||
|
" <startIndx>0</startIndx>\n"
|
||||||
|
" <itemsPerPage>2</itemsPerPage>\n"
|
||||||
CHARLES_RAY_CATALOG_ENTRY
|
CHARLES_RAY_CATALOG_ENTRY
|
||||||
RAY_CHARLES_CATALOG_ENTRY
|
RAY_CHARLES_CATALOG_ENTRY
|
||||||
"</feed>\n"
|
"</feed>\n"
|
||||||
|
@ -1074,7 +1079,9 @@ TEST_F(LibraryServerTest, catalog_v2_entries_filtered_by_range)
|
||||||
CATALOG_V2_ENTRIES_PREAMBLE
|
CATALOG_V2_ENTRIES_PREAMBLE
|
||||||
" <title>Filtered Entries (count=1&start=1)</title>\n"
|
" <title>Filtered Entries (count=1&start=1)</title>\n"
|
||||||
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
||||||
"\n"
|
" <totalResults>3</totalResults>\n"
|
||||||
|
" <startIndx>1</startIndx>\n"
|
||||||
|
" <itemsPerPage>1</itemsPerPage>\n"
|
||||||
RAY_CHARLES_CATALOG_ENTRY
|
RAY_CHARLES_CATALOG_ENTRY
|
||||||
"</feed>\n"
|
"</feed>\n"
|
||||||
);
|
);
|
||||||
|
@ -1089,7 +1096,9 @@ TEST_F(LibraryServerTest, catalog_v2_entries_filtered_by_search_terms)
|
||||||
CATALOG_V2_ENTRIES_PREAMBLE
|
CATALOG_V2_ENTRIES_PREAMBLE
|
||||||
" <title>Filtered Entries (q="ray charles")</title>\n"
|
" <title>Filtered Entries (q="ray charles")</title>\n"
|
||||||
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
" <updated>YYYY-MM-DDThh:mm:ssZ</updated>\n"
|
||||||
"\n"
|
" <totalResults>2</totalResults>\n"
|
||||||
|
" <startIndx>0</startIndx>\n"
|
||||||
|
" <itemsPerPage>2</itemsPerPage>\n"
|
||||||
RAY_CHARLES_CATALOG_ENTRY
|
RAY_CHARLES_CATALOG_ENTRY
|
||||||
CHARLES_RAY_CATALOG_ENTRY
|
CHARLES_RAY_CATALOG_ENTRY
|
||||||
"</feed>\n"
|
"</feed>\n"
|
||||||
|
|
Loading…
Reference in New Issue