|
Packit |
4b6dd7 |
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
|
Packit |
4b6dd7 |
/*
|
|
Packit |
4b6dd7 |
* GData Client
|
|
Packit |
4b6dd7 |
* Copyright (C) Philip Withnall 2010 <philip@tecnocode.co.uk>
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* GData Client is free software; you can redistribute it and/or
|
|
Packit |
4b6dd7 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
4b6dd7 |
* License as published by the Free Software Foundation; either
|
|
Packit |
4b6dd7 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* GData Client is distributed in the hope that it will be useful,
|
|
Packit |
4b6dd7 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
4b6dd7 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
4b6dd7 |
* Lesser General Public License for more details.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
4b6dd7 |
* License along with GData Client. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
4b6dd7 |
*/
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
#ifndef GDATA_BATCH_OPERATION_H
|
|
Packit |
4b6dd7 |
#define GDATA_BATCH_OPERATION_H
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
#include <glib.h>
|
|
Packit |
4b6dd7 |
#include <glib-object.h>
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
#include <gdata/gdata-service.h>
|
|
Packit |
4b6dd7 |
#include <gdata/gdata-entry.h>
|
|
Packit |
4b6dd7 |
#include <gdata/gdata-authorization-domain.h>
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
G_BEGIN_DECLS
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
/**
|
|
Packit |
4b6dd7 |
* GDATA_LINK_BATCH:
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* The relation type URI for the batch operation URI for a given #GDataFeed.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* For more information, see the <ulink type="http" url="http://code.google.com/apis/gdata/docs/batch.html#Submit_HTTP">GData specification</ulink>.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Since: 0.7.0
|
|
Packit |
4b6dd7 |
*/
|
|
Packit |
4b6dd7 |
#define GDATA_LINK_BATCH "http://schemas.google.com/g/2005#batch"
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
/**
|
|
Packit |
4b6dd7 |
* GDataBatchOperationType:
|
|
Packit |
4b6dd7 |
* @GDATA_BATCH_OPERATION_QUERY: a query operation
|
|
Packit |
4b6dd7 |
* @GDATA_BATCH_OPERATION_INSERTION: an insertion operation
|
|
Packit |
4b6dd7 |
* @GDATA_BATCH_OPERATION_UPDATE: an update operation
|
|
Packit |
4b6dd7 |
* @GDATA_BATCH_OPERATION_DELETION: a deletion operation
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Indicates which type of batch operation caused the current #GDataBatchOperationCallback to be called.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Since: 0.7.0
|
|
Packit |
4b6dd7 |
*/
|
|
Packit |
4b6dd7 |
typedef enum {
|
|
Packit |
4b6dd7 |
GDATA_BATCH_OPERATION_QUERY = 0,
|
|
Packit |
4b6dd7 |
GDATA_BATCH_OPERATION_INSERTION,
|
|
Packit |
4b6dd7 |
GDATA_BATCH_OPERATION_UPDATE,
|
|
Packit |
4b6dd7 |
GDATA_BATCH_OPERATION_DELETION
|
|
Packit |
4b6dd7 |
} GDataBatchOperationType;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
/**
|
|
Packit |
4b6dd7 |
* GDataBatchOperationCallback:
|
|
Packit |
4b6dd7 |
* @operation_id: the operation ID returned from gdata_batch_operation_add_*()
|
|
Packit |
4b6dd7 |
* @operation_type: the type of operation which was requested
|
|
Packit |
4b6dd7 |
* @entry: the result of the operation, or %NULL
|
|
Packit |
4b6dd7 |
* @error: a #GError describing any error which occurred, or %NULL
|
|
Packit |
4b6dd7 |
* @user_data: user data passed to the callback
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Callback function called once for each operation in a batch operation run. The operation is identified by @operation_id and @operation_type (where
|
|
Packit |
4b6dd7 |
* @operation_id is the ID returned by the relevant call to gdata_batch_operation_add_query(), gdata_batch_operation_add_insertion(),
|
|
Packit |
4b6dd7 |
* gdata_batch_operation_add_update() or gdata_batch_operation_add_deletion(), and @operation_type shows which one of the above was called).
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* If the operation was successful, the resulting #GDataEntry will be passed in as @entry, and @error will be %NULL. Otherwise, @entry will be %NULL
|
|
Packit |
4b6dd7 |
* and a descriptive error will be in @error. If @operation_type is %GDATA_BATCH_OPERATION_DELETION, @entry will always be %NULL, and @error will be
|
|
Packit |
4b6dd7 |
* %NULL or non-%NULL as appropriate.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* If the callback code needs to retain a copy of @entry, it must be referenced (with g_object_ref()). Similarly, @error is owned by the calling code,
|
|
Packit |
4b6dd7 |
* and must not be freed.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* The callback is called in the main thread, and there is no guarantee on the order in which the callbacks for the operations in a run are executed,
|
|
Packit |
4b6dd7 |
* or whether they will be called in a timely manner. It is, however, guaranteed that they will all be called before the #GAsyncReadyCallback which
|
|
Packit |
4b6dd7 |
* signals the completion of the run (if initiated with gdata_batch_operation_run_async()) is called; or gdata_batch_operation_run() returns (if
|
|
Packit |
4b6dd7 |
* initiated synchronously).
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Since: 0.7.0
|
|
Packit |
4b6dd7 |
*/
|
|
Packit |
4b6dd7 |
typedef void (*GDataBatchOperationCallback) (guint operation_id, GDataBatchOperationType operation_type, GDataEntry *entry,
|
|
Packit |
4b6dd7 |
GError *error, gpointer user_data);
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
#define GDATA_TYPE_BATCH_OPERATION (gdata_batch_operation_get_type ())
|
|
Packit |
4b6dd7 |
#define GDATA_BATCH_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_BATCH_OPERATION, GDataBatchOperation))
|
|
Packit |
4b6dd7 |
#define GDATA_BATCH_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_BATCH_OPERATION, GDataBatchOperationClass))
|
|
Packit |
4b6dd7 |
#define GDATA_IS_BATCH_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_BATCH_OPERATION))
|
|
Packit |
4b6dd7 |
#define GDATA_IS_BATCH_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_BATCH_OPERATION))
|
|
Packit |
4b6dd7 |
#define GDATA_BATCH_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_BATCH_OPERATION, GDataBatchOperationClass))
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
typedef struct _GDataBatchOperationPrivate GDataBatchOperationPrivate;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
/**
|
|
Packit |
4b6dd7 |
* GDataBatchOperation:
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* All the fields in the #GDataBatchOperation structure are private and should never be accessed directly.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Since: 0.7.0
|
|
Packit |
4b6dd7 |
*/
|
|
Packit |
4b6dd7 |
typedef struct {
|
|
Packit |
4b6dd7 |
GObject parent;
|
|
Packit |
4b6dd7 |
GDataBatchOperationPrivate *priv;
|
|
Packit |
4b6dd7 |
} GDataBatchOperation;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
/**
|
|
Packit |
4b6dd7 |
* GDataBatchOperationClass:
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* All the fields in the #GDataBatchOperationClass structure are private and should never be accessed directly.
|
|
Packit |
4b6dd7 |
*
|
|
Packit |
4b6dd7 |
* Since: 0.7.0
|
|
Packit |
4b6dd7 |
*/
|
|
Packit |
4b6dd7 |
typedef struct {
|
|
Packit |
4b6dd7 |
/*< private >*/
|
|
Packit |
4b6dd7 |
GObjectClass parent;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
/*< private >*/
|
|
Packit |
4b6dd7 |
/* Padding for future expansion */
|
|
Packit |
4b6dd7 |
void (*_g_reserved0) (void);
|
|
Packit |
4b6dd7 |
void (*_g_reserved1) (void);
|
|
Packit |
4b6dd7 |
void (*_g_reserved2) (void);
|
|
Packit |
4b6dd7 |
void (*_g_reserved3) (void);
|
|
Packit |
4b6dd7 |
void (*_g_reserved4) (void);
|
|
Packit |
4b6dd7 |
void (*_g_reserved5) (void);
|
|
Packit |
4b6dd7 |
} GDataBatchOperationClass;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
GType gdata_batch_operation_get_type (void) G_GNUC_CONST;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
GDataService *gdata_batch_operation_get_service (GDataBatchOperation *self) G_GNUC_PURE;
|
|
Packit |
4b6dd7 |
GDataAuthorizationDomain *gdata_batch_operation_get_authorization_domain (GDataBatchOperation *self) G_GNUC_PURE;
|
|
Packit |
4b6dd7 |
const gchar *gdata_batch_operation_get_feed_uri (GDataBatchOperation *self) G_GNUC_PURE;
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
guint gdata_batch_operation_add_query (GDataBatchOperation *self, const gchar *id, GType entry_type,
|
|
Packit |
4b6dd7 |
GDataBatchOperationCallback callback, gpointer user_data);
|
|
Packit |
4b6dd7 |
guint gdata_batch_operation_add_insertion (GDataBatchOperation *self, GDataEntry *entry, GDataBatchOperationCallback callback, gpointer user_data);
|
|
Packit |
4b6dd7 |
guint gdata_batch_operation_add_update (GDataBatchOperation *self, GDataEntry *entry, GDataBatchOperationCallback callback, gpointer user_data);
|
|
Packit |
4b6dd7 |
guint gdata_batch_operation_add_deletion (GDataBatchOperation *self, GDataEntry *entry, GDataBatchOperationCallback callback, gpointer user_data);
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
gboolean gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable, GError **error);
|
|
Packit |
4b6dd7 |
void gdata_batch_operation_run_async (GDataBatchOperation *self, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
|
|
Packit |
4b6dd7 |
gboolean gdata_batch_operation_run_finish (GDataBatchOperation *self, GAsyncResult *async_result, GError **error);
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
G_END_DECLS
|
|
Packit |
4b6dd7 |
|
|
Packit |
4b6dd7 |
#endif /* !GDATA_BATCH_OPERATION_H */
|