diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-02-06 10:04:17 +0100 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2017-02-24 23:42:22 +0000 |
commit | a6b98081e45670d1b39e80afe9b1aa34fc536b2a (patch) | |
tree | 409748bbfbadf15b895c3962c680382c9fef9243 | |
parent | 38b934a9ef9dab89692d7253dcb332f4ce46f8f0 (diff) | |
download | libgdata-a6b98081e45670d1b39e80afe9b1aa34fc536b2a.tar.gz |
tasks: Fix pagination in Google Tasks API
The pageToken URI parameter was never being appended to queries, so they
could never retrieve more than the first page of results.
https://bugzilla.gnome.org/show_bug.cgi?id=775813
-rw-r--r-- | gdata/services/tasks/gdata-tasks-query.c | 10 | ||||
-rw-r--r-- | gdata/tests/tasks.c | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/gdata/services/tasks/gdata-tasks-query.c b/gdata/services/tasks/gdata-tasks-query.c index f5666055..627dc862 100644 --- a/gdata/services/tasks/gdata-tasks-query.c +++ b/gdata/services/tasks/gdata-tasks-query.c @@ -271,6 +271,11 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo { GDataTasksQueryPrivate *priv = GDATA_TASKS_QUERY (self)->priv; + /* Chain up to the parent class. This adds a load of irrelevant query + * parameters, but they’re harmless. Importantly, it adds pagination + * support. */ + GDATA_QUERY_CLASS (gdata_tasks_query_parent_class)->get_query_uri (self, feed_uri, query_uri, params_started); + #define APPEND_SEP g_string_append_c (query_uri, (*params_started == FALSE) ? '?' : '&'); *params_started = TRUE; if (gdata_query_get_max_results (GDATA_QUERY (self)) > 0) { @@ -349,10 +354,7 @@ get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboo g_string_append (query_uri, "showHidden=false"); } - /* We don't chain up with parent class get_query_uri because it uses - * GData protocol parameters and they aren't compatible with newest API family - */ - #undef APPEND_SEP + #undef APPEND_SEP } /** diff --git a/gdata/tests/tasks.c b/gdata/tests/tasks.c index 7535c973..2e9a03ef 100644 --- a/gdata/tests/tasks.c +++ b/gdata/tests/tasks.c @@ -121,7 +121,10 @@ test_query_uri (void) "http://example.com"); g_assert_cmpstr (query_uri, ==, "http://example.com" - "?maxResults=10" + /* FIXME: First two are outdated fallbacks */ + "?updated-min=1970-01-01T01:53:09Z" + "&max-results=10" + "&maxResults=10" "&updatedMin=1970-01-01T01:53:09Z" "&completedMin=1970-01-01T01:34:38Z" "&completedMax=1970-01-01T00:20:34Z" @@ -147,7 +150,9 @@ test_query_uri (void) "http://example.com"); g_assert_cmpstr (query_uri, ==, "http://example.com" - "?maxResults=10" + "?updated-min=1970-01-01T01:53:09Z" + "&max-results=10" + "&maxResults=10" "&updatedMin=1970-01-01T01:53:09Z" "&completedMin=1970-01-01T01:34:38Z" "&completedMax=1970-01-01T00:20:34Z" |