1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * GData Client
4  * Copyright (C) Thibault Saunier 2009 <saunierthibault@gmail.com>
5  *
6  * GData Client is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * GData Client is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef GDATA_DOCUMENTS_SERVICE_H
21 #define GDATA_DOCUMENTS_SERVICE_H
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 #include <gio/gio.h>
26 #include <gdata/gdata-service.h>
27 #include <gdata/gdata-upload-stream.h>
28 #include <gdata/services/documents/gdata-documents-query.h>
29 #include <gdata/services/documents/gdata-documents-feed.h>
30 #include <gdata/services/documents/gdata-documents-metadata.h>
31 
32 G_BEGIN_DECLS
33 
34 /**
35  * GDataDocumentsServiceError:
36  * @GDATA_DOCUMENTS_SERVICE_ERROR_INVALID_CONTENT_TYPE: the content type of a provided file was invalid
37  *
38  * Error codes for #GDataDocumentsService operations.
39  *
40  * Since: 0.4.0
41  */
42 typedef enum {
43 	GDATA_DOCUMENTS_SERVICE_ERROR_INVALID_CONTENT_TYPE
44 } GDataDocumentsServiceError;
45 
46 #define GDATA_TYPE_DOCUMENTS_SERVICE		(gdata_documents_service_get_type ())
47 #define GDATA_DOCUMENTS_SERVICE(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_DOCUMENTS_SERVICE, GDataDocumentsService))
48 #define GDATA_DOCUMENTS_SERVICE_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_DOCUMENTS_SERVICE, GDataDocumentsServiceClass))
49 #define GDATA_IS_DOCUMENTS_SERVICE(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_DOCUMENTS_SERVICE))
50 #define GDATA_IS_DOCUMENTS_SERVICE_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_DOCUMENTS_SERVICE))
51 #define GDATA_DOCUMENTS_SERVICE_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_DOCUMENTS_SERVICE, GDataDocumentsServiceClass))
52 
53 #define GDATA_DOCUMENTS_SERVICE_ERROR		gdata_documents_service_error_quark ()
54 
55 typedef struct _GDataDocumentsServicePrivate	GDataDocumentsServicePrivate;
56 
57 /**
58  * GDataDocumentsService:
59  *
60  * All the fields in the #GDataDocumentsService structure are private and should never be accessed directly.
61  *
62  * Since: 0.4.0
63  */
64 typedef struct {
65 	GDataService parent;
66 	GDataDocumentsServicePrivate *priv;
67 } GDataDocumentsService;
68 
69 /**
70  * GDataDocumentsServiceClass:
71  *
72  * All the fields in the #GDataDocumentsServiceClass structure are private and should never be accessed directly.
73  *
74  * Since: 0.4.0
75  */
76 typedef struct {
77 	/*< private >*/
78 	GDataServiceClass parent;
79 
80 	/*< private >*/
81 	/* Padding for future expansion */
82 	void (*_g_reserved0) (void);
83 	void (*_g_reserved1) (void);
84 	void (*_g_reserved2) (void);
85 	void (*_g_reserved3) (void);
86 	void (*_g_reserved4) (void);
87 	void (*_g_reserved5) (void);
88 } GDataDocumentsServiceClass;
89 
90 GType gdata_documents_service_get_type (void) G_GNUC_CONST;
91 GQuark gdata_documents_service_error_quark (void) G_GNUC_CONST;
92 
93 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDataDocumentsService, g_object_unref)
94 
95 GDataDocumentsService *gdata_documents_service_new (GDataAuthorizer *authorizer) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
96 
97 GDataAuthorizationDomain *gdata_documents_service_get_primary_authorization_domain (void) G_GNUC_CONST;
98 GDataAuthorizationDomain *gdata_documents_service_get_spreadsheet_authorization_domain (void) G_GNUC_CONST;
99 
100 GDataDocumentsMetadata *gdata_documents_service_get_metadata (GDataDocumentsService *self, GCancellable *cancellable,
101                                                               GError **error)  G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
102 void gdata_documents_service_get_metadata_async (GDataDocumentsService *self, GCancellable *cancellable,
103                                                  GAsyncReadyCallback callback, gpointer user_data);
104 GDataDocumentsMetadata *gdata_documents_service_get_metadata_finish (GDataDocumentsService *self, GAsyncResult *async_result,
105                                                                      GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
106 
107 GDataDocumentsFeed *gdata_documents_service_query_documents (GDataDocumentsService *self, GDataDocumentsQuery *query, GCancellable *cancellable,
108                                                              GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
109                                                              GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
110 void gdata_documents_service_query_documents_async (GDataDocumentsService *self, GDataDocumentsQuery *query, GCancellable *cancellable,
111                                                     GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
112                                                     GDestroyNotify destroy_progress_user_data,
113                                                     GAsyncReadyCallback callback, gpointer user_data);
114 
115 #include <gdata/services/documents/gdata-documents-document.h>
116 #include <gdata/services/documents/gdata-documents-folder.h>
117 #include <gdata/services/documents/gdata-documents-upload-query.h>
118 
119 GDataUploadStream *gdata_documents_service_upload_document (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
120                                                             const gchar *content_type, GDataDocumentsFolder *folder,
121                                                             GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
122 GDataUploadStream *gdata_documents_service_upload_document_resumable (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
123                                                                       const gchar *content_type, goffset content_length,
124                                                                       GDataDocumentsUploadQuery *query,
125                                                                       GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
126 
127 GDataUploadStream *gdata_documents_service_update_document (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
128                                                             const gchar *content_type, GCancellable *cancellable,
129                                                             GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
130 GDataUploadStream *gdata_documents_service_update_document_resumable (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug,
131                                                                       const gchar *content_type, goffset content_length, GCancellable *cancellable,
132                                                                       GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
133 
134 GDataDocumentsDocument *gdata_documents_service_finish_upload (GDataDocumentsService *self, GDataUploadStream *upload_stream,
135                                                                GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
136 
137 GDataDocumentsDocument *gdata_documents_service_copy_document (GDataDocumentsService *self, GDataDocumentsDocument *document,
138                                                                GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
139 void gdata_documents_service_copy_document_async (GDataDocumentsService *self, GDataDocumentsDocument *document, GCancellable *cancellable,
140                                                   GAsyncReadyCallback callback, gpointer user_data);
141 GDataDocumentsDocument *gdata_documents_service_copy_document_finish (GDataDocumentsService *self, GAsyncResult *async_result,
142                                                                       GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
143 
144 GDataDocumentsEntry *gdata_documents_service_add_entry_to_folder (GDataDocumentsService *self, GDataDocumentsEntry *entry,
145                                                                   GDataDocumentsFolder *folder, GCancellable *cancellable,
146                                                                   GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
147 void gdata_documents_service_add_entry_to_folder_async (GDataDocumentsService *self, GDataDocumentsEntry *entry, GDataDocumentsFolder *folder,
148                                                         GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
149 GDataDocumentsEntry *gdata_documents_service_add_entry_to_folder_finish (GDataDocumentsService *self, GAsyncResult *async_result,
150                                                                          GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
151 
152 GDataDocumentsEntry *gdata_documents_service_remove_entry_from_folder (GDataDocumentsService *self, GDataDocumentsEntry *entry,
153                                                                        GDataDocumentsFolder *folder, GCancellable *cancellable,
154                                                                        GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
155 void gdata_documents_service_remove_entry_from_folder_async (GDataDocumentsService *self, GDataDocumentsEntry *entry, GDataDocumentsFolder *folder,
156                                                              GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
157 GDataDocumentsEntry *gdata_documents_service_remove_entry_from_folder_finish (GDataDocumentsService *self, GAsyncResult *async_result,
158                                                                               GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
159 
160 gchar *gdata_documents_service_get_upload_uri (GDataDocumentsFolder *folder) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
161 
162 G_END_DECLS
163 #endif /* !GDATA_DOCUMENTS_SERVICE_H */
164