GData.BatchOperation¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
The authorization domain for the batch operation. |
||
r/w/co |
The feed URI that this batch operation will be sent to. |
||
r/w/co |
The service this batch operation is attached to. |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent |
r |
Class Details¶
- class GData.BatchOperation(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
All the fields in the
GData.BatchOperationstructure are private and should never be accessed directly.New in version 0.7.0.
- add_deletion(entry, callback, *user_data)¶
- Parameters:
entry (
GData.Entry) – theGData.Entryto deletecallback (
GData.BatchOperationCallback) – aGData.BatchOperationCallbackto call when the deletion is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
- Returns:
operation ID for the added deletion, or 0
- Return type:
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.Entrymore 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 ofGData.BatchOperationType.DELETION.New in version 0.7.0.
- add_insertion(entry, callback, *user_data)¶
- Parameters:
entry (
GData.Entry) – theGData.Entryto insertcallback (
GData.BatchOperationCallback) – aGData.BatchOperationCallbackto call when the insertion is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
- Returns:
operation ID for the added insertion, or 0
- Return type:
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 ofGData.BatchOperationType.INSERTION.New in version 0.7.0.
- add_query(id, entry_type, callback, *user_data)¶
- Parameters:
id (
str) – the ID of the entry being queried forentry_type (
GObject.GType) – the type of the entry which will be returnedcallback (
GData.BatchOperationCallback) – aGData.BatchOperationCallbackto call when the query is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
- Returns:
operation ID for the added query, or 0
- Return type:
Add a query to the
GData.BatchOperation, to be executed when the operation is run. The query will return aGData.Entry(of subclass type entry_type) representing the given entry id. The ID is of the same format as that returned byGData.Entry.get_id().Note that a single batch operation should not operate on a given
GData.Entrymore 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.BatchOperationis run withGData.BatchOperation.run() (in which case it will be called in the thread which ran the batch operation), or withGData.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 ofGData.BatchOperation.add_query(), and the operation_type will beGData.BatchOperationType.QUERY. If the query was successful, the resulting entry will be passed to the callback function as entry, and error will beNone. If, however, the query was unsuccessful, entry will beNoneand error will contain aGLib.Errordetailing what went wrong.New in version 0.7.0.
- add_update(entry, callback, *user_data)¶
- Parameters:
entry (
GData.Entry) – theGData.Entryto updatecallback (
GData.BatchOperationCallback) – aGData.BatchOperationCallbackto call when the update is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
- Returns:
operation ID for the added update, or 0
- Return type:
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.Entrymore 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 ofGData.BatchOperationType.UPDATE.New in version 0.7.0.
- get_authorization_domain()¶
- Returns:
the
GData.AuthorizationDomainused to authorize the batch operation, orNone- Return type:
Gets the
GData.BatchOperation:authorization-domainproperty.New in version 0.9.0.
- get_feed_uri()¶
- Returns:
the batch operation’s feed URI
- Return type:
Gets the
GData.BatchOperation:feed-uriproperty.New in version 0.7.0.
- get_service()¶
- Returns:
the batch operation’s attached service
- Return type:
Gets the
GData.BatchOperation:serviceproperty.New in version 0.7.0.
- run(cancellable)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNone- Raises:
- Returns:
- Return type:
Run the
GData.BatchOperationsynchronously. This will send all the operations in the batch operation to the server, and call their respective callbacks synchronously (i.e. beforeGData.BatchOperation.run() returns, and in the same thread that calledGData.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 returnTrueeven 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:
cancellable (
Gio.CancellableorNone) – aGio.Cancellable, orNonecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the batch operation is finished, orNoneuser_data (
objectorNone) – data to pass to the callback function
Run the
GData.BatchOperationasynchronously. 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 afterGData.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) – aGio.AsyncResult- Raises:
- Returns:
- Return type:
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:
- Default Value:
- Flags:
The authorization domain for the batch operation, against which the
GData.Service:authorizerfor theGData.BatchOperation:serviceshould be authorized. This may beNoneif 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:
- Default Value:
- Flags:
The feed URI that this batch operation will be sent to.
New in version 0.7.0.
- GData.BatchOperation.props.service¶
- Name:
service- Type:
- Default Value:
- Flags:
The service this batch operation is attached to.
New in version 0.7.0.