Rest.ProxyCall¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/co |
Proxy for this call |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class Rest.ProxyCall(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Rest.ProxyCallhas no publicly available members.- add_header(header, value)¶
-
Add a header called header with the value value to the call. If a header with this name already exists, the new value will replace the old.
- add_param(name, value)¶
-
Add a query parameter called param with the string value value to the call. If a parameter with this name already exists, the new value will replace the old.
- add_param_full(param)¶
- Parameters:
param (
Rest.Param) – ARest.Param
Add a query parameter param to the call. If a parameter with this name already exists, the new value will replace the old.
- get_function()¶
- Returns:
The REST “function” for the current call, see also
Rest.ProxyCall.set_function(). This string is owned by theRest.ProxyCalland should not be freed.- Return type:
Get the REST function that is going to be called on the proxy.
New in version 0.7.92.
- get_method()¶
- Returns:
the HTTP method
- Return type:
Get the HTTP method to use when making the call, for example GET or POST.
- get_params()¶
- Returns:
A
Rest.Params.- Return type:
Get the parameters as a
Rest.Paramsof parameter names to values. The returned value is owned by theRest.ProxyCallinstance and should not be freed by the caller.
- get_payload()¶
- Returns:
A pointer to the payload. This is owned by
Rest.ProxyCalland should not be freed.- Return type:
Get the return payload.
- get_payload_length()¶
- Returns:
the length of the payload in bytes.
- Return type:
Get the length of the return payload.
- get_response_headers()¶
- Returns:
pointer to a hash table of headers. This hash table must not be changed. You should call
GLib.HashTable.unref() when you have finished with it.- Return type:
- get_status_message()¶
- Returns:
The status message. This string is owned by
Rest.ProxyCalland should not be freed.- Return type:
Get the human-readable HTTP status message for the call.
- invoke_async(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – an optionalGio.Cancellablethat can be used to cancel the call, orNonecallback (
Gio.AsyncReadyCallbackorNone) – callback to call when the async call is finished
- invoke_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – the result from theGio.AsyncReadyCallback- Raises:
- Returns:
Trueon success- Return type:
- lookup_header(header)¶
- Parameters:
header (
str) – The header name- Returns:
The header value, or
Noneif it does not exist. This string is owned by theRest.ProxyCalland should not be freed.- Return type:
Get the value of the header called header.
- lookup_param(name)¶
- Parameters:
name (
str) – The paramter name- Returns:
The parameter value, or
Noneif it does not exist. This string is owned by theRest.ProxyCalland should not be freed.- Return type:
Rest.ParamorNone
Get the value of the parameter called name.
- lookup_response_header(header)¶
-
Get the string value of the header header or
Noneif that header is not present or there are no headers.
- remove_header(header)¶
- Parameters:
header (
str) – The header name
Remove the header named header from the call.
- remove_param(name)¶
- Parameters:
name (
str) – The paramter name
Remove the parameter named name from the call.
- serialize_params()¶
- Raises:
- Returns:
Trueif the serialization was successful,Falseotherwise.- content_type:
Content type of the payload
- content:
The payload
- content_len:
Length of the payload data
- Return type:
Invoker for a virtual method to serialize the parameters for this
Rest.ProxyCall.
- set_function(function)¶
- Parameters:
function (
str) – The function to call
Set the REST “function” to call on the proxy. This is appended to the URL, so that for example a proxy with the URL
http://www.example.com/and the functiontestwould actually access the URLhttp://www.example.com/test
- set_method(method)¶
- Parameters:
method (
str) – The HTTP method to use
Set the HTTP method to use when making the call, for example GET or POST.
- sync()¶
- Raises:
- Returns:
Trueon success,Falseif a failure occurred, in which case error_out will be set.- Return type:
Synchronously invokes self. After this function has returned,
Rest.ProxyCall.get_payload() will return the result of this call.Note that this will block an undefined amount of time, so
Rest.ProxyCall.invoke_async() is generally recommended.
- upload(callback, weak_object, *userdata)¶
- Parameters:
callback (
Rest.ProxyCallUploadCallback) – aRest.ProxyCallUploadCallbackto invoke when a chunk of data was uploadedweak_object (
GObject.Object) – TheGObject.Objectto weakly reference and tie the lifecycle to
- Raises:
- Return type:
Asynchronously invoke self but expect to have the callback invoked every time a chunk of our request’s body is written.
When the callback is invoked with the uploaded byte count equaling the message byte count, the call has completed.
If weak_object is disposed during the call then this call will be cancelled. If the call is cancelled then the callback will be invoked with an error state.
You may unref the call after calling this function since there is an internal reference, or you may unref in the callback.
- do_prepare() virtual¶
- Return type:
Virtual function called before making the request, This allows the call to be modified, for example to add a signature.
- do_serialize_params() virtual¶
- Returns:
Trueif the serialization was successful,Falseotherwise.- content_type:
Content type of the payload
- content:
The payload
- content_len:
Length of the payload data
- Return type:
Invoker for a virtual method to serialize the parameters for this
Rest.ProxyCall.
Property Details¶
- Rest.ProxyCall.props.proxy¶
- Name:
proxy- Type:
- Default Value:
- Flags:
Proxy for this call