summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2012-04-13 00:21:51 +0100
committerPhilip Withnall <philip@tecnocode.co.uk>2012-04-13 15:10:11 +0100
commitc8eca065e5f3f11d0ec8c7aac497e19f7d07469e (patch)
treed66b7e545ff299fd68fda0aa7e8a512d2464f79d
parent5eea510bb492e62e76e515534f4f02be85caac81 (diff)
downloadlibgdata-c8eca065e5f3f11d0ec8c7aac497e19f7d07469e.tar.gz
documents: Split upload parameters out into GDataDocumentsUploadQuery
This new object currently only specifies the destination folder for an upload (replacing the folder argument to gdata_documents_service_upload_document_resumable()), but will in future allow specifying things like the ‘convert’ and OCR parameters for uploads. API additions: • GDataDocumentsUploadQuery and its methods API breaks: • gdata_documents_service_upload_document_resumable() (Note that this API hasn’t yet been in a libgdata release, so this isn’t a real API break.) Helps: https://bugzilla.gnome.org/show_bug.cgi?id=656971
-rw-r--r--Makefile.am4
-rw-r--r--docs/reference/gdata-docs.xml1
-rw-r--r--docs/reference/gdata-sections.txt21
-rw-r--r--gdata/gdata.h1
-rw-r--r--gdata/gdata.symbols5
-rw-r--r--gdata/services/documents/gdata-documents-service.c48
-rw-r--r--gdata/services/documents/gdata-documents-service.h4
-rw-r--r--gdata/services/documents/gdata-documents-upload-query.c235
-rw-r--r--gdata/services/documents/gdata-documents-upload-query.h75
-rw-r--r--gdata/tests/documents.c13
10 files changed, 381 insertions, 26 deletions
diff --git a/Makefile.am b/Makefile.am
index 3c6870ca..8a63c230 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -253,7 +253,8 @@ gdata_documents_headers = \
gdata/services/documents/gdata-documents-text.h \
gdata/services/documents/gdata-documents-presentation.h \
gdata/services/documents/gdata-documents-folder.h \
- gdata/services/documents/gdata-documents-spreadsheet.h
+ gdata/services/documents/gdata-documents-spreadsheet.h \
+ gdata/services/documents/gdata-documents-upload-query.h
gdatadocumentsinclude_HEADERS = \
$(gdata_documents_headers) \
gdata/services/documents/gdata-documents-enums.h
@@ -369,6 +370,7 @@ gdata_sources = \
gdata/services/documents/gdata-documents-spreadsheet.c \
gdata/services/documents/gdata-documents-folder.c \
gdata/services/documents/gdata-documents-query.c \
+ gdata/services/documents/gdata-documents-upload-query.c \
\
gdata/services/picasaweb/gdata-picasaweb-album.c \
gdata/services/picasaweb/gdata-picasaweb-query.c \
diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml
index ec5f0a3e..927a8a80 100644
--- a/docs/reference/gdata-docs.xml
+++ b/docs/reference/gdata-docs.xml
@@ -153,6 +153,7 @@
<xi:include href="xml/gdata-documents-service.xml"/>
<xi:include href="xml/gdata-documents-feed.xml"/>
<xi:include href="xml/gdata-documents-query.xml"/>
+ <xi:include href="xml/gdata-documents-upload-query.xml"/>
<xi:include href="xml/gdata-documents-entry.xml"/>
<xi:include href="xml/gdata-documents-document.xml"/>
<xi:include href="xml/gdata-documents-folder.xml"/>
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 14f0f450..787675c0 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -2371,3 +2371,24 @@ gdata_picasaweb_comment_get_type
<SUBSECTION Private>
GDataPicasaWebCommentPrivate
</SECTION>
+
+<SECTION>
+<FILE>gdata-documents-upload-query</FILE>
+<TITLE>GDataDocumentsUploadQuery</TITLE>
+GDataDocumentsUploadQuery
+GDataDocumentsUploadQueryClass
+gdata_documents_upload_query_new
+gdata_documents_upload_query_build_uri
+gdata_documents_upload_query_get_folder
+gdata_documents_upload_query_set_folder
+<SUBSECTION Standard>
+gdata_documents_upload_query_get_type
+GDATA_DOCUMENTS_UPLOAD_QUERY
+GDATA_DOCUMENTS_UPLOAD_QUERY_CLASS
+GDATA_DOCUMENTS_UPLOAD_QUERY_GET_CLASS
+GDATA_IS_DOCUMENTS_UPLOAD_QUERY
+GDATA_IS_DOCUMENTS_UPLOAD_QUERY_CLASS
+GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY
+<SUBSECTION Private>
+GDataDocumentsUploadQueryPrivate
+</SECTION>
diff --git a/gdata/gdata.h b/gdata/gdata.h
index 441e2265..5fbe4bfe 100644
--- a/gdata/gdata.h
+++ b/gdata/gdata.h
@@ -129,5 +129,6 @@
#include <gdata/services/documents/gdata-documents-service.h>
#include <gdata/services/documents/gdata-documents-feed.h>
#include <gdata/services/documents/gdata-documents-enums.h>
+#include <gdata/services/documents/gdata-documents-upload-query.h>
#endif /* !GDATA_H */
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 0bfbb3a0..3b8e9f16 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -941,3 +941,8 @@ gdata_upload_stream_new_resumable
gdata_upload_stream_get_content_length
gdata_documents_service_upload_document_resumable
gdata_documents_service_update_document_resumable
+gdata_documents_upload_query_get_type
+gdata_documents_upload_query_new
+gdata_documents_upload_query_build_uri
+gdata_documents_upload_query_get_folder
+gdata_documents_upload_query_set_folder
diff --git a/gdata/services/documents/gdata-documents-service.c b/gdata/services/documents/gdata-documents-service.c
index 0677fd3b..b0bfe363 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -273,6 +273,8 @@ static void append_query_headers (GDataService *self, GDataAuthorizationDomain *
static GList *get_authorization_domains (void);
static gchar *_build_v2_upload_uri (GDataDocumentsFolder *folder) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
+static gchar *_get_upload_uri_for_query_and_folder (GDataDocumentsUploadQuery *query,
+ GDataDocumentsFolder *folder) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
_GDATA_DEFINE_AUTHORIZATION_DOMAIN (documents, "writely", "https://docs.google.com/feeds/")
_GDATA_DEFINE_AUTHORIZATION_DOMAIN (spreadsheets, "wise", "https://spreadsheets.google.com/feeds/")
@@ -629,7 +631,7 @@ gdata_documents_service_upload_document (GDataDocumentsService *self, GDataDocum
* @slug: the filename to give to the uploaded document
* @content_type: the content type of the uploaded data
* @content_length: the size (in bytes) of the file being uploaded
- * @folder: (allow-none): the folder to which the document should be uploaded, or %NULL
+ * @query: (allow-none): a query specifying parameters for the upload, or %NULL
* @cancellable: (allow-none): a #GCancellable for the entire upload stream, or %NULL
* @error: a #GError, or %NULL
*
@@ -643,6 +645,10 @@ gdata_documents_service_upload_document (GDataDocumentsService *self, GDataDocum
*
* If @document is %NULL, only the document data will be uploaded. The new document entry will be named using @slug, and will have default metadata.
*
+ * If non-%NULL, the @query specifies parameters for the upload, such as a #GDataDocumentsFolder to upload the document into; and whether to treat
+ * the document as an opaque file, or convert it to a standard format. If @query is %NULL, the document will be uploaded into the root folder, and
+ * automatically converted to a standard format. No OCR or automatic language translation will be performed by default.
+ *
* The stream returned by this function should be written to using the standard #GOutputStream methods, asychronously or synchronously. Once the stream
* is closed (using g_output_stream_close()), gdata_documents_service_finish_upload() should be called on it to parse and return the updated
* #GDataDocumentsDocument for the document. This must be done, as @document isn't updated in-place.
@@ -659,7 +665,7 @@ gdata_documents_service_upload_document (GDataDocumentsService *self, GDataDocum
*/
GDataUploadStream *
gdata_documents_service_upload_document_resumable (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
- const gchar *content_type, goffset content_length, GDataDocumentsFolder *folder,
+ const gchar *content_type, goffset content_length, GDataDocumentsUploadQuery *query,
GCancellable *cancellable, GError **error)
{
GDataUploadStream *upload_stream;
@@ -669,7 +675,7 @@ gdata_documents_service_upload_document_resumable (GDataDocumentsService *self,
g_return_val_if_fail (document == NULL || GDATA_IS_DOCUMENTS_DOCUMENT (document), NULL);
g_return_val_if_fail (slug != NULL && *slug != '\0', NULL);
g_return_val_if_fail (content_type != NULL && *content_type != '\0', NULL);
- g_return_val_if_fail (folder == NULL || GDATA_IS_DOCUMENTS_FOLDER (folder), NULL);
+ g_return_val_if_fail (query == NULL || GDATA_IS_DOCUMENTS_UPLOAD_QUERY (query), NULL);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@@ -677,7 +683,7 @@ gdata_documents_service_upload_document_resumable (GDataDocumentsService *self,
return NULL;
}
- upload_uri = gdata_documents_service_get_upload_uri (folder);
+ upload_uri = _get_upload_uri_for_query_and_folder (query, NULL);
upload_stream = upload_update_document (self, document, slug, content_type, content_length, SOUP_METHOD_POST, upload_uri, cancellable);
g_free (upload_uri);
@@ -1263,6 +1269,21 @@ _build_v2_upload_uri (GDataDocumentsFolder *folder)
return g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/default/private/full", NULL);
}
+/* NOTE: query may be NULL. */
+static gchar *
+_get_upload_uri_for_query_and_folder (GDataDocumentsUploadQuery *query, GDataDocumentsFolder *folder)
+{
+ if (query == NULL) {
+ query = gdata_documents_upload_query_new ();
+ }
+
+ if (folder != NULL) {
+ gdata_documents_upload_query_set_folder (query, folder);
+ }
+
+ return gdata_documents_upload_query_build_uri (query);
+}
+
/**
* gdata_documents_service_get_upload_uri:
* @folder: (allow-none): the #GDataDocumentsFolder into which to upload the document, or %NULL
@@ -1280,22 +1301,5 @@ gdata_documents_service_get_upload_uri (GDataDocumentsFolder *folder)
{
g_return_val_if_fail (folder == NULL || GDATA_IS_DOCUMENTS_FOLDER (folder), NULL);
- if (folder != NULL) {
- GDataLink *upload_link;
-
- /* Get the folder's upload URI. */
- upload_link = gdata_entry_look_up_link (GDATA_ENTRY (folder), GDATA_LINK_RESUMABLE_CREATE_MEDIA);
-
- if (upload_link == NULL) {
- /* Fall back to building a URI manually. */
- return _gdata_service_build_uri ("%s://docs.google.com/feeds/upload/create-session/default/private/full/%s/contents",
- _gdata_service_get_scheme (),
- gdata_documents_entry_get_resource_id (GDATA_DOCUMENTS_ENTRY (folder)));
- }
-
- return g_strdup (gdata_link_get_uri (upload_link));
- }
-
- /* Use resumable upload. */
- return g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/upload/create-session/default/private/full", NULL);
+ return _get_upload_uri_for_query_and_folder (NULL, folder);
}
diff --git a/gdata/services/documents/gdata-documents-service.h b/gdata/services/documents/gdata-documents-service.h
index f68a6e00..df6e1a84 100644
--- a/gdata/services/documents/gdata-documents-service.h
+++ b/gdata/services/documents/gdata-documents-service.h
@@ -95,12 +95,14 @@ void gdata_documents_service_query_documents_async (GDataDocumentsService *self,
#include <gdata/services/documents/gdata-documents-document.h>
#include <gdata/services/documents/gdata-documents-folder.h>
+#include <gdata/services/documents/gdata-documents-upload-query.h>
GDataUploadStream *gdata_documents_service_upload_document (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
const gchar *content_type, GDataDocumentsFolder *folder,
GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
GDataUploadStream *gdata_documents_service_upload_document_resumable (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
- const gchar *content_type, goffset content_length, GDataDocumentsFolder *folder,
+ const gchar *content_type, goffset content_length,
+ GDataDocumentsUploadQuery *query,
GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
GDataUploadStream *gdata_documents_service_update_document (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
diff --git a/gdata/services/documents/gdata-documents-upload-query.c b/gdata/services/documents/gdata-documents-upload-query.c
new file mode 100644
index 00000000..5c3bc534
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-upload-query.c
@@ -0,0 +1,235 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Philip Withnall 2012 <philip@tecnocode.co.uk>
+ *
+ * GData Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GData Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GData Client. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * SECTION:gdata-documents-upload-query
+ * @short_description: GData Documents upload query object
+ * @stability: Unstable
+ * @include: gdata/services/documents/gdata-documents-upload-query.h
+ *
+ * #GDataDocumentsUploadQuery is a collection of parameters for document uploads to Google Documents, allowing various options to be set when uploading
+ * a document for the first time. For example, the destination folder for the uploaded document may be specified; or whether to automatically convert
+ * the document to a common format.
+ *
+ * #GDataDocumentsUploadQuery is designed as an object (rather than a fixed struct or set of function arguments) to allow for easy additions of new
+ * Google Documents features in the future.
+ *
+ * Since: 0.13.0
+ */
+
+#include <glib.h>
+
+#include "gdata-documents-upload-query.h"
+#include "gdata-private.h"
+#include "gdata-upload-stream.h"
+
+static void gdata_documents_upload_query_dispose (GObject *object);
+static void gdata_documents_upload_query_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
+static void gdata_documents_upload_query_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
+
+struct _GDataDocumentsUploadQueryPrivate {
+ GDataDocumentsFolder *folder;
+};
+
+enum {
+ PROP_FOLDER = 1,
+};
+
+G_DEFINE_TYPE (GDataDocumentsUploadQuery, gdata_documents_upload_query, G_TYPE_OBJECT)
+
+static void
+gdata_documents_upload_query_class_init (GDataDocumentsUploadQueryClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GDataDocumentsUploadQueryPrivate));
+
+ gobject_class->get_property = gdata_documents_upload_query_get_property;
+ gobject_class->set_property = gdata_documents_upload_query_set_property;
+ gobject_class->dispose = gdata_documents_upload_query_dispose;
+
+ /**
+ * GDataDocumentsUploadQuery:folder:
+ *
+ * Folder to upload the document into. If this is %NULL, the document will be uploaded into the root folder.
+ *
+ * Since: 0.13.0
+ */
+ g_object_class_install_property (gobject_class, PROP_FOLDER,
+ g_param_spec_object ("folder",
+ "Folder", "Folder to upload the document into.",
+ GDATA_TYPE_DOCUMENTS_FOLDER,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+gdata_documents_upload_query_init (GDataDocumentsUploadQuery *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, GDataDocumentsUploadQueryPrivate);
+}
+
+static void
+gdata_documents_upload_query_dispose (GObject *object)
+{
+ GDataDocumentsUploadQueryPrivate *priv = GDATA_DOCUMENTS_UPLOAD_QUERY (object)->priv;
+
+ g_clear_object (&priv->folder);
+
+ /* Chain up to the parent class */
+ G_OBJECT_CLASS (gdata_documents_upload_query_parent_class)->dispose (object);
+}
+
+static void
+gdata_documents_upload_query_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ GDataDocumentsUploadQueryPrivate *priv = GDATA_DOCUMENTS_UPLOAD_QUERY (object)->priv;
+
+ switch (property_id) {
+ case PROP_FOLDER:
+ g_value_set_object (value, priv->folder);
+ break;
+ default:
+ /* We don't have any other property... */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gdata_documents_upload_query_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ GDataDocumentsUploadQuery *self = GDATA_DOCUMENTS_UPLOAD_QUERY (object);
+
+ switch (property_id) {
+ case PROP_FOLDER:
+ gdata_documents_upload_query_set_folder (self, g_value_get_object (value));
+ break;
+ default:
+ /* We don't have any other property... */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+/**
+ * gdata_documents_upload_query_new:
+ *
+ * Constructs a new empty #GDataDocumentsUploadQuery.
+ *
+ * Return value: (transfer full): a new #GDataDocumentsUploadQuery; unref with g_object_unref()
+ *
+ * Since: 0.13.0
+ */
+GDataDocumentsUploadQuery *
+gdata_documents_upload_query_new (void)
+{
+ return g_object_new (GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, NULL);
+}
+
+/**
+ * gdata_documents_upload_query_build_uri:
+ * @self: a #GDataDocumentsUploadQuery
+ *
+ * Builds an upload URI suitable for passing to gdata_upload_stream_new_resumable() in order to upload a document to Google Documents as described in
+ * the
+ * <ulink type="http" url="https://developers.google.com/google-apps/documents-list/#uploading_a_new_document_or_file_with_both_metadata_and_content">
+ * online documentation</ulink>.
+ *
+ * Return value: (transfer full): a complete upload URI; free with g_free()
+ *
+ * Since: 0.13.0
+ */
+gchar *
+gdata_documents_upload_query_build_uri (GDataDocumentsUploadQuery *self)
+{
+ gchar *base_uri;
+ GDataDocumentsUploadQueryPrivate *priv;
+
+ g_return_val_if_fail (GDATA_IS_DOCUMENTS_UPLOAD_QUERY (self), NULL);
+
+ priv = self->priv;
+
+ /* Construct the base URI. */
+ if (priv->folder != NULL) {
+ GDataLink *upload_link;
+
+ /* Get the folder's upload URI. */
+ upload_link = gdata_entry_look_up_link (GDATA_ENTRY (priv->folder), GDATA_LINK_RESUMABLE_CREATE_MEDIA);
+
+ if (upload_link == NULL) {
+ /* Fall back to building a URI manually. */
+ base_uri = _gdata_service_build_uri ("%s://docs.google.com/feeds/upload/create-session/default/private/full/%s/contents",
+ _gdata_service_get_scheme (),
+ gdata_documents_entry_get_resource_id (GDATA_DOCUMENTS_ENTRY (priv->folder)));
+ } else {
+ base_uri = g_strdup (gdata_link_get_uri (upload_link));
+ }
+ } else {
+ base_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/upload/create-session/default/private/full", NULL);
+ }
+
+ return base_uri;
+}
+
+/**
+ * gdata_documents_upload_query_get_folder:
+ * @self: a #GDataDocumentsUploadQuery
+ *
+ * Gets #GDataDocumentsUploadQuery:folder.
+ *
+ * Return value: (allow-none) (transfer none): the folder to upload into, or %NULL
+ *
+ * Since: 0.13.0
+ */
+GDataDocumentsFolder *
+gdata_documents_upload_query_get_folder (GDataDocumentsUploadQuery *self)
+{
+ g_return_val_if_fail (GDATA_IS_DOCUMENTS_UPLOAD_QUERY (self), NULL);
+
+ return self->priv->folder;
+}
+
+/**
+ * gdata_documents_upload_query_set_folder:
+ * @self: a #GDataDocumentsUploadQuery
+ * @folder: (allow-none) (transfer none): a new folder to upload into, or %NULL
+ *
+ * Sets #GDataDocumentsUploadQuery:folder to @folder.
+ *
+ * Since: 0.13.0
+ */
+void
+gdata_documents_upload_query_set_folder (GDataDocumentsUploadQuery *self, GDataDocumentsFolder *folder)
+{
+ g_return_if_fail (GDATA_IS_DOCUMENTS_UPLOAD_QUERY (self));
+ g_return_if_fail (folder == NULL || GDATA_IS_DOCUMENTS_FOLDER (folder));
+
+ if (folder == self->priv->folder) {
+ return;
+ }
+
+ if (folder != NULL) {
+ g_object_ref (folder);
+ }
+
+ g_clear_object (&self->priv->folder);
+ self->priv->folder = folder;
+
+ g_object_notify (G_OBJECT (self), "folder");
+}
diff --git a/gdata/services/documents/gdata-documents-upload-query.h b/gdata/services/documents/gdata-documents-upload-query.h
new file mode 100644
index 00000000..92a19598
--- /dev/null
+++ b/gdata/services/documents/gdata-documents-upload-query.h
@@ -0,0 +1,75 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * GData Client
+ * Copyright (C) Philip Withnall 2012 <philip@tecnocode.co.uk>
+ *
+ * GData Client is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * GData Client is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GData Client. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GDATA_DOCUMENTS_UPLOAD_QUERY_H
+#define GDATA_DOCUMENTS_UPLOAD_QUERY_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gdata/services/documents/gdata-documents-folder.h>
+
+G_BEGIN_DECLS
+
+#define GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY (gdata_documents_upload_query_get_type ())
+#define GDATA_DOCUMENTS_UPLOAD_QUERY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, GDataDocumentsUploadQuery))
+#define GDATA_DOCUMENTS_UPLOAD_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, GDataDocumentsUploadQueryClass))
+#define GDATA_IS_DOCUMENTS_UPLOAD_QUERY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY))
+#define GDATA_IS_DOCUMENTS_UPLOAD_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY))
+#define GDATA_DOCUMENTS_UPLOAD_QUERY_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_DOCUMENTS_UPLOAD_QUERY, GDataDocumentsUploadQueryClass))
+
+typedef struct _GDataDocumentsUploadQueryPrivate GDataDocumentsUploadQueryPrivate;
+
+/**
+ * GDataDocumentsUploadQuery:
+ *
+ * All the fields in the #GDataDocumentsUploadQuery structure are private and should never be accessed directly.
+ *
+ * Since: 0.13.0
+ */
+typedef struct {
+ GObject parent;
+ GDataDocumentsUploadQueryPrivate *priv;
+} GDataDocumentsUploadQuery;
+
+/**
+ * GDataDocumentsUploadQueryClass:
+ *
+ * All the fields in the #GDataDocumentsUploadQueryClass structure are private and should never be accessed directly.
+ *
+ * Since: 0.13.0
+ */
+typedef struct {
+ /*< private >*/
+ GObjectClass parent;
+} GDataDocumentsUploadQueryClass;
+
+GType gdata_documents_upload_query_get_type (void) G_GNUC_CONST;
+
+GDataDocumentsUploadQuery *gdata_documents_upload_query_new (void) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
+
+gchar *gdata_documents_upload_query_build_uri (GDataDocumentsUploadQuery *self) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
+
+GDataDocumentsFolder *gdata_documents_upload_query_get_folder (GDataDocumentsUploadQuery *self) G_GNUC_PURE;
+void gdata_documents_upload_query_set_folder (GDataDocumentsUploadQuery *self, GDataDocumentsFolder *folder);
+
+G_END_DECLS
+
+#endif /* !GDATA_DOCUMENTS_UPLOAD_QUERY_H */
diff --git a/gdata/tests/documents.c b/gdata/tests/documents.c
index 2e44d1f8..ff5bf474 100644
--- a/gdata/tests/documents.c
+++ b/gdata/tests/documents.c
@@ -631,13 +631,22 @@ test_upload (UploadDocumentData *data, gconstpointer _test_params)
g_file_info_get_content_type (file_info), data->folder,
NULL, &error);
break;
- case UPLOAD_RESUMABLE:
+ case UPLOAD_RESUMABLE: {
+ GDataDocumentsUploadQuery *upload_query;
+
+ upload_query = gdata_documents_upload_query_new ();
+ gdata_documents_upload_query_set_folder (upload_query, data->folder);
+
upload_stream = gdata_documents_service_upload_document_resumable (test_params->service, document,
g_file_info_get_display_name (file_info),
g_file_info_get_content_type (file_info),
- g_file_info_get_size (file_info), data->folder,
+ g_file_info_get_size (file_info), upload_query,
NULL, &error);
+
+ g_object_unref (upload_query);
+
break;
+ }
default:
g_assert_not_reached ();
}