GData.BatchOperation

g GData.BatchOperation GData.BatchOperation GObject.Object GObject.Object GObject.Object->GData.BatchOperation

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_deletion (entry, callback, *user_data)

add_insertion (entry, callback, *user_data)

add_query (id, entry_type, callback, *user_data)

add_update (entry, callback, *user_data)

get_authorization_domain ()

get_feed_uri ()

get_service ()

run (cancellable)

run_async (cancellable, callback, *user_data)

run_finish (async_result)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

authorization-domain

GData.AuthorizationDomain

r/w/co

The authorization domain for the batch operation.

feed-uri

str

r/w/co

The feed URI that this batch operation will be sent to.

service

GData.Service

r/w/co

The service this batch operation is attached to.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class GData.BatchOperation(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

GData.BatchOperationClass

All the fields in the GData.BatchOperation structure are private and should never be accessed directly.

New in version 0.7.0.

add_deletion(entry, callback, *user_data)
Parameters:
Returns:

operation ID for the added deletion, or 0

Return type:

int

Add an entry to the GData.BatchOperation, to be deleted on the server when the operation is run. entry is reffed by the function, so may be freed after it returns.

Note that a single batch operation should not operate on a given GData.Entry more than once, as there’s no guarantee about the order in which the batch operation’s operations will be performed.

callback will be called as specified in the documentation for GData.BatchOperation.add_query(), with an operation_type of GData.BatchOperationType.DELETION.

New in version 0.7.0.

add_insertion(entry, callback, *user_data)
Parameters:
Returns:

operation ID for the added insertion, or 0

Return type:

int

Add an entry to the GData.BatchOperation, to be inserted on the server when the operation is run. The insertion will return the inserted version of entry. entry is reffed by the function, so may be freed after it returns.

callback will be called as specified in the documentation for GData.BatchOperation.add_query(), with an operation_type of GData.BatchOperationType.INSERTION.

New in version 0.7.0.

add_query(id, entry_type, callback, *user_data)
Parameters:
Returns:

operation ID for the added query, or 0

Return type:

int

Add a query to the GData.BatchOperation, to be executed when the operation is run. The query will return a GData.Entry (of subclass type entry_type) representing the given entry id. The ID is of the same format as that returned by GData.Entry.get_id().

Note that a single batch operation should not operate on a given GData.Entry more than once, as there’s no guarantee about the order in which the batch operation’s operations will be performed.

callback will be called when the GData.BatchOperation is run with GData.BatchOperation.run() (in which case it will be called in the thread which ran the batch operation), or with GData.BatchOperation.run_async() (in which case it will be called in an idle handler in the main thread). The operation_id passed to the callback will match the return value of GData.BatchOperation.add_query(), and the operation_type will be GData.BatchOperationType.QUERY. If the query was successful, the resulting entry will be passed to the callback function as entry, and error will be None. If, however, the query was unsuccessful, entry will be None and error will contain a GLib.Error detailing what went wrong.

New in version 0.7.0.

add_update(entry, callback, *user_data)
Parameters:
Returns:

operation ID for the added update, or 0

Return type:

int

Add an entry to the GData.BatchOperation, to be updated on the server when the operation is run. The update will return the updated version of entry. entry is reffed by the function, so may be freed after it returns.

Note that a single batch operation should not operate on a given GData.Entry more than once, as there’s no guarantee about the order in which the batch operation’s operations will be performed.

callback will be called as specified in the documentation for GData.BatchOperation.add_query(), with an operation_type of GData.BatchOperationType.UPDATE.

New in version 0.7.0.

get_authorization_domain()
Returns:

the GData.AuthorizationDomain used to authorize the batch operation, or None

Return type:

GData.AuthorizationDomain or None

Gets the GData.BatchOperation :authorization-domain property.

New in version 0.9.0.

get_feed_uri()
Returns:

the batch operation’s feed URI

Return type:

str

Gets the GData.BatchOperation :feed-uri property.

New in version 0.7.0.

get_service()
Returns:

the batch operation’s attached service

Return type:

GData.Service

Gets the GData.BatchOperation :service property.

New in version 0.7.0.

run(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable, or None

Raises:

GLib.Error

Returns:

True on success, False otherwise

Return type:

bool

Run the GData.BatchOperation synchronously. This will send all the operations in the batch operation to the server, and call their respective callbacks synchronously (i.e. before GData.BatchOperation.run() returns, and in the same thread that called GData.BatchOperation.run()) as the server returns results for each operation.

The callbacks for all of the operations in the batch operation are always guaranteed to be called, even if the batch operation as a whole fails. Each callback will be called exactly once for each time GData.BatchOperation.run() is called.

The return value of the function indicates whether the overall batch operation was successful, and doesn’t indicate the status of any of the operations it comprises. GData.BatchOperation.run() could return True even if all of its operations failed.

cancellable can be used to cancel the entire batch operation any time before or during the network activity. If cancellable is cancelled after network activity has finished, GData.BatchOperation.run() will continue and finish as normal.

New in version 0.7.0.

run_async(cancellable, callback, *user_data)
Parameters:

Run the GData.BatchOperation asynchronously. This will send all the operations in the batch operation to the server, and call their respective callbacks asynchronously (i.e. in idle functions in the main thread, usually after GData.BatchOperation.run_async() has returned) as the server returns results for each operation. self is reffed when this function is called, so can safely be unreffed after this function returns.

For more details, see GData.BatchOperation.run(), which is the synchronous version of this function.

When the entire batch operation is finished, callback will be called. You can then call GData.BatchOperation.run_finish() to get the results of the batch operation.

New in version 0.7.0.

run_finish(async_result)
Parameters:

async_result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True on success, False otherwise

Return type:

bool

Finishes an asynchronous batch operation run with GData.BatchOperation.run_async().

Return values are as for GData.BatchOperation.run().

New in version 0.7.0.

Property Details

GData.BatchOperation.props.authorization_domain
Name:

authorization-domain

Type:

GData.AuthorizationDomain

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The authorization domain for the batch operation, against which the GData.Service :authorizer for the GData.BatchOperation :service should be authorized. This may be None if authorization is not needed for any of the requests in the batch operation.

All requests in the batch operation must be authorizable under this single authorization domain. If requests need different authorization domains, they must be performed in different batch operations.

New in version 0.9.0.

GData.BatchOperation.props.feed_uri
Name:

feed-uri

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The feed URI that this batch operation will be sent to.

New in version 0.7.0.

GData.BatchOperation.props.service
Name:

service

Type:

GData.Service

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The service this batch operation is attached to.

New in version 0.7.0.